bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/20179] New: ld -pie -z text errors out for SPARC TLS objects: re


From: ro at gcc dot gnu.org
Subject: [Bug ld/20179] New: ld -pie -z text errors out for SPARC TLS objects: read-only segment has dynamic relocations
Date: Mon, 30 May 2016 14:27:44 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20179

            Bug ID: 20179
           Summary: ld -pie -z text errors out for SPARC TLS objects:
                    read-only segment has dynamic relocations
           Product: binutils
           Version: 2.26
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: ro at gcc dot gnu.org
  Target Milestone: ---
              Host: sparc*-sun-solaris2.*
            Target: sparc*-sun-solaris2.*
             Build: sparc*-sun-solaris2.*

Created attachment 9296
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9296&action=edit
input object

When running the gcc testsuite on Solaris 12 with gas and gld, the PIE tests
FAIL with a gld error:

FAIL: gcc.dg/torture/tls/run-le.c   -O0  -pie -fpie  (test for excess errors)
Excess errors:
/vol/gcc/bin/gld-2.26: read-only segment has dynamic relocations.

The failure can be reproduced with

$ gld-2.26 -pie -z text -o run-le.exe run-le.o -lc
gld-2.26: warning: cannot find entry symbol _start; defaulting to
0000000000000330
gld-2.26: read-only segment has dynamic relocations.

Linking the exact same object with /bin/ld works just fine:

$ ld -z type=pie -z text -o run-le.exe run-le.o -lc

Checking which symbols triggers setting DT_TEXTREL, I find that tls_le is the
culprit:

$ elfdump -s run-le.o|grep tls_le
    [7]      0  0x4  TLS  GLOB  D    0 .tdata   tls_le
$ elfdump -r run-le.o 

Relocation Section:  .rela.text
  index  type                  offset value addend  section symbol
    [0]  R_SPARC_TLS_LE_HIX22     0x4     0      0  .text   tls_le
    [1]  R_SPARC_TLS_LE_LOX10     0x8     0      0  .text   tls_le
    [2]  R_SPARC_TLS_LE_HIX22    0x20     0      0  .text   tls_le
    [3]  R_SPARC_TLS_LE_LOX10    0x24     0      0  .text   tls_le

However, the situation on Solaris/x86 is similar

$ elfdump -s run-le.o|grep tls_le
   [11]      0  0x4  TLS  GLOB  D    0 .tdata                     tls_le
$ elfdump -r run-le.o |grep tls_le
    [2]  R_386_TLS_LE    0x15          0  .text   tls_le
    [5]  R_386_TLS_LE    0x31          0  .text   tls_le

and yet the warning doesn't trigger.

  Rainer

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]