Bug 14940 - s390 -pie issues with TLS relocations
Summary: s390 -pie issues with TLS relocations
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 6443
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-10 13:08 UTC by Jakub Jelinek
Modified: 2015-06-29 07:46 UTC (History)
5 users (show)

See Also:
Host:
Target: s390*-*-*
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2012-12-10 13:08:13 UTC
+++ This bug was initially created as a clone of Bug #6443 +++

__thread int a;
__thread int b __attribute((tls_model ("local-exec")));
__thread int c __attribute((tls_model ("initial-exec")));
__thread int d __attribute((tls_model ("local-dynamic")));
__thread int e __attribute((tls_model ("global-dynamic")));

int
main (void)
{
  return a + b + c + d + e;
}

compiled/linked with -O2 -pie -fpie on various arches either doesn't link at all,
or makes completely unnecessarily a DT_TEXTREL PIE.  Tried x86_64, i386, ppc,
ppc64.  For the TLS transitions and relocations, PIEs should be handled like
other executables, so many info->shared checks need to be replaced with
!info->executable.  For the TLS relocations, even when the executable is
position independent, the offsets within the PIE's TLS block are known at link
time and so relocations like R_X86_64_TPOFF32 can be relocated fully at link
time.

While this is now fixed on i?86/x86_64 and perhaps ppc/ppc64, it isn't fixed on s390/s390x.  See https://bugzilla.redhat.com/show_bug.cgi?id=872148
Comment 1 Andreas Krebbel 2015-06-29 07:46:59 UTC
(In reply to Jakub Jelinek from comment #0)
> While this is now fixed on i?86/x86_64 and perhaps ppc/ppc64, it isn't fixed
> on s390/s390x.  See https://bugzilla.redhat.com/show_bug.cgi?id=872148

Should be fixed with:
https://sourceware.org/ml/binutils/2014-09/msg00067.html