[clang] [Cygwin] Enable TLS on Cygwin target (PR #138618)
https://github.com/kikairoya created https://github.com/llvm/llvm-project/pull/138618 Cygwin environment and toolchain supports EMUTLS. >From >https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=config/tls.m4;hb=HEAD#l118, ``` $ LANG=C gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/15/lto-wrapper.exe Target: x86_64-pc-cygwin Configured with: (snip) Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.0.1 20250406 (experimental) (GCC) $ echo '__thread int a; int b; int main() { return a = b; }' | gcc -S -xc -o- - | grep __emutls_get_address call__emutls_get_address .def__emutls_get_address; .scl2; .type 32; .endef ``` >From de268f7f1d19de21ece1ab4c6b53c008bc33 Mon Sep 17 00:00:00 2001 From: kikairoya Date: Sat, 19 Apr 2025 07:00:39 +0900 Subject: [PATCH] [Cygwin] TLS for Cygwin target should be available Cygwin environment and toolchain supports EMUTLS. >From >https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=config/tls.m4;hb=HEAD#l118, $ LANG=C gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/15/lto-wrapper.exe Target: x86_64-pc-cygwin Configured with: (snip) Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.0.1 20250406 (experimental) (GCC) $ echo '__thread int a; int b; int main() { return a = b; }' | \ gcc -S -xc -o- - | \ grep __emutls_get_address call__emutls_get_address .def__emutls_get_address; .scl2; .type 32; .endef --- clang/lib/Basic/Targets/X86.h | 1 - clang/test/Driver/emulated-tls.cpp | 6 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 194f3faef1be3..2f6fb33a7b597 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -965,7 +965,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo { CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : X86_64TargetInfo(Triple, Opts) { this->WCharType = TargetInfo::UnsignedShort; -TLSSupported = false; } void getTargetDefines(const LangOptions &Opts, diff --git a/clang/test/Driver/emulated-tls.cpp b/clang/test/Driver/emulated-tls.cpp index 3ee901a835858..431105bdfdf45 100644 --- a/clang/test/Driver/emulated-tls.cpp +++ b/clang/test/Driver/emulated-tls.cpp @@ -8,6 +8,8 @@ // RUN: | FileCheck -check-prefix=NOEMU %s // RUN: %clang -### --target=i686-pc-cygwin %s 2>&1 \ // RUN: | FileCheck -check-prefix=EMU %s +// RUN: %clang -### --target=x86_64-pc-cygwin %s 2>&1 \ +// RUN: | FileCheck -check-prefix=EMU %s // RUN: %clang -### --target=i686-pc-openbsd %s 2>&1 \ // RUN: | FileCheck -check-prefix=EMU %s @@ -17,6 +19,8 @@ // RUN: | FileCheck -check-prefix=EMU %s // RUN: %clang -### -target i686-pc-cygwin %s -fno-emulated-tls -femulated-tls 2>&1 \ // RUN: | FileCheck -check-prefix=EMU %s +// RUN: %clang -### -target x86_64-pc-cygwin %s -fno-emulated-tls -femulated-tls 2>&1 \ +// RUN: | FileCheck -check-prefix=EMU %s // RUN: %clang -### -target i686-pc-openbsd %s -fno-emulated-tls -femulated-tls 2>&1 \ // RUN: | FileCheck -check-prefix=EMU %s @@ -26,6 +30,8 @@ // RUN: | FileCheck -check-prefix=NOEMU %s // RUN: %clang -### -target i686-pc-cygwin %s -femulated-tls -fno-emulated-tls 2>&1 \ // RUN: | FileCheck -check-prefix=NOEMU %s +// RUN: %clang -### -target x86_64-pc-cygwin %s -femulated-tls -fno-emulated-tls 2>&1 \ +// RUN: | FileCheck -check-prefix=NOEMU %s // RUN: %clang -### -target i686-pc-openbsd %s -femulated-tls -fno-emulated-tls 2>&1 \ // RUN: | FileCheck -check-prefix=NOEMU %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Export global symbols, template instantiations, RTTI and VTable are exported correctly (PR #138773)
https://github.com/kikairoya created https://github.com/llvm/llvm-project/pull/138773 MinGW-GCC and MinGW-Clang exports these symbols. Cygwin-GCC also exports them, so Cygwin-Clang should do so. Some of tests have new DAG pattern because i686-cygwin don't use __thiscall but __cdecl for member functions. This is a prerequisite for resolve https://github.com/llvm/llvm-project/issues/135910 . Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Export global symbols, template instantiations, RTTI and VTable are exported correctly (PR #138773)
https://github.com/kikairoya edited https://github.com/llvm/llvm-project/pull/138773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits