From aeddab66fe1cca5222b8f26dba6f05aa766d5c9e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 14 Oct 2007 15:35:27 +0000 Subject: Keep track of weak aliases, so that overriding environ works. --- gold/symtab.h | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'gold/symtab.h') diff --git a/gold/symtab.h b/gold/symtab.h index b215f5d..b46510d 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -195,6 +195,17 @@ class Symbol set_forwarder() { this->is_forwarder_ = true; } + // Return whether this symbol has an alias in the weak aliases table + // in Symbol_table. + bool + has_alias() const + { return this->has_alias_; } + + // Mark this symbol as having an alias. + void + set_has_alias() + { this->has_alias_ = true; } + // Return whether this symbol needs an entry in the dynamic symbol // table. bool @@ -528,6 +539,9 @@ class Symbol // It forwards to the symbol found in the forwarders_ map of // Symbol_table. bool is_forwarder_ : 1; + // True if the symbol has an alias in the weak_aliases table in + // Symbol_table. + bool has_alias_ : 1; // True if this symbol needs to be in the dynamic symbol table. bool needs_dynsym_entry_ : 1; // True if we've seen this symbol in a regular object. @@ -924,20 +938,20 @@ class Symbol_table // Add a symbol. template - Symbol* + Sized_symbol* add_from_object(Object*, const char *name, Stringpool::Key name_key, const char *version, Stringpool::Key version_key, bool def, const elfcpp::Sym& sym); // Resolve symbols. template - static void + void resolve(Sized_symbol* to, const elfcpp::Sym& sym, Object*, const char* version); template - static void + void resolve(Sized_symbol* to, const Sized_symbol* from, const char* version ACCEPT_SIZE_ENDIAN); @@ -946,11 +960,29 @@ class Symbol_table static bool should_override(const Symbol*, unsigned int, Object*, bool*); + // Override a symbol. + template + void + override(Sized_symbol* tosym, + const elfcpp::Sym& fromsym, + Object* object, const char* version); + // Whether we should override a symbol with a special symbol which // is automatically defined by the linker. static bool should_override_with_special(const Symbol*); + // Override a symbol with a special symbol. + template + void + override_with_special(Sized_symbol* tosym, + const Sized_symbol* fromsym); + + // Record all weak alias sets for a dynamic object. + template + void + record_weak_aliases(std::vector*>*); + // Define a special symbol. template Sized_symbol* @@ -1077,6 +1109,10 @@ class Symbol_table // Forwarding symbols. Unordered_map forwarders_; + // Weak aliases. A symbol in this list points to the next alias. + // The aliases point to each other in a circular list. + Unordered_map weak_aliases_; + // We don't expect there to be very many common symbols, so we keep // a list of them. When we find a common symbol we add it to this // list. It is possible that by the time we process the list the -- cgit v1.1