PATCH: fix crash when --gc-section discard the TLS segment

Tristan Gingold gingold@adacore.com
Fri Nov 16 10:53:00 GMT 2007


Hi,

this following tiny program crashes ld (at least on x86 linux):

$ more t.c
__thread char * tls_var;

int main (void)
{
   return 0;
}

gcc -c t.c -fdata-section
gcc -o t t.o -Wl,--gc-sections

(use of -fdata-section is not required).

Here is a patch.

bfd:
2007-11-16  Tristan Gingold  <gingold@adacore.com>

         * elflink.c (elf_link_output_extsym): Weaken assertion: if -- 
gc-section
         is set, there may be no TLS segment.

ld/testsuite:
2007-11-16  Tristan Gingold  <gingold@adacore.com>

         * ld-elf/tls_gc.s: New test.
         * ld-elf/elf.exp: Add tls_gc test.

(The set of platforms that should run the test should be updated).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tls.diff
Type: application/octet-stream
Size: 2090 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20071116/e6c89f72/attachment.obj>


More information about the Binutils mailing list