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.
This commit is contained in:
James Clarke
2016-06-28 12:00:56 +01:00
committed by Nick Clifton
parent 6c9a7fb62f
commit 7160c10d65
6 changed files with 26 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2016-06-28 James Clarke <jrtc27@jrtc27.com>
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Don't convert
R_SPARC_32 to R_SPARC_RELATIVE if class is ELFCLASS64.
2016-06-28 Maciej W. Rozycki <macro@imgtec.com> 2016-06-28 Maciej W. Rozycki <macro@imgtec.com>
* elf32-mips.c (elf_mips16_howto_table_rel): Add * elf32-mips.c (elf_mips16_howto_table_rel): Add

View File

@ -3481,7 +3481,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
} }
else else
{ {
if (r_type == R_SPARC_32 || r_type == R_SPARC_64) if ( (!ABI_64_P (output_bfd) && r_type == R_SPARC_32)
|| (ABI_64_P (output_bfd) && r_type == R_SPARC_64))
{ {
outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, outrel.r_info = SPARC_ELF_R_INFO (htab, NULL,
0, R_SPARC_RELATIVE); 0, R_SPARC_RELATIVE);

View File

@ -1,3 +1,9 @@
2016-06-28 James Clarke <jrtc27@jrtc27.com>
* 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.
2016-06-23 Cary Coutant <ccoutant@gmail.com> 2016-06-23 Cary Coutant <ccoutant@gmail.com>
Igor Kudrin <ikudrin@accesssoftek.com> Igor Kudrin <ikudrin@accesssoftek.com>

View File

@ -2292,7 +2292,9 @@ Target_sparc<size, big_endian>::Scan::local(
// apply the link-time value, so we flag the location with // apply the link-time value, so we flag the location with
// an R_SPARC_RELATIVE relocation so the dynamic loader can // an R_SPARC_RELATIVE relocation so the dynamic loader can
// relocate it easily. // 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); Reloc_section* rela_dyn = target->rela_dyn_section(layout);
unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info()); 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, output_section, data_shndx,
reloc.get_r_offset(), reloc.get_r_offset(),
reloc.get_r_addend(), is_ifunc); reloc.get_r_addend(), is_ifunc);
}
break; break;
}
/* Fall through. */
case elfcpp::R_SPARC_HIX22: case elfcpp::R_SPARC_HIX22:
case elfcpp::R_SPARC_LOX10: case elfcpp::R_SPARC_LOX10:
@ -2766,8 +2769,8 @@ Target_sparc<size, big_endian>::Scan::global(
reloc.get_r_offset(), reloc.get_r_offset(),
reloc.get_r_addend()); reloc.get_r_addend());
} }
else if ((r_type == elfcpp::R_SPARC_32 else if (((size == 64 && r_type == elfcpp::R_SPARC_64)
|| r_type == elfcpp::R_SPARC_64) || (size == 32 && r_type == elfcpp::R_SPARC_32))
&& gsym->can_use_relative_reloc(false)) && gsym->can_use_relative_reloc(false))
{ {
Reloc_section* rela_dyn = target->rela_dyn_section(layout); Reloc_section* rela_dyn = target->rela_dyn_section(layout);

View File

@ -1,3 +1,8 @@
2016-06-28 James Clarke <jrtc27@jrtc27.com>
* testsuite/ld-elf/symbolic-func.r: Allow non-zero offsets from
.text.
2016-06-28 Maciej W. Rozycki <macro@imgtec.com> 2016-06-28 Maciej W. Rozycki <macro@imgtec.com>
* testsuite/ld-mips-elf/attr-gnu-4-10.d: Match any UNIX OS/ABI. * testsuite/ld-mips-elf/attr-gnu-4-10.d: Match any UNIX OS/ABI.

View File

@ -14,5 +14,5 @@
Relocation section.* Relocation section.*
*Offset.* *Offset.*
0*[1-9a-f][0-9a-f]* +[^ ]+ +[^ ]+ +([0-9a-f]+( +\.text( \+ 0)?)?)? 0*[1-9a-f][0-9a-f]* +[^ ]+ +[^ ]+ +([0-9a-f]+( +\.text( \+ [0-9a-f]+)?)?)?
#pass #pass