2009-10-25 Doug Kwan <dougkwan@google.com>
authorDoug Kwan <dougkwan@google.com>
Sun, 25 Oct 2009 16:57:32 +0000 (16:57 +0000)
committerDoug Kwan <dougkwan@google.com>
Sun, 25 Oct 2009 16:57:32 +0000 (16:57 +0000)
* arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
(Arm_input_section::as_arm_input_section): New method.
(Arm_output_section): New class definition.
(Arm_output_section::create_stub_group,
Arm_output_section::group_sections): New method definitions.

gold/ChangeLog
gold/object.h
gold/reloc.cc

index 7799d6c44ac75512e730068d364419a97ae0458f..b2578451b3f0887e8b5979f83d7963725025690f 100644 (file)
@@ -1,3 +1,13 @@
+2009-10-25  Doug Kwan  <dougkwan@google.com>
+
+       * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
+       from private to protected to allow access by child class.
+       (Sized_relobj::do_relocate_sections): New method declaration.
+       (Sized_relobj::relocate_sections): Virtualize.
+       * reloc.cc (Sized_relobj::do_relocate_sections): Rename from 
+       Sized_relobj::relocate_sections.  Instantiate template explicitly
+       for different target sizes and endianity.
+
 2009-10-24  Doug Kwan  <dougkwan@google.com>
 
        * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
index ff9668291f714c2367203fffaeacd8d317f7f530..0d4039761cc363b57c01cd4a2968c9ec9124db96 100644 (file)
@@ -1648,6 +1648,25 @@ class Sized_relobj : public Relobj
   local_values()
   { return &this->local_values_; }
 
+  // Views and sizes when relocating.
+  struct View_size
+  {
+    unsigned char* view;
+    typename elfcpp::Elf_types<size>::Elf_Addr address;
+    off_t offset;
+    section_size_type view_size;
+    bool is_input_output_view;
+    bool is_postprocessing_view;
+  };
+
+  typedef std::vector<View_size> Views;
+
+  // This may be overriden by a child class.
+  virtual void
+  do_relocate_sections(const General_options& options,
+                      const Symbol_table* symtab, const Layout* layout,
+                      const unsigned char* pshdrs, Views* pviews);
+
  private:
   // For convenience.
   typedef Sized_relobj<size, big_endian> This;
@@ -1702,19 +1721,6 @@ class Sized_relobj : public Relobj
                  typename This::Shdr& shdr, unsigned int reloc_shndx,
                  unsigned int reloc_type);
 
-  // Views and sizes when relocating.
-  struct View_size
-  {
-    unsigned char* view;
-    typename elfcpp::Elf_types<size>::Elf_Addr address;
-    off_t offset;
-    section_size_type view_size;
-    bool is_input_output_view;
-    bool is_postprocessing_view;
-  };
-
-  typedef std::vector<View_size> Views;
-
   // Write section data to the output file.  Record the views and
   // sizes in VIEWS for use when relocating.
   void
@@ -1722,8 +1728,10 @@ class Sized_relobj : public Relobj
 
   // Relocate the sections in the output file.
   void
-  relocate_sections(const General_options& options, const Symbol_table*,
-                   const Layout*, const unsigned char* pshdrs, Views*);
+  relocate_sections(const General_options& options, const Symbol_table* symtab,
+                   const Layout* layout, const unsigned char* pshdrs,
+                   Views* pviews)
+  { this->do_relocate_sections(options, symtab, layout, pshdrs, pviews); }
 
   // Scan the input relocations for --emit-relocs.
   void
index 3018dc3daf5f497c6c7358ad95bc841a631a0ffe..0d4f0691df6f9c41cf685725f30960703ac2d7f1 100644 (file)
@@ -799,7 +799,7 @@ Sized_relobj<size, big_endian>::write_sections(const unsigned char* pshdrs,
 
 template<int size, bool big_endian>
 void
-Sized_relobj<size, big_endian>::relocate_sections(
+Sized_relobj<size, big_endian>::do_relocate_sections(
     const General_options& options,
     const Symbol_table* symtab,
     const Layout* layout,
@@ -1536,6 +1536,50 @@ Sized_relobj<64, true>::do_relocate(const General_options& options,
                                    Output_file* of);
 #endif
 
+#ifdef HAVE_TARGET_32_LITTLE
+template
+void
+Sized_relobj<32, false>::do_relocate_sections(
+    const General_options& options,
+    const Symbol_table* symtab,
+    const Layout* layout,
+    const unsigned char* pshdrs,
+    Views* pviews);
+#endif
+
+#ifdef HAVE_TARGET_32_BIG
+template
+void
+Sized_relobj<32, true>::do_relocate_sections(
+    const General_options& options,
+    const Symbol_table* symtab,
+    const Layout* layout,
+    const unsigned char* pshdrs,
+    Views* pviews);
+#endif
+
+#ifdef HAVE_TARGET_64_LITTLE
+template
+void
+Sized_relobj<64, false>::do_relocate_sections(
+    const General_options& options,
+    const Symbol_table* symtab,
+    const Layout* layout,
+    const unsigned char* pshdrs,
+    Views* pviews);
+#endif
+
+#ifdef HAVE_TARGET_64_BIG
+template
+void
+Sized_relobj<64, true>::do_relocate_sections(
+    const General_options& options,
+    const Symbol_table* symtab,
+    const Layout* layout,
+    const unsigned char* pshdrs,
+    Views* pviews);
+#endif
+
 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
 template
 class Merged_symbol_value<32>;