summaryrefslogtreecommitdiff
path: root/gold/dynobj.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2008-07-22 22:08:43 +0000
committerIan Lance Taylor <ian@airs.com>2008-07-22 22:08:43 +0000
commit92de84a60cbdb80b808c8571e709c1384c6ee6fc (patch)
tree850dc6691e2bef093d847da5d35241b98b04e2ea /gold/dynobj.h
parent3f7c5e1d995c658ef8709e5fae244f25434db931 (diff)
downloadbinutils-gdb-92de84a60cbdb80b808c8571e709c1384c6ee6fc.tar.gz
* cref.cc: New file.
* cref.h: New file. * options.h (class General_options): Add --print-symbol-counts. * main.cc (main): Issue defined symbol report if requested. * archive.cc (Archive::interpret_header): Make into a const member function. (Archive::add_symbols): Call Input_objects::archive_start and archive_stop. (Archive::const_iterator): Define new class. (Archive::begin, Archive::end): New functions. (Archive::include_all_members): Rewrite to use iterator. (Archive::count_members): New function. * archive.h (class Archive): Update declarations. (Archive::filename): New function. * object.cc: Include "cref.h". (Sized_relobj::Sized_relobj): Initialize defined_count_. (Sized_relobj::do_get_global_symbol_counts): New function. (Input_objects::add_object): Add object to cross-referencer. (Input_objects::archive_start): New function. (Input_objects::archive_stop): New function. (Input_objects::print_symbol_counts): New function. * object.h: Declare Cref and Archive. (Object::get_global_symbol_counts): New function. (Object::do_get_global_symbol_counts): New pure virtual function. (class Sized_relobj): Add defined_count_ field. Update declarations. (class Input_objects): Add cref_ field. Update constructor. Update declarations. * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and defined_count_. (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing symbol counts. (Sized_dynobj::do_get_global_symbol_counts): New function. * dynobj.h (class Sized_dynobj): Add fields symbols_ and defined_count_. Update declarations. Define Symbols typedef. * symtab.cc (Symbol_table::add_from_relobj): Add defined parameter. Change all callers. (Symbol_table::add_from_dynobj): Add sympointers and defined parameters. Change all callers. * symtab.h (class Symbol_table): Update declarations. * Makefile.am (CCFILES): Add cref.cc. (HFILES): Add cref.h. * Makefile.in: Rebuild.
Diffstat (limited to 'gold/dynobj.h')
-rw-r--r--gold/dynobj.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/gold/dynobj.h b/gold/dynobj.h
index bd5e12dc5e1..b5b9bd9725d 100644
--- a/gold/dynobj.h
+++ b/gold/dynobj.h
@@ -156,6 +156,8 @@ template<int size, bool big_endian>
class Sized_dynobj : public Dynobj
{
public:
+ typedef typename Sized_relobj<size, big_endian>::Symbols Symbols;
+
Sized_dynobj(const std::string& name, Input_file* input_file, off_t offset,
const typename elfcpp::Ehdr<size, big_endian>&);
@@ -225,6 +227,10 @@ class Sized_dynobj : public Dynobj
Xindex*
do_initialize_xindex();
+ // Get symbol counts.
+ void
+ do_get_global_symbol_counts(const Symbol_table*, size_t*, size_t*) const;
+
private:
// For convenience.
typedef Sized_dynobj<size, big_endian> This;
@@ -288,6 +294,11 @@ class Sized_dynobj : public Dynobj
elfcpp::Elf_file<size, big_endian, Object> elf_file_;
// The section index of the dynamic symbol table.
unsigned int dynsym_shndx_;
+ // The entries in the symbol table for the symbols. We only keep
+ // this if we need it to print symbol information.
+ Symbols* symbols_;
+ // Number of defined symbols.
+ size_t defined_count_;
};
// A base class for Verdef and Verneed_version which just handles the