aboutsummaryrefslogtreecommitdiff
path: root/gold/sparc.cc
diff options
context:
space:
mode:
authorJames Clarke <jrtc27@jrtc27.com>2016-06-28 12:00:56 +0100
committerNick Clifton <nickc@redhat.com>2016-06-28 12:00:56 +0100
commit7160c10d6530b79ea45d435933b07765f610f54d (patch)
tree16edffe83c4a976ac178ae15d6f7a0306c89c603 /gold/sparc.cc
parent6c9a7fb62fcddbcafba8ab765e6fe190482c3d0a (diff)
downloadbinutils-7160c10d6530b79ea45d435933b07765f610f54d.zip
binutils-7160c10d6530b79ea45d435933b07765f610f54d.tar.gz
binutils-7160c10d6530b79ea45d435933b07765f610f54d.tar.bz2
Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64.
bfd * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64. gold * sparc.cc (Target_sparc::Scan::local): Don't convert R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64. (Target_sparc::Scan::global): Likewise. ld * testsuite/ld-elf/symbolic-func.r: Allow non-zero offsets from .text.
Diffstat (limited to 'gold/sparc.cc')
-rw-r--r--gold/sparc.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/gold/sparc.cc b/gold/sparc.cc
index 10a5031..dc4612d 100644
--- a/gold/sparc.cc
+++ b/gold/sparc.cc
@@ -2292,7 +2292,9 @@ Target_sparc<size, big_endian>::Scan::local(
// apply the link-time value, so we flag the location with
// an R_SPARC_RELATIVE relocation so the dynamic loader can
// relocate it easily.
- if (parameters->options().output_is_position_independent())
+ if (parameters->options().output_is_position_independent()
+ && ((size == 64 && r_type == elfcpp::R_SPARC_64)
+ || (size == 32 && r_type == elfcpp::R_SPARC_32)))
{
Reloc_section* rela_dyn = target->rela_dyn_section(layout);
unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
@@ -2300,8 +2302,9 @@ Target_sparc<size, big_endian>::Scan::local(
output_section, data_shndx,
reloc.get_r_offset(),
reloc.get_r_addend(), is_ifunc);
+ break;
}
- break;
+ /* Fall through. */
case elfcpp::R_SPARC_HIX22:
case elfcpp::R_SPARC_LOX10:
@@ -2766,8 +2769,8 @@ Target_sparc<size, big_endian>::Scan::global(
reloc.get_r_offset(),
reloc.get_r_addend());
}
- else if ((r_type == elfcpp::R_SPARC_32
- || r_type == elfcpp::R_SPARC_64)
+ else if (((size == 64 && r_type == elfcpp::R_SPARC_64)
+ || (size == 32 && r_type == elfcpp::R_SPARC_32))
&& gsym->can_use_relative_reloc(false))
{
Reloc_section* rela_dyn = target->rela_dyn_section(layout);