diff options
-rw-r--r-- | gold/ChangeLog | 7 | ||||
-rw-r--r-- | gold/layout.cc | 7 | ||||
-rw-r--r-- | gold/powerpc.cc | 13 | ||||
-rw-r--r-- | gold/target.h | 14 |
4 files changed, 40 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index d7ccce7..70c15b7 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,12 @@ 2012-08-14 Alan Modra <amodra@gmail.com> + * target.h (Target::output_section_name): New function. + (Target::do_output_section_name): New function. + * layout.cc (Layout::choose_output_section): Call the above. + * powerpc.cc (Target_powerpc::do_output_section_name): New function. + +2012-08-14 Alan Modra <amodra@gmail.com> + * powerpc.cc: Update for renamed R_PPC_REL16 relocs. (Output_data_got_powerpc::do_write): Don't rely on base class lookup for replace_constant call. diff --git a/gold/layout.cc b/gold/layout.cc index d597fa6..006afef 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -939,7 +939,12 @@ Layout::choose_output_section(const Relobj* relobj, const char* name, if (is_input_section && !this->script_options_->saw_sections_clause() && !parameters->options().relocatable()) - name = Layout::output_section_name(relobj, name, &len); + { + const char *orig_name = name; + name = parameters->target().output_section_name(relobj, name, &len); + if (name == NULL) + name = Layout::output_section_name(relobj, orig_name, &len); + } Stringpool::Key name_key; name = this->namepool_.add_with_length(name, len, true, &name_key); diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 3c84fd6..35cf834 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -125,6 +125,19 @@ class Target_powerpc : public Sized_target<size, big_endian> bool needs_special_offset_handling, size_t local_symbol_count, const unsigned char* plocal_symbols); + + // Map input .toc section to output .got section. + const char* + do_output_section_name(const Relobj*, const char* name, size_t* plen) const + { + if (size == 64 && strcmp(name, ".toc") == 0) + { + *plen = 4; + return ".got"; + } + return NULL; + } + // Finalize the sections. void do_finalize_sections(Layout*, const Input_objects*, Symbol_table*); diff --git a/gold/target.h b/gold/target.h index 81c8114..19092e1 100644 --- a/gold/target.h +++ b/gold/target.h @@ -412,6 +412,15 @@ class Target define_standard_symbols(Symbol_table* symtab, Layout* layout) { this->do_define_standard_symbols(symtab, layout); } + // Return the output section name to use given an input section + // name, or NULL if no target specific name mapping is required. + // Set *PLEN to the length of the name if returning non-NULL. + const char* + output_section_name(const Relobj* relobj, + const char* name, + size_t* plen) const + { return this->do_output_section_name(relobj, name, plen); } + protected: // This struct holds the constant information for a child class. We // use a struct to avoid the overhead of virtual function calls for @@ -655,6 +664,11 @@ class Target do_define_standard_symbols(Symbol_table*, Layout*) { } + // This may be overridden by the child class. + virtual const char* + do_output_section_name(const Relobj*, const char*, size_t*) const + { return NULL; } + private: // The implementations of the four do_make_elf_object virtual functions are // almost identical except for their sizes and endianness. We use a template. |