[SPARC] Fix PR ld/22727

H.J. Lu hjl.tools@gmail.com
Sun Jan 21 16:03:00 GMT 2018

On Sun, Jan 21, 2018 at 1:39 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> 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.

GD access should be optimized to IE or LE access in PIE. Dynamic relocation
shouldn't be needed.  Can you try to revert my PR ld/22263 change one at a
time to see which single change cause the regression?  Maybe

diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 4bf91fb30a..a52734cb31 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -1511,7 +1511,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct
bfd_link_info *info,

   case R_SPARC_TLS_IE_HI22:
   case R_SPARC_TLS_IE_LO10:
-    if (!bfd_link_executable (info))
+    if (bfd_link_pic (info))
       info->flags |= DF_STATIC_TLS;
     /* Fall through */

is sufficient.


More information about the Binutils mailing list