diff --git a/llvm/0008-LLVM-Coverage-Unittest-Fix-dangling-reference-in-uni.patch b/llvm/0008-LLVM-Coverage-Unittest-Fix-dangling-reference-in-uni.patch new file mode 100644 index 00000000..8e47191c --- /dev/null +++ b/llvm/0008-LLVM-Coverage-Unittest-Fix-dangling-reference-in-uni.patch @@ -0,0 +1,73 @@ +From 03731bf1dc4a9ab97a03bf4a5d6e33487ccb6845 Mon Sep 17 00:00:00 2001 +From: Tomohiro Kashiwada +Date: Fri, 12 Sep 2025 05:12:54 +0900 +Subject: [PATCH] [LLVM][Coverage][Unittest] Fix dangling reference in unittest + (#147118) + +In loop of `writeAndReadCoverageRegions`, `OutputFunctions[I].Filenames` +references to contents of `Filenames` after returning from +`readCoverageRegions` but `Filenames` will be cleared in next call of +`readCoverageRegions`, causes dangling reference. +The lifetime of the contents of `Filenames` must be equal or longer than +`OutputFunctions[I]`, thus it has been moved into `OutputFunctions[I]` +(typed `OutputFunctionCoverageData`). + +(cherry picked from commit ca09801bd03579f28edac60077a164fab0474eb4) +--- + .../ProfileData/CoverageMappingTest.cpp | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp +index ec81e5f274..b268aa7cdd 100644 +--- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp ++++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp +@@ -64,6 +64,7 @@ namespace { + struct OutputFunctionCoverageData { + StringRef Name; + uint64_t Hash; ++ std::vector FilenamesStorage; + std::vector Filenames; + std::vector Regions; + std::vector Expressions; +@@ -71,8 +72,10 @@ struct OutputFunctionCoverageData { + OutputFunctionCoverageData() : Hash(0) {} + + OutputFunctionCoverageData(OutputFunctionCoverageData &&OFCD) +- : Name(OFCD.Name), Hash(OFCD.Hash), Filenames(std::move(OFCD.Filenames)), +- Regions(std::move(OFCD.Regions)) {} ++ : Name(OFCD.Name), Hash(OFCD.Hash), ++ FilenamesStorage(std::move(OFCD.FilenamesStorage)), ++ Filenames(std::move(OFCD.Filenames)), Regions(std::move(OFCD.Regions)) { ++ } + + OutputFunctionCoverageData(const OutputFunctionCoverageData &) = delete; + OutputFunctionCoverageData & +@@ -135,7 +138,6 @@ struct InputFunctionCoverageData { + struct CoverageMappingTest : ::testing::TestWithParam> { + bool UseMultipleReaders; + StringMap Files; +- std::vector Filenames; + std::vector InputFunctions; + std::vector OutputFunctions; + +@@ -233,13 +235,11 @@ struct CoverageMappingTest : ::testing::TestWithParam> { + + void readCoverageRegions(const std::string &Coverage, + OutputFunctionCoverageData &Data) { +- // We will re-use the StringRef in duplicate tests, clear it to avoid +- // clobber previous ones. +- Filenames.clear(); +- Filenames.resize(Files.size() + 1); ++ // +1 here since `Files` (filename to index map) uses 1-based index. ++ Data.FilenamesStorage.resize(Files.size() + 1); + for (const auto &E : Files) +- Filenames[E.getValue()] = E.getKey().str(); +- ArrayRef FilenameRefs = llvm::ArrayRef(Filenames); ++ Data.FilenamesStorage[E.getValue()] = E.getKey().str(); ++ ArrayRef FilenameRefs = llvm::ArrayRef(Data.FilenamesStorage); + RawCoverageMappingReader Reader(Coverage, FilenameRefs, Data.Filenames, + Data.Expressions, Data.Regions); + EXPECT_THAT_ERROR(Reader.read(), Succeeded()); +-- +2.51.0.windows.1 + diff --git a/llvm/0104-Clang-Cygwin-call-linker-directly.patch b/llvm/0104-Clang-Cygwin-call-linker-directly.patch index bf3736a2..9cd51ffa 100644 --- a/llvm/0104-Clang-Cygwin-call-linker-directly.patch +++ b/llvm/0104-Clang-Cygwin-call-linker-directly.patch @@ -63,7 +63,7 @@ index d9c16347daa3..67dc792cb915 100644 Generic_GCC::AddMultiarchPaths(D, SysRoot, "lib", Paths); -@@ -107,3 +110,293 @@ void Cygwin::AddClangSystemIncludeArgs(const ArgList &DriverArgs, +@@ -107,3 +110,300 @@ void Cygwin::AddClangSystemIncludeArgs(const ArgList &DriverArgs, addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include/w32api"); } @@ -164,6 +164,13 @@ index d9c16347daa3..67dc792cb915 100644 + CmdArgs.push_back("-Bdynamic"); + + CmdArgs.push_back("--dll-search-prefix=cyg"); ++ if (Args.hasArg(options::OPT_rdynamic)) ++ CmdArgs.push_back("--export-all-symbols"); ++ if (!Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_mdll)) { ++ if (ToolChain.getTriple().isArch32Bit()) ++ CmdArgs.push_back("--large-address-aware"); ++ CmdArgs.push_back("--tsaware"); ++ } + + CmdArgs.push_back("-o"); + const char *OutputFile = Output.getFilename(); @@ -240,7 +247,7 @@ index d9c16347daa3..67dc792cb915 100644 + StringRef(Arg) == "--disable-nxcompat") + saw_nxcompat = true; + } -+ if (!saw_high_entropy_va) ++ if (!saw_high_entropy_va && ToolChain.getTriple().isArch64Bit()) + CmdArgs.push_back("--disable-high-entropy-va"); + if (!saw_nxcompat) + CmdArgs.push_back("--disable-nxcompat"); diff --git a/llvm/0106-Clang-Cygwin-Use-correct-mangling-rule-158404.patch b/llvm/0106-Clang-Cygwin-Use-correct-mangling-rule-158404.patch new file mode 100644 index 00000000..d5198e4c --- /dev/null +++ b/llvm/0106-Clang-Cygwin-Use-correct-mangling-rule-158404.patch @@ -0,0 +1,75 @@ +From 9aa120518b3fa4288b590f697013a98bce615545 Mon Sep 17 00:00:00 2001 +From: Tomohiro Kashiwada +Date: Sun, 14 Sep 2025 06:40:12 +0900 +Subject: [PATCH] [Clang][Cygwin] Use correct mangling rule (#158404) + +In +https://github.com/llvm/llvm-project/commit/45ca613c135ea7b5fbc63bff003f20bf20f62081, +whether to mangle names based on calling conventions according to +Microsoft conventions was refactored to a bool in the TargetInfo. Cygwin +targets also require this mangling, but were missed, presumably due to +lack of test coverage of these targets. This commit enables the name +mangling for Cygwin, and also enables test coverage of this mangling on +Cygwin targets. + +(cherry picked from commit 4abcbb053f8adaf48dbfff677e8ccda1f6d52b33) +--- + clang/lib/Basic/Targets/X86.h | 2 ++ + clang/test/CodeGen/mangle-windows.c | 6 ++++-- + clang/test/CodeGenCXX/mangle-windows.cpp | 3 +++ + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h +index ebc59c92f4..a7be080695 100644 +--- a/clang/lib/Basic/Targets/X86.h ++++ b/clang/lib/Basic/Targets/X86.h +@@ -649,6 +649,7 @@ public: + : X86_32TargetInfo(Triple, Opts) { + this->WCharType = TargetInfo::UnsignedShort; + this->WIntType = TargetInfo::UnsignedInt; ++ this->UseMicrosoftManglingForC = true; + DoubleAlign = LongLongAlign = 64; + resetDataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-" + "i128:128-f80:32-n8:16:32-a:0:32-S32", +@@ -986,6 +987,7 @@ public: + : X86_64TargetInfo(Triple, Opts) { + this->WCharType = TargetInfo::UnsignedShort; + this->WIntType = TargetInfo::UnsignedInt; ++ this->UseMicrosoftManglingForC = true; + } + + void getTargetDefines(const LangOptions &Opts, +diff --git a/clang/test/CodeGen/mangle-windows.c b/clang/test/CodeGen/mangle-windows.c +index 046b1e8815..e1b06e72a9 100644 +--- a/clang/test/CodeGen/mangle-windows.c ++++ b/clang/test/CodeGen/mangle-windows.c +@@ -1,8 +1,10 @@ + // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s +-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | FileCheck %s ++// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | FileCheck %s ++// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-cygwin | FileCheck %s + // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-windows-msvc-elf | FileCheck %s --check-prefix=ELF32 + // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 | FileCheck %s --check-prefix=X64 +-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-mingw32 | FileCheck %s --check-prefix=X64 ++// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-mingw32 | FileCheck %s --check-prefix=X64 ++// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-cygwin | FileCheck %s --check-prefix=X64 + // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-windows-msvc-elf | FileCheck %s --check-prefix=ELF64 + + // CHECK: target datalayout = "e-m:x-{{.*}}" +diff --git a/clang/test/CodeGenCXX/mangle-windows.cpp b/clang/test/CodeGenCXX/mangle-windows.cpp +index 3d5a1e9a86..737abcf6e3 100644 +--- a/clang/test/CodeGenCXX/mangle-windows.cpp ++++ b/clang/test/CodeGenCXX/mangle-windows.cpp +@@ -4,6 +4,9 @@ + // RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | \ + // RUN: FileCheck --check-prefix=ITANIUM %s + ++// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-cygwin | \ ++// RUN: FileCheck --check-prefix=ITANIUM %s ++ + void __stdcall f1(void) {} + // WIN: define dso_local x86_stdcallcc void @"?f1@@YGXXZ" + // ITANIUM: define dso_local x86_stdcallcc void @"\01__Z2f1v@0" +-- +2.51.0.windows.1 + diff --git a/llvm/0107-Clang-Cygwin-Cygwin-x86_64-should-accept-__stdcall-1.patch b/llvm/0107-Clang-Cygwin-Cygwin-x86_64-should-accept-__stdcall-1.patch new file mode 100644 index 00000000..94e3eb21 --- /dev/null +++ b/llvm/0107-Clang-Cygwin-Cygwin-x86_64-should-accept-__stdcall-1.patch @@ -0,0 +1,193 @@ +From a0b06b965a7fd4473700ae3b60ef63dfcc7b5afa Mon Sep 17 00:00:00 2001 +From: Tomohiro Kashiwada +Date: Mon, 15 Sep 2025 02:09:46 +0900 +Subject: [PATCH] [Clang][Cygwin] Cygwin x86_64 should accept __stdcall + (#158385) + +Cygwin should support calling convention attributes `__cdecl`, +`__stdcall`, `__thiscall`, and `__fastcall`, even though they have no +effect in x86_64, as done in MinGW. + +Originally reported in +https://cygwin.com/pipermail/cygwin/2025-September/258782.html + +--------- + +Co-authored-by: Jeremy Drake +(cherry picked from commit b01cddee0e69bd283a0f1830f24fae326371f1de) +--- + clang/lib/Basic/Targets/X86.h | 23 ++++++++++++ + clang/test/CodeGen/X86/cygwin-varargs.c | 35 ------------------- + clang/test/CodeGen/calling-conv-ignored.c | 2 ++ + clang/test/CodeGen/debug-info-cc.c | 6 ++-- + clang/test/CodeGen/ms_abi.c | 2 ++ + clang/test/CodeGen/sysv_abi.c | 4 +++ + .../x64-windows-calling-convention-handling.c | 4 ++- + clang/test/Sema/MicrosoftCompatibility-x64.c | 4 ++- + 8 files changed, 41 insertions(+), 39 deletions(-) + delete mode 100644 clang/test/CodeGen/X86/cygwin-varargs.c + +diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h +index a7be080695..da1644f57e 100644 +--- a/clang/lib/Basic/Targets/X86.h ++++ b/clang/lib/Basic/Targets/X86.h +@@ -1002,6 +1002,29 @@ public: + Builder.defineMacro("_GNU_SOURCE"); + } + ++ CallingConvCheckResult checkCallingConvention(CallingConv CC) const override { ++ switch (CC) { ++ case CC_X86StdCall: ++ case CC_X86ThisCall: ++ case CC_X86FastCall: ++ return CCCR_Ignore; ++ case CC_C: ++ case CC_X86VectorCall: ++ case CC_IntelOclBicc: ++ case CC_PreserveMost: ++ case CC_PreserveAll: ++ case CC_PreserveNone: ++ case CC_X86_64SysV: ++ case CC_Swift: ++ case CC_SwiftAsync: ++ case CC_X86RegCall: ++ case CC_DeviceKernel: ++ return CCCR_OK; ++ default: ++ return CCCR_Warning; ++ } ++ } ++ + BuiltinVaListKind getBuiltinVaListKind() const override { + return TargetInfo::CharPtrBuiltinVaList; + } +diff --git a/clang/test/CodeGen/X86/cygwin-varargs.c b/clang/test/CodeGen/X86/cygwin-varargs.c +deleted file mode 100644 +index 4eea7d64bc..0000000000 +--- a/clang/test/CodeGen/X86/cygwin-varargs.c ++++ /dev/null +@@ -1,35 +0,0 @@ +-// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm < %s | FileCheck %s +-// RUN: %clang_cc1 -triple x86_64-pc-cygwin -emit-llvm < %s | FileCheck %s +- +-struct foo { +- int x; +- float y; +- char z; +-}; +-// CHECK: %[[STRUCT_FOO:.*]] = type { i32, float, i8 } +- +-void f(int a, ...) { +- // CHECK-LABEL: define dso_local void @f +- __builtin_va_list ap; +- __builtin_va_start(ap, a); +- // CHECK: %[[AP:.*]] = alloca ptr +- // CHECK: call void @llvm.va_start +- int b = __builtin_va_arg(ap, int); +- // CHECK: %[[AP_CUR:.*]] = load ptr, ptr %[[AP]] +- // CHECK-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, ptr %[[AP_CUR]], i64 8 +- // CHECK-NEXT: store ptr %[[AP_NEXT]], ptr %[[AP]] +- double _Complex c = __builtin_va_arg(ap, double _Complex); +- // CHECK: %[[AP_CUR2:.*]] = load ptr, ptr %[[AP]] +- // CHECK-NEXT: %[[AP_NEXT2:.*]] = getelementptr inbounds i8, ptr %[[AP_CUR2]], i64 8 +- // CHECK-NEXT: store ptr %[[AP_NEXT2]], ptr %[[AP]] +- // CHECK-NEXT: load ptr, ptr %[[AP_CUR2]] +- struct foo d = __builtin_va_arg(ap, struct foo); +- // CHECK: %[[AP_CUR3:.*]] = load ptr, ptr %[[AP]] +- // CHECK-NEXT: %[[AP_NEXT3:.*]] = getelementptr inbounds i8, ptr %[[AP_CUR3]], i64 8 +- // CHECK-NEXT: store ptr %[[AP_NEXT3]], ptr %[[AP]] +- __builtin_va_list ap2; +- __builtin_va_copy(ap2, ap); +- // CHECK: call void @llvm.va_copy +- __builtin_va_end(ap); +- // CHECK: call void @llvm.va_end +-} +diff --git a/clang/test/CodeGen/calling-conv-ignored.c b/clang/test/CodeGen/calling-conv-ignored.c +index 9c47f641ea..5dbc7e4084 100644 +--- a/clang/test/CodeGen/calling-conv-ignored.c ++++ b/clang/test/CodeGen/calling-conv-ignored.c +@@ -1,5 +1,7 @@ + // RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -o - %s | FileCheck %s --check-prefix=X86 + // RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -o - %s | FileCheck %s --check-prefix=X64 ++// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=X64 ++// RUN: %clang_cc1 -triple x86_64-cygwin -emit-llvm -o - %s | FileCheck %s --check-prefix=X64 + // RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -o - %s -fdefault-calling-conv=vectorcall | FileCheck %s --check-prefix=X86-VEC + // RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -o - %s -fdefault-calling-conv=vectorcall | FileCheck %s --check-prefix=X64-VEC + +diff --git a/clang/test/CodeGen/debug-info-cc.c b/clang/test/CodeGen/debug-info-cc.c +index 2bfb1c28e9..e430e4c8ed 100644 +--- a/clang/test/CodeGen/debug-info-cc.c ++++ b/clang/test/CodeGen/debug-info-cc.c +@@ -1,5 +1,7 @@ + // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX +-// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS ++// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS ++// RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS ++// RUN: %clang_cc1 -triple x86_64-unknown-windows-cygnus -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS + // RUN: %clang_cc1 -triple i386-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX32 + // RUN: %clang_cc1 -triple armv7--linux-gnueabihf -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=ARM + +@@ -77,7 +79,7 @@ __attribute__((intel_ocl_bicc)) int add_inteloclbicc(int a, int b) { + } + #endif + +-#ifdef _WIN64 ++#if defined(_WIN64) || defined(__CYGWIN__) + // WINDOWS: !DISubprogram({{.*}}"add_sysvabi", {{.*}}type: ![[FTY:[0-9]+]] + // WINDOWS: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86_64SysV, + __attribute__((sysv_abi)) int add_sysvabi(int a, int b) { +diff --git a/clang/test/CodeGen/ms_abi.c b/clang/test/CodeGen/ms_abi.c +index 528e546f31..f5b859b5a4 100644 +--- a/clang/test/CodeGen/ms_abi.c ++++ b/clang/test/CodeGen/ms_abi.c +@@ -1,5 +1,7 @@ + // RUN: %clang_cc1 -triple x86_64-unknown-freebsd10.0 -emit-llvm < %s | FileCheck -check-prefix=FREEBSD %s + // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm < %s | FileCheck -check-prefix=WIN64 %s ++// RUN: %clang_cc1 -triple x86_64-mingw -emit-llvm < %s | FileCheck -check-prefix=WIN64 %s ++// RUN: %clang_cc1 -triple x86_64-cygwin -emit-llvm < %s | FileCheck -check-prefix=WIN64 %s + // RUN: %clang_cc1 -triple x86_64-uefi -emit-llvm < %s | FileCheck -check-prefix=WIN64 %s + + struct foo { +diff --git a/clang/test/CodeGen/sysv_abi.c b/clang/test/CodeGen/sysv_abi.c +index 29ea819c2a..a66ecc6e26 100644 +--- a/clang/test/CodeGen/sysv_abi.c ++++ b/clang/test/CodeGen/sysv_abi.c +@@ -1,7 +1,11 @@ + // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX ++// RUN: %clang_cc1 -triple x86_64-mingw -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX ++// RUN: %clang_cc1 -triple x86_64-cygwin -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX + // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX + // RUN: %clang_cc1 -triple x86_64-uefi -emit-llvm -target-cpu skylake-avx512 < %s | FileCheck %s --check-prefixes=CHECK,AVX + // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX ++// RUN: %clang_cc1 -triple x86_64-mingw -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX ++// RUN: %clang_cc1 -triple x86_64-cygwin -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX + // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX + // RUN: %clang_cc1 -triple x86_64-uefi -emit-llvm < %s | FileCheck %s --check-prefixes=CHECK,NOAVX + +diff --git a/clang/test/Parser/x64-windows-calling-convention-handling.c b/clang/test/Parser/x64-windows-calling-convention-handling.c +index c027663414..224931c4eb 100644 +--- a/clang/test/Parser/x64-windows-calling-convention-handling.c ++++ b/clang/test/Parser/x64-windows-calling-convention-handling.c +@@ -1,4 +1,6 @@ +-// RUN: %clang_cc1 -triple x86_64-windows -fms-compatibility -fsyntax-only -verify %s ++// RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s ++// RUN: %clang_cc1 -triple x86_64-mingw -fsyntax-only -verify %s ++// RUN: %clang_cc1 -triple x86_64-cygwin -fsyntax-only -verify %s + + int __cdecl cdecl(int a, int b, int c, int d) { // expected-no-diagnostics + return a + b + c + d; +diff --git a/clang/test/Sema/MicrosoftCompatibility-x64.c b/clang/test/Sema/MicrosoftCompatibility-x64.c +index 7d1f64996e..a422b549dc 100644 +--- a/clang/test/Sema/MicrosoftCompatibility-x64.c ++++ b/clang/test/Sema/MicrosoftCompatibility-x64.c +@@ -1,4 +1,6 @@ +-// RUN: %clang_cc1 %s -Wmicrosoft -verify -fms-compatibility -triple x86_64-pc-win32 ++// RUN: %clang_cc1 %s -Wmicrosoft -verify -triple x86_64-pc-win32 ++// RUN: %clang_cc1 %s -Wmicrosoft -verify -triple x86_64-w64-mingw32 ++// RUN: %clang_cc1 %s -Wmicrosoft -verify -triple x86_64-pc-cygwin + + // None of these should warn. stdcall is treated as equivalent to cdecl on + // x64. +-- +2.51.0.windows.1 + diff --git a/llvm/0199-msysize.patch b/llvm/0199-msysize.patch index 5f5d05e1..65452216 100644 --- a/llvm/0199-msysize.patch +++ b/llvm/0199-msysize.patch @@ -7,10 +7,10 @@ diff -ur a/clang/lib/Driver/ToolChains/Cygwin.cpp b/clang/lib/Driver/ToolChains/ - CmdArgs.push_back("--dll-search-prefix=cyg"); + CmdArgs.push_back("--dll-search-prefix=msys-"); - - CmdArgs.push_back("-o"); - const char *OutputFile = Output.getFilename(); -@@ -238,8 +238,8 @@ + if (Args.hasArg(options::OPT_rdynamic)) + CmdArgs.push_back("--export-all-symbols"); + if (!Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_mdll)) { +@@ -245,8 +245,8 @@ if (Args.hasArg(options::OPT_mdll) || IsShared) { CmdArgs.push_back("-e"); CmdArgs.push_back(ToolChain.getArch() == llvm::Triple::x86 diff --git a/llvm/PKGBUILD b/llvm/PKGBUILD index de4adb1d..b3fcb023 100644 --- a/llvm/PKGBUILD +++ b/llvm/PKGBUILD @@ -13,7 +13,7 @@ _version=21.1.1 _rc="" _tag=llvmorg-${_version}${_rc} pkgver=${_version}${_rc/-/} -pkgrel=1 +pkgrel=2 pkgdesc="C language family frontend for LLVM" arch=('i686' 'x86_64') url="https://llvm.org/" @@ -46,11 +46,14 @@ source=("${_url}/llvm-${pkgver}.src.tar.xz"{,.sig} "0005-LLVM-adjust-lit.cfg.py-for-Cygwin-151416.patch" "0006-LLVM-Support-Fix-tests-on-Cygwin-151417.patch" "0007-LLVM-lit-add-system-cygwin-feature-152780.patch" + "0008-LLVM-Coverage-Unittest-Fix-dangling-reference-in-uni.patch" "0101-Clang-Cygwin-Enable-few-conditions-that-are-shared-w.patch" "0102-hack-cygwin-allow-multiple-definition-in-c-index-tes.patch" "0103-Cygwin-Internal-class-in-explicitly-instantiation-de.patch" "0104-Clang-Cygwin-call-linker-directly.patch" "0105-Tests-Add-system-cygwin-feature-and-use-it.-152611.patch" + "0106-Clang-Cygwin-Use-correct-mangling-rule-158404.patch" + "0107-Clang-Cygwin-Cygwin-x86_64-should-accept-__stdcall-1.patch" "0199-msysize.patch" "0201-LLD-COFF-Prevent-to-emit-relocations-for-discarded-w.patch" ) @@ -77,12 +80,15 @@ sha256sums=('23336f9f2290f2317121a5995e298a4616041ba06cbb07cfd1220a21b48775fe' 'f6152e93c0e6787609c32d84f097475dab91897102c91f58b8e921b8ceabf25f' 'dcf2d91ed1ec5e9b885c8de47fe7dc10465491a2b2e686c16a5819da14efbb9c' '18066ca1e97147650e139399db91066453b8a3f00ea0c7187b73f5eedbb56927' + '5580ef79c1cbe3efd0cc4fca078f29879be8764c62b1792fc7f74350ff862a67' 'c978145529c8f8f0f13192f7d705c7e5359c2c67cc01e0012679847cbbce9e12' 'b217f87de73cb6255997ef76630e3bc6e9a99398bd713e79d6c6da500620f60b' '9b6b248f63e04f810b4d1d919f0b2eb584b08888f0dad11d41e56769e0a01d10' - '9f741cdf2454526427d5941219583c2c0420d144368edd69954092086861a35b' + '08045ec514a0e9338cc46ad17ffcebb3c421c5eb3dd0ad2bade1bfb4e768f9c2' '18320250d0e175d6dabdfa44e6dc6fee6c6ca30ca91e9e1ed1f7c27417b7a671' - '9fd31dbc1f4066c2e2ab606369db27ade8336085c7487f4ac5f6f42dfefd74bf' + '024e13f86a5d3f181a3068ae7bbb7ba2ab11e062a12b8b949c7803ab1e057a6f' + 'be30d166830d23cb891d380e4e97287d5d88409eda8d0202e90d52fc183f020b' + '31fb13550d55f7517150fa6a367b8e618f4b5ce21067d4d91d8a5b3d22bd0ad7' 'fc4b425f9e88200a0baef63d0dbc23c70dce66f3e08fafa85717078c80ae8e2f') validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D' # Hans Wennborg, Google. '474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard @@ -136,7 +142,8 @@ prepare() { 0004-llvm-Enable-building-Analysis-plugins-on-Cygwin-1513.patch \ 0005-LLVM-adjust-lit.cfg.py-for-Cygwin-151416.patch \ 0006-LLVM-Support-Fix-tests-on-Cygwin-151417.patch \ - 0007-LLVM-lit-add-system-cygwin-feature-152780.patch + 0007-LLVM-lit-add-system-cygwin-feature-152780.patch \ + 0008-LLVM-Coverage-Unittest-Fix-dangling-reference-in-uni.patch # Patch clang cd "${srcdir}"/clang @@ -145,7 +152,9 @@ prepare() { 0102-hack-cygwin-allow-multiple-definition-in-c-index-tes.patch \ 0103-Cygwin-Internal-class-in-explicitly-instantiation-de.patch \ 0104-Clang-Cygwin-call-linker-directly.patch \ - 0105-Tests-Add-system-cygwin-feature-and-use-it.-152611.patch + 0105-Tests-Add-system-cygwin-feature-and-use-it.-152611.patch \ + 0106-Clang-Cygwin-Use-correct-mangling-rule-158404.patch \ + 0107-Clang-Cygwin-Cygwin-x86_64-should-accept-__stdcall-1.patch apply_git_patch_with_msg \ 0199-msysize.patch diff --git a/llvm/README-patches.md b/llvm/README-patches.md index c89bf500..ceb3ff77 100644 --- a/llvm/README-patches.md +++ b/llvm/README-patches.md @@ -17,10 +17,13 @@ Legend: - `"0005-LLVM-adjust-lit.cfg.py-for-Cygwin-151416.patch"` :arrow_up_small: https://github.com/llvm/llvm-project/commit/dfbf13cded64983e0a7512bcdcab577732671ec6 - `"0006-LLVM-Support-Fix-tests-on-Cygwin-151417.patch"` :arrow_up_small: https://github.com/llvm/llvm-project/commit/46f6e62eb9ea01e43ec45961e68c22f9c00b0a27 - `"0007-LLVM-lit-add-system-cygwin-feature-152780.patch"` :arrow_up_small: https://github.com/llvm/llvm-project/commit/37bcd937766d0bb151d4ee54d72d9cc289fee97b +- `"0008-LLVM-Coverage-Unittest-Fix-dangling-reference-in-uni.patch"` :arrow_down_small: https://github.com/llvm/llvm-project/commit/ca09801bd03579f28edac60077a164fab0474eb4 - `"0101-Clang-Cygwin-Enable-few-conditions-that-are-shared-w.patch"` :arrow_up_small: https://github.com/llvm/llvm-project/commit/a3228b6bf98c3efce3722700cf71f8b093e7870c - `"0102-hack-cygwin-allow-multiple-definition-in-c-index-tes.patch"` :grey_exclamation: - `"0103-Cygwin-Internal-class-in-explicitly-instantiation-de.patch"` :grey_exclamation: - `"0104-Clang-Cygwin-call-linker-directly.patch"` :arrow_down_small: https://github.com/llvm/llvm-project/pull/147960 - `"0105-Tests-Add-system-cygwin-feature-and-use-it.-152611.patch"` :arrow_up_small: https://github.com/llvm/llvm-project/commit/ff616b4806ed6c9b9698290a9c807626aa3844f7 +- `"0106-Clang-Cygwin-Use-correct-mangling-rule-158404.patch"` :arrow_down_small: https://github.com/llvm/llvm-project/commit/4abcbb053f8adaf48dbfff677e8ccda1f6d52b33 +- `"0107-Clang-Cygwin-Cygwin-x86_64-should-accept-__stdcall-1.patch"` :arrow_down_small: https://github.com/llvm/llvm-project/commit/b01cddee0e69bd283a0f1830f24fae326371f1de - `"0199-msysize.patch"` :grey_exclamation: - `"0201-LLD-COFF-Prevent-to-emit-relocations-for-discarded-w.patch"` :arrow_down_small: https://github.com/llvm/llvm-project/commit/e976622e2d7464b09fcf0141291003bf5fe9fd6f