aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-14 15:35:27 +0000
committerIan Lance Taylor <iant@google.com>2007-10-14 15:35:27 +0000
commitaeddab66fe1cca5222b8f26dba6f05aa766d5c9e (patch)
tree73b472220a14dc021d736cd98eb40a379c7453b3 /gold/symtab.h
parentad435a24655b0c6a0247862c084f8d205b5d6ecc (diff)
downloadgdb-aeddab66fe1cca5222b8f26dba6f05aa766d5c9e.zip
gdb-aeddab66fe1cca5222b8f26dba6f05aa766d5c9e.tar.gz
gdb-aeddab66fe1cca5222b8f26dba6f05aa766d5c9e.tar.bz2
Keep track of weak aliases, so that overriding environ works.
Diffstat (limited to 'gold/symtab.h')
-rw-r--r--gold/symtab.h42
1 files changed, 39 insertions, 3 deletions
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<int size, bool big_endian>
- Symbol*
+ Sized_symbol<size>*
add_from_object(Object*, const char *name, Stringpool::Key name_key,
const char *version, Stringpool::Key version_key,
bool def, const elfcpp::Sym<size, big_endian>& sym);
// Resolve symbols.
template<int size, bool big_endian>
- static void
+ void
resolve(Sized_symbol<size>* to,
const elfcpp::Sym<size, big_endian>& sym,
Object*, const char* version);
template<int size, bool big_endian>
- static void
+ void
resolve(Sized_symbol<size>* to, const Sized_symbol<size>* 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<int size, bool big_endian>
+ void
+ override(Sized_symbol<size>* tosym,
+ const elfcpp::Sym<size, big_endian>& 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<int size>
+ void
+ override_with_special(Sized_symbol<size>* tosym,
+ const Sized_symbol<size>* fromsym);
+
+ // Record all weak alias sets for a dynamic object.
+ template<int size>
+ void
+ record_weak_aliases(std::vector<Sized_symbol<size>*>*);
+
// Define a special symbol.
template<int size, bool big_endian>
Sized_symbol<size>*
@@ -1077,6 +1109,10 @@ class Symbol_table
// Forwarding symbols.
Unordered_map<const Symbol*, Symbol*> 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<Symbol*, Symbol*> 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