https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881
--- Comment #22 from Alexandre Pereira Nunes <alexandre.nunes at gmail dot com> --- (In reply to Julian Waters from comment #19) > > Alexandre, how's your progress on Windows TLS going? Could we collaborate to > get this into gcc somehow? Hi Julian, I used to manage a collection of cross-compiled libraries and tools, including gcc compiler. I managed to get it to work partially by using this patch as a origin: https://github.com/venix1/MinGW-GDC/blob/master/patches/mingw-tls-gcc-4.8.patch (Perhaps it wasn't exactly this one, but very similar) It compiled and linked fine with the whole collection of libraries I used to manage (here: https://build.opensuse.org/project/show/home:polesapart:win64) >From some version on, binutils started to complain about bad relocations in x86_64 code, I suspect it's correct about this but previous versions didn't catch it. So I suspect the code generation for x86_64 needs fix, or otherwise binutils needs a patch to differentiate apart from invalid cases. Anyway, I'm no longer working on this for quite some time. I'll attach the last non-published version of the patch I was applying to gcc. I can provide some help but it was been quite a while so memory is not all bright right now. When I posted I was trying to write this from scratch (and having a bad time understanding gcc internals), I even registered as a gcc contributor for this. But since I found the patch and it seemed to work for my collection (which I used professionally for 32-bit code at the time), I got lazy. AFAIK, for that work to be merged to gcc mainstream, you'd have to track the patch's owner and get it to transfer rights to you or convince him to become a gcc contributor, if not already. Or rewrite the logic from scratch.