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

            Bug ID: 17057
           Summary: Production of DSOs using TLSDESC is utterly broken on
                    i386
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: bugdal at aerifal dot cx

Attempting to compile/link the following program:

__thread int my_tls = 1;
int *my_tls_addr() { return &my_tls; }

with the following gcc command line:

gcc -shared -mtls-dialect=gnu2 -fPIC -o foo.so foo.c

results in the following error message (details vary by version; I also tried
two different builds of 2.24, my own and Debian's):

/usr/bin/ld: BFD (GNU Binutils) 2.23.2 assertion fail elf32-i386.c:3922

The problem seems to be a miscomputation of the size of .got.plt needed for the
TLSDESC entries. Incidentally, if there are no PLT entries at all (this can be
achieved with the above program by -nostartfiles), the error goes away, but the
resulting DSO is unusable; it contains no DT_JMPREL in the DYNAMIC, so TLSDESC
relocations don't happen and naturally this results in a crash when the program
attempts to access the TLS.

Is this code completely untested? I can't seem to figure out how to produce any
usable/testable TLSDESC-using DSO.

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

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to