]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR ld/22972 on SPARC.
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 28 Mar 2018 10:17:15 +0000 (12:17 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 28 Mar 2018 10:31:27 +0000 (12:31 +0200)
commit99181ccac0fc7d82e7dabb05dc7466e91f1645d3
treec75e52cc92f5bc1c35a5832ef9db5fe020c1d137
parentf14da2782fd25511855048944aecee16864e73ea
PR ld/22972 on SPARC.

This is a regression for the corner case of a hidden symbol in a PIC/PIE
binary which is subject to both a new-style GOTDATA relocation and an
old-style GOT relocation.  In this case, depending  on the link order,
the R_SPARC_RELATIVE dynamic relocation for the GOT slot needed because
of the old-style relocation can be replaced with R_SPARC_NONE coming
from the GOTDATA relocation.

The fix simply records whether an old-style GOT relocation is seen for a
symbol and prevents the R_SPARC_NONE from being generated in this case.

bfd/
* elfxx-sparc.c (struct _bfd_sparc_elf_link_hash_entry): Add new flag
has_old_style_got_reloc.
(_bfd_sparc_elf_check_relocs) <GOT relocations>: Set it for old-style
relocations.  Fix a couple of long lines.
(_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: Do not generate
a R_SPARC_NONE for the GOT slot if the symbol is also subject to
old-style GOT relocations.
ld/
* testsuite/ld-sparc/sparc.exp: Add test for mixed GOTDATA/GOT relocs.
* testsuite/ld-sparc/gotop-hidden.c: New file.
* testsuite/ld-sparc/got-hidden32.s: Likewise.
* testsuite/ld-sparc/got-hidden64.s: Likewise.
* testsuite/ld-sparc/pass.out: Likewise.
bfd/ChangeLog
bfd/elfxx-sparc.c
ld/ChangeLog
ld/testsuite/ld-sparc/got-hidden32.s [new file with mode: 0644]
ld/testsuite/ld-sparc/got-hidden64.s [new file with mode: 0644]
ld/testsuite/ld-sparc/gotop-hidden.c [new file with mode: 0644]
ld/testsuite/ld-sparc/pass.out [new file with mode: 0644]
ld/testsuite/ld-sparc/sparc.exp