https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86832
Bug ID: 86832 Summary: GCC v8.2.0 tries to use native TLS with -fstack-protector-strong on Windows (mingw-w64) Product: gcc Version: lto Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: johannes.schindelin at gmx dot de Target Milestone: --- When I try to compile this program: -- snip -- static void a1(void *p) { } int main(int argc, char **argv) { int i; a1(&i); return 0; } -- snap -- using gcc -o a1.o -c -fstack-protector-strong a1.c gcc -fstack-protector-strong -o a1.exe a1.o the resulting a1.exe causes a segmentation fault in `main()`. The offending assembler instruction is this: 0x40156f <main+20>: mov %fs:0x0,%rax The good mingw-w64 people pointed out that this looks like native TLS, but mingw-w64 only supports emulated TLS. When compiling without -fstack-protector-strong, everything works. Output of `gcc -v`: Using built-in specs. COLLECT_GCC=C:\git-sdk-64-ci\mingw64\bin\gcc.exe COLLECT_LTO_WRAPPER=C:/git-sdk-64-ci/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-8.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=ada,c,lto,c++,objc,obj-c++,fortran --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld Thread model: posix gcc version 8.2.0 (Rev1, Built by MSYS2 project)