gold/
authorCary Coutant <ccoutant@google.com>
Wed, 31 Jul 2013 18:47:50 +0000 (18:47 +0000)
committerCary Coutant <ccoutant@google.com>
Wed, 31 Jul 2013 18:47:50 +0000 (18:47 +0000)
* object.cc (Sized_relobj::do_output_section_address): New function.
(Sized_relobj): Instantiate explicitly.
* object.h (Object::output_section_address): New function.
(Object::do_output_section_address): New function.
(Sized_relobj::do_output_section_address): New function.
* powerpc.cc (Target_powerpc::symval_for_branch): Use it.

gold/ChangeLog
gold/object.cc
gold/object.h
gold/powerpc.cc

index b4b468730825d971d17f746768348fc3b04deb8d..1bbeda4d5f52cb20a6776df9e8893d528176475b 100644 (file)
@@ -1,4 +1,13 @@
-2013-07-23  Cary Coutant  <ccoutant@google.com>
+2013-07-31  Cary Coutant  <ccoutant@google.com>
+
+       * object.cc (Sized_relobj::do_output_section_address): New function.
+       (Sized_relobj): Instantiate explicitly.
+       * object.h (Object::output_section_address): New function.
+       (Object::do_output_section_address): New function.
+       (Sized_relobj::do_output_section_address): New function.
+       * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
+
+2013-07-30  Cary Coutant  <ccoutant@google.com>
            Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
 
        * parameters.cc (Parameters::entry): Return target-specific entry
index 1f113d14facf76e80ac4edcfee42f419a02575ab..c98b3c5a7731abf3e204933169886017ded0bfd8 100644 (file)
@@ -389,6 +389,23 @@ Sized_relobj<size, big_endian>::do_for_all_local_got_entries(
     }
 }
 
+// Get the address of an output section.
+
+template<int size, bool big_endian>
+uint64_t
+Sized_relobj<size, big_endian>::do_output_section_address(
+    unsigned int shndx)
+{
+  // If the input file is linked as --just-symbols, the output
+  // section address is the input section address.
+  if (this->just_symbols())
+    return this->section_address(shndx);
+
+  const Output_section* os = this->do_output_section(shndx);
+  gold_assert(os != NULL);
+  return os->address();
+}
+
 // Class Sized_relobj_file.
 
 template<int size, bool big_endian>
@@ -3216,21 +3233,33 @@ Object::find_shdr<64,true>(const unsigned char*, const char*, const char*,
 #endif
 
 #ifdef HAVE_TARGET_32_LITTLE
+template
+class Sized_relobj<32, false>;
+
 template
 class Sized_relobj_file<32, false>;
 #endif
 
 #ifdef HAVE_TARGET_32_BIG
+template
+class Sized_relobj<32, true>;
+
 template
 class Sized_relobj_file<32, true>;
 #endif
 
 #ifdef HAVE_TARGET_64_LITTLE
+template
+class Sized_relobj<64, false>;
+
 template
 class Sized_relobj_file<64, false>;
 #endif
 
 #ifdef HAVE_TARGET_64_BIG
+template
+class Sized_relobj<64, true>;
+
 template
 class Sized_relobj_file<64, true>;
 #endif
index c17c13d2856f8963aea5571855b2d0498b23c329..ae6d9bf4d313798a9c6958d1bee859c04602860d 100644 (file)
@@ -551,6 +551,13 @@ class Object
   output_section(unsigned int shndx) const
   { return this->do_output_section(shndx); }
 
+  // Given a section index, return its address.
+  // The return value will be -1U if the section is specially mapped,
+  // such as a merge section.
+  uint64_t
+  output_section_address(unsigned int shndx)
+  { return this->do_output_section_address(shndx); }
+
   // Given a section index, return the offset in the Output_section.
   // The return value will be -1U if the section is specially mapped,
   // such as a merge section.
@@ -852,6 +859,11 @@ class Object
   do_output_section(unsigned int) const
   { gold_unreachable(); }
 
+  // Get the address of a section--implemented by child class.
+  virtual uint64_t
+  do_output_section_address(unsigned int)
+  { gold_unreachable(); }
+
   // Get the offset of a section--implemented by child class.
   virtual uint64_t
   do_output_section_offset(unsigned int) const
@@ -1929,6 +1941,10 @@ class Sized_relobj : public Relobj
   section_offsets()
   { return this->section_offsets_; }
 
+  // Get the address of an output section.
+  uint64_t
+  do_output_section_address(unsigned int shndx);
+
   // Get the offset of a section.
   uint64_t
   do_output_section_offset(unsigned int shndx) const
index 676aad6f1812717b5a58ee4b7d9ef802718fba95..1afe01c4bfbb51613cc4e796665113600efd27f4 100644 (file)
@@ -6203,7 +6203,7 @@ Target_powerpc<size, big_endian>::symval_for_branch(
   Address opd_addr = symobj->get_output_section_offset(shndx);
   if (opd_addr == invalid_address)
     return value;
-  opd_addr += symobj->output_section(shndx)->address();
+  opd_addr += symobj->output_section_address(shndx);
   if (value >= opd_addr && value < opd_addr + symobj->section_size(shndx))
     {
       Address sec_off;