diff options
author | Ian Lance Taylor <ian@airs.com> | 2008-07-22 22:08:43 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2008-07-22 22:08:43 +0000 |
commit | 92de84a60cbdb80b808c8571e709c1384c6ee6fc (patch) | |
tree | 850dc6691e2bef093d847da5d35241b98b04e2ea /gold/archive.h | |
parent | 3f7c5e1d995c658ef8709e5fae244f25434db931 (diff) | |
download | gdb-92de84a60cbdb80b808c8571e709c1384c6ee6fc.zip gdb-92de84a60cbdb80b808c8571e709c1384c6ee6fc.tar.gz gdb-92de84a60cbdb80b808c8571e709c1384c6ee6fc.tar.bz2 |
* 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/archive.h')
-rw-r--r-- | gold/archive.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/gold/archive.h b/gold/archive.h index c8b05e4..53b8452d8 100644 --- a/gold/archive.h +++ b/gold/archive.h @@ -62,11 +62,18 @@ class Archive // The string expected at the end of an archive member header. static const char arfmag[2]; - // The name of the object. + // The name of the object. This is the name used on the command + // line; e.g., if "-lgcc" is on the command line, this will be + // "gcc". const std::string& name() const { return this->name_; } + // The file name. + const std::string& + filename() const + { return this->input_file_->filename(); } + // Set up the archive: read the symbol map. void setup(); @@ -110,6 +117,11 @@ class Archive clear_uncached_views() { this->input_file_->file().clear_uncached_views(); } + // Whether this is a thin archive. + bool + is_thin_archive() const + { return this->is_thin_archive_; } + // Unlock any nested archives. void unlock_nested_archives(); @@ -119,6 +131,10 @@ class Archive void add_symbols(Symbol_table*, Layout*, Input_objects*, Mapfile*); + // Return the number of members in the archive. + size_t + count_members() const; + private: Archive(const Archive&); Archive& operator=(const Archive&); @@ -144,7 +160,7 @@ class Archive // member, and set *PNAME to the name. off_t interpret_header(const Archive_header* hdr, off_t off, std::string* pname, - off_t* nested_off); + off_t* nested_off) const; // Include all the archive members in the link. void @@ -155,6 +171,17 @@ class Archive include_member(Symbol_table*, Layout*, Input_objects*, off_t off, Mapfile*, Symbol*, const char* why); + // Iterate over archive members. + class const_iterator; + + const_iterator + begin() const; + + const_iterator + end() const; + + friend class const_iterator; + // An entry in the archive map of symbols to object files. struct Armap_entry { |