[clang] [Cygwin] Cygwin basic support (PR #76943)

εΎζŒζ’ Xu Chiheng via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 04:41:29 PST 2024


https://github.com/xu-chiheng created https://github.com/llvm/llvm-project/pull/76943

Enable TLS, and set VaListKind to CharPtrBuiltinVaList.
This fix bootstrap failure on Cygwin.

>From 35cb22083fc0f842e873c99518a58d673bbcb1ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 <chiheng.xu at gmail.com>
Date: Sat, 9 Dec 2023 00:59:00 +0800
Subject: [PATCH 1/3] [Cygwin] Cygwin basic support

---
 clang/lib/Basic/Targets/X86.h         | 5 ++++-
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 0ab1c10833db26..e77e1e690cfc0c 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -905,7 +905,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,
@@ -919,6 +918,10 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo {
     if (Opts.CPlusPlus)
       Builder.defineMacro("_GNU_SOURCE");
   }
+
+  BuiltinVaListKind getBuiltinVaListKind() const override {
+    return TargetInfo::CharPtrBuiltinVaList;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index acfa119805068d..38b9b84cf37c5b 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,7 +6729,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
           options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-          !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+          !RawTriple.isOSAIX()
+          && !RawTriple.isWindowsGNUEnvironment()
+          && !RawTriple.isWindowsMSVCEnvironment() &&
               ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
                RawTriple.hasEnvironment())) ||
       KernelOrKext)

>From 99199c9364be0d8cd83a65ea5425715a82e2a40f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 <chiheng.xu at gmail.com>
Date: Sat, 9 Dec 2023 01:08:20 +0800
Subject: [PATCH 2/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 38b9b84cf37c5b..58b042266c6091 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,9 +6729,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
           options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-          !RawTriple.isOSAIX()
-          && !RawTriple.isWindowsGNUEnvironment()
-          && !RawTriple.isWindowsMSVCEnvironment() &&
+          !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+              !RawTriple.isWindowsMSVCEnvironment() &&
               ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
                RawTriple.hasEnvironment())) ||
       KernelOrKext)

>From 856ecf178a2487f7449bd291f6ce78b13f07fd24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 <chiheng.xu at gmail.com>
Date: Sat, 9 Dec 2023 12:37:05 +0800
Subject: [PATCH 3/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 58b042266c6091..acfa119805068d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,8 +6729,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
           options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-          !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-              !RawTriple.isWindowsMSVCEnvironment() &&
+          !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
               ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
                RawTriple.hasEnvironment())) ||
       KernelOrKext)



More information about the cfe-commits mailing list