gold/
* 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.
This commit is contained in:
parent
31a91d61f9
commit
c6905c28a5
4 changed files with 56 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue