llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.92k stars 11.52k forks source link

clang has ABI unmatching with GCC for __thread on triple-windows-gnu targets #56135

Open trcrsired opened 2 years ago

trcrsired commented 2 years ago

See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106042

This breaks the canadian compilation for clang from clang on linux or native compilation on windows itself with clang from clang since They generate different code for __call_once which cannot correctly link to GNU libstdc++ on windows.

alvinhochun commented 2 years ago

This sounds like the difference between native TLS that Clang emits by default and emulated TLS emitted by GCC. I think Clang has supported native TLS with mingw for quite some time while GCC does not yet implement it. You can tell Clang to use emulated TLS with -femulated-tls which should emit code that is compatible with GCC's mingw target.

llvmbot commented 11 months ago

@llvm/issue-subscribers-clang-codegen

See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106042 This breaks the canadian compilation for clang from clang on linux or native compilation on windows itself with clang from clang since They generate different code for __call_once which cannot correctly link to GNU libstdc++ on windows.
trcrsired commented 10 months ago

i think -femulated-tls should be default for mingw gnu target and -fno-emulated-tls for msvc target or it will break build system.

On Fri, Sep 29, 2023 at 1:48 PM llvmbot @.***> wrote:

@llvm/issue-subscribers-clang-codegen https://github.com/orgs/llvm/teams/issue-subscribers-clang-codegen See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106042

This breaks the canadian compilation for clang from clang on linux or native compilation on windows itself with clang from clang since They generate different code for __call_once which cannot correctly link to GNU libstdc++ on windows.

— Reply to this email directly, view it on GitHub https://github.com/llvm/llvm-project/issues/56135#issuecomment-1741277927, or unsubscribe https://github.com/notifications/unsubscribe-auth/AX3IVHMY5HX2UEGIQGOXUWLX44CYFANCNFSM5ZLFZAMQ . You are receiving this because you authored the thread.Message ID: @.***>

trcrsired commented 8 months ago

i am not using that mingw clang project but a normal GCC cross compiler.