diff options
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 11 | ||||
-rw-r--r-- | gold/archive.cc | 4 | ||||
-rw-r--r-- | gold/script.cc | 14 | ||||
-rw-r--r-- | gold/script.h | 8 |
4 files changed, 37 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index caae10c..53bc363 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,14 @@ +2010-11-03 Nick Clifton <nickc@redhat.com> + + PR gold/12001 + * script.h (class Symbol_assignment: name): New member. Returns + the name of the symbol. + * scrfipt.cc (Script_options::is_pending_assignment): New member. + Returns true if the given symbol name is on the list of + assignments wating to be processed. + * archive.cc (should_incldue_member): If the symbol is undefined, + check to see if it is on the list of symbols pending assignment. + 2010-11-03 Ryan Mansfield <rmansfield@qnx.com> * script-sections.cc (Script_sections::find_memory_region): Check diff --git a/gold/archive.cc b/gold/archive.cc index 541a494..a289e5e 100644 --- a/gold/archive.cc +++ b/gold/archive.cc @@ -671,6 +671,10 @@ Archive::should_include_member(Symbol_table* symtab, Layout* layout, } else if (!sym->is_undefined()) return Archive::SHOULD_INCLUDE_NO; + // PR 12001: Do not include an archive when the undefined + // symbol has actually been defined on the command line. + else if (layout->script_options()->is_pending_assignment(sym_name)) + return Archive::SHOULD_INCLUDE_NO; else if (sym->binding() == elfcpp::STB_WEAK) return Archive::SHOULD_INCLUDE_UNKNOWN; diff --git a/gold/script.cc b/gold/script.cc index b92f85c..ada9abc 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -1050,6 +1050,20 @@ Script_options::Script_options() { } +// Returns true if NAME is on the list of symbol assignments waiting +// to be processed. + +bool +Script_options::is_pending_assignment(const char* name) +{ + for (Symbol_assignments::iterator p = this->symbol_assignments_.begin(); + p != this->symbol_assignments_.end(); + ++p) + if ((*p)->name() == name) + return true; + return false; +} + // Add a symbol to be defined. void diff --git a/gold/script.h b/gold/script.h index 70e3a59..e1134ca 100644 --- a/gold/script.h +++ b/gold/script.h @@ -345,6 +345,10 @@ class Symbol_assignment set_if_absolute(Symbol_table*, const Layout*, bool is_dot_available, uint64_t dot_value); + const std::string& + name() const + { return this->name_; } + // Print the assignment to the FILE. This is for debugging. void print(FILE*) const; @@ -423,6 +427,10 @@ class Script_options add_symbol_assignment(const char* name, size_t length, bool is_defsym, Expression* value, bool provide, bool hidden); + // Look for an assigned symbol. + bool + is_pending_assignment(const char* name); + // Add a reference to a symbol. void add_symbol_reference(const char* name, size_t length); |