[SPARC] Fix PR ld/22727
Eric Botcazou
ebotcazou@adacore.com
Sun Jan 21 09:42:00 GMT 2018
Hi,
this is the breakage of TLS in PIC/PIE mode on SPARC present on the mainline
and 2.30 branch. There are actually 2 different bugs:
1. TLS transition is broken in PIE mode because of the PR ld/22263 change.
2. TLS is broken in PIC/PIE mode when the __tls_get_addr symbol is versioned
(as is the case on Linux and Solaris at least) similarly to PR ld/22721.
The first bug is fixed by reverting the problematic change for now (note that
the associated test doesn't pass on SPARC because of another issue so there is
no formal regression in the testsuite). Then I'll investigate what needs to
be done to fix PR ld/22263 on SPARC. The second bug is fixed by changing the
call to _bfd_generic_link_add_one_symbol on __tls_get_addr into a mere lookup
in _bfd_sparc_elf_check_relocs.
Since __tls_get_addr is versioned on both Linux and Solaris, I changed the TLS
helper shared library of the SPARC ld testsuite to use a versioned symbol and
adjusted an existing test about TLS transition, in addition to adding a new
test for the PIE case.
Tested on SPARC64/Linux with a GCC 7.3RC1 bootstrap, OK for mainline & branch?
2018-01-21 Eric Botcazou <ebotcazou@adacore.com>
bfd/
PR ld/22727
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs) <R_SPARC_TLS_GD_CALL>: Do a
mere lookup of the __tls_get_addr symbol instead of adding it.
Revert
2017-10-19 H.J. Lu <hongjiu.lu@intel.com>
PR ld/22263
* elfxx-sparc.c (sparc_elf_tls_transition): Replace
bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
bfd_link_executable for TLS check.
(_bfd_sparc_elf_check_relocs): Likewise.
(allocate_dynrelocs): Likewise.
(_bfd_sparc_elf_relocate_section): Likewise.
2018-01-21 Eric Botcazou <ebotcazou@adacore.com>
ld/
* testsuite/ld-sparc/sparc.exp (32-bit: Helper shared library):
Link with a version script.
(32-bit: TLS -fpie): New test.
(64-bit: Helper shared library): Link with a version script.
(64-bit: TLS -fpie): New test.
(64-bit: GOTDATA relocations): Pass -Av9 to the assembler.
* testsuite/ld-sparc/tlslib.ver: New file.
* testsuite/ld-sparc/tlspie32.dd: Likewise.
* testsuite/ld-sparc/tlspie32.s: Likewise.
* testsuite/ld-sparc/tlspie64.dd: Likewise.
* testsuite/ld-sparc/tlspie64.s: Likewise.
* testsuite/ld-sparc/tlssunbin32.dd: Adjust for versioned symbol.
* testsuite/ld-sparc/tlssunbin32.rd: Likewise.
* testsuite/ld-sparc/tlssunbin32.sd: Likewise.
* testsuite/ld-sparc/tlssunbin64.dd: Likewise.
* testsuite/ld-sparc/tlssunbin64.rd: Likewise.
* testsuite/ld-sparc/tlssunbin64.sd: Likewise.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr22727.diff
Type: text/x-patch
Size: 22724 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20180121/08a232ac/attachment.bin>
More information about the Binutils
mailing list