diff --git a/gold/ChangeLog b/gold/ChangeLog index d2c975e..6eb1194 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2014-01-30 Sasa Stankovic + + * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set + dynsym indexes. + * target.h (Target::has_custom_set_dynsym_indexes): New function. + (Target::set_dynsym_indexes): New function. + 2014-01-28 Cary Coutant Add .gdb_index version 7 support. diff --git a/gold/symtab.cc b/gold/symtab.cc index 2e17529..7721ada 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -2370,6 +2370,25 @@ Symbol_table::set_dynsym_indexes(unsigned int index, { std::vector as_needed_sym; + // Allow a target to set dynsym indexes. + if (parameters->target().has_custom_set_dynsym_indexes()) + { + std::vector dyn_symbols; + for (Symbol_table_type::iterator p = this->table_.begin(); + p != this->table_.end(); + ++p) + { + Symbol* sym = p->second; + if (!sym->should_add_dynsym_entry(this)) + sym->set_dynsym_index(-1U); + else + dyn_symbols.push_back(sym); + } + + return parameters->target().set_dynsym_indexes(&dyn_symbols, index, syms, + dynpool, versions, this); + } + for (Symbol_table_type::iterator p = this->table_.begin(); p != this->table_.end(); ++p) diff --git a/gold/target.h b/gold/target.h index 415b7ed..0a1b637 100644 --- a/gold/target.h +++ b/gold/target.h @@ -37,6 +37,7 @@ #include "elfcpp.h" #include "options.h" #include "parameters.h" +#include "stringpool.h" #include "debug.h" namespace gold @@ -62,6 +63,7 @@ class Output_section; class Input_objects; class Task; struct Symbol_location; +class Versions; // The abstract class for target specific handling. @@ -454,6 +456,17 @@ class Target entry_symbol_name() const { return this->pti_->entry_symbol_name; } + // Whether the target has a custom set_dynsym_indexes method. + virtual bool + has_custom_set_dynsym_indexes() const + { return false; } + + // Custom set_dynsym_indexes method for a target. + virtual unsigned int + set_dynsym_indexes(std::vector*, unsigned int, std::vector*, + Stringpool*, Versions*, Symbol_table*) const + { gold_unreachable(); } + protected: // This struct holds the constant information for a child class. We // use a struct to avoid the overhead of virtual function calls for