]> git.ipfire.org Git - thirdparty/gcc.git/commit
MinGW: Fix native TLS bug with -fdata-sections
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 8 Dec 2025 16:47:56 +0000 (17:47 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 8 Dec 2025 16:50:45 +0000 (17:50 +0100)
commit3777a0b41f9fdcbb5fde4bdfce06031805cebc33
tree856e6337b8b7089e521a9323c61d870de02cfc1f
parent76fc22a292ad652338be21b7ff4a767ddb3d7015
MinGW: Fix native TLS bug with -fdata-sections

The problem comes from a quirk of the GNU PE-COFF linker, which wants
to make sure that .tls$ZZZ is laid out last among the TLS sections,
but first globs all .tls$* sections together.  The solution matches
Clang's output.

gcc/
PR target/80881
* config/mingw/winnt.cc (mingw_pe_unique_section): Put two dollar
signs for TLS sections after the prefix.
(mingw_pe_asm_named_section): Deal with all TLS sections uniformly.

gcc/testsuite/
* gcc.dg/tls/data-sections-1.c: New test.
gcc/config/mingw/winnt.cc
gcc/testsuite/gcc.dg/tls/data-sections-1.c [new file with mode: 0644]