(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>
+
+ * 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.
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);
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*);
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
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.