* target.h (Target::output_section_name): New function.
authorAlan Modra <amodra@gmail.com>
Tue, 14 Aug 2012 03:39:03 +0000 (03:39 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 14 Aug 2012 03:39:03 +0000 (03:39 +0000)
(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.

gold/ChangeLog
gold/layout.cc
gold/powerpc.cc
gold/target.h

index d7ccce7e52707531bc902b6940005ad791c0afa0..70c15b79f8d7ddfa7683d4ca83217aa18874fa51 100644 (file)
@@ -1,3 +1,10 @@
+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.
index d597fa6f61fe830feb3625cef93781439b920280..006afefc305abf353c3d78d7e7f0a5bcce1ee753 100644 (file)
@@ -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);
index 3c84fd6524d7d7013287d8e79a813e461a592de3..35cf83476dc7cc271e402525bbbbf33483014a43 100644 (file)
@@ -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*);
index 81c8114e5f2883c05f4b0c43f9fccc484bb4dafa..19092e15a31808cc145685f899f352987463c909 100644 (file)
@@ -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.
This page took 0.037601 seconds and 4 git commands to generate.