From 7160c10d6530b79ea45d435933b07765f610f54d Mon Sep 17 00:00:00 2001 From: James Clarke Date: Tue, 28 Jun 2016 12:00:56 +0100 Subject: 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. --- gold/sparc.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'gold/sparc.cc') 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::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(reloc.get_r_info()); @@ -2300,8 +2302,9 @@ Target_sparc::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::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); -- cgit v1.1