aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2013-07-31 18:47:50 +0000
committerCary Coutant <ccoutant@google.com>2013-07-31 18:47:50 +0000
commitc6905c28a51b6716f2d0243a76825e2dd6ad59de (patch)
tree9406e5291db3fd1e4fe8e3e1bf8a8c3de9b22404 /gold
parent31a91d61f9ea4504812349166ef6ad5308270927 (diff)
downloadgdb-c6905c28a51b6716f2d0243a76825e2dd6ad59de.zip
gdb-c6905c28a51b6716f2d0243a76825e2dd6ad59de.tar.gz
gdb-c6905c28a51b6716f2d0243a76825e2dd6ad59de.tar.bz2
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.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog11
-rw-r--r--gold/object.cc29
-rw-r--r--gold/object.h16
-rw-r--r--gold/powerpc.cc2
4 files changed, 56 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index b4b4687..1bbeda4 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -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
diff --git a/gold/object.cc b/gold/object.cc
index 1f113d1..c98b3c5 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -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>
@@ -3217,21 +3234,33 @@ Object::find_shdr<64,true>(const unsigned char*, const char*, const char*,
#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
diff --git a/gold/object.h b/gold/object.h
index c17c13d..ae6d9bf 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -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
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 676aad6..1afe01c 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -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;