* 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-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
}
}
+// 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>
#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
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.
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
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
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;