Bug 1758780 - Update builders to clang 14. r=firefox-build-system-reviewers,mhentges,andi

Differential Revision: https://phabricator.services.mozilla.com/D143175
This commit is contained in:
Mike Hommey 2022-04-21 04:36:24 +00:00
parent 1cc969671c
commit 548aade9e4
29 changed files with 669 additions and 891 deletions

View File

@ -9,13 +9,9 @@
"Remove-FlushViewOfFile-when-unmaping-gcda-files.patch",
"fuzzing_ccov_build_clang_12.patch",
"win64-no-symlink.patch",
"revert-llvmorg-13-init-8182-gc2297544c047.patch",
"revert-llvmorg-12-init-7827-g2a078c307204.patch",
"llvmorg-14-init-3166-gd9ab62ca3d29.patch",
"llvmorg-14-init-4465-g22ea0cea595e-v2.patch",
"llvmorg-14-init-10524-g1ad7de9e92bc.patch",
"llvmorg-14-init-12719-gc4b45eeb44fd.patch",
"llvmorg-14-init-13305-g319181f76718.patch",
"llvmorg-14-init-13854-g782791ee84d2.patch"
"revert-llvmorg-14-init-14141-gd6d3000a2f6d.patch",
"revert-llvmorg-14-init-11890-gf86deb18cab6.patch",
"llvmorg-15-init-283-g4db89e23190d.patch",
"llvmorg-15-init-7469-gcfa4fe7c5187.patch"
]
}

View File

@ -1,23 +1,31 @@
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 73d66b980a5e..3b18de2176ba 100644
index 7de313ad4da6..697f98c362d1 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -432,6 +432,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
@@ -432,6 +432,7 @@ ClangTidyASTConsumerFactory::createASTConsumer(
for (auto &Check : Checks) {
Check->registerMatchers(&*Finder);
+ Check->registerPPCallbacks(Compiler);
Check->registerPPCallbacks(*SM, PP, ModuleExpanderPP);
}
diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.h b/clang-tools-extra/clang-tidy/ClangTidyCheck.h
index 20e9b8e47e6f..aded1f2e196c 100644
index 9b41e5836de7..d8938b8fe05e 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyCheck.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.h
@@ -70,6 +70,9 @@ public:
@@ -20,6 +20,7 @@
namespace clang {
+class CompilerInstance;
class SourceManager;
namespace tidy {
@@ -69,6 +70,9 @@ public:
return true;
}
+ /// This has been deprecated in clang 9 - needed by mozilla-must-override
+ virtual void registerPPCallbacks(CompilerInstance &Compiler) {}
+

View File

@ -1,40 +0,0 @@
From 1ad7de9e92bc2977698e5f6d6493202b50c912d5 Mon Sep 17 00:00:00 2001
From: Saleem Abdulrasool <compnerd@compnerd.org>
Date: Wed, 24 Nov 2021 10:44:38 -0800
Subject: [PATCH] Headers: exclude `#include_next <stdatomic.h>` on MSVC
The 14.31.30818 toolset has the following in the `stdatomic.h`:
~~~
#ifndef __cplusplus
#error <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.
#endif
~~~
This results in clang failing to build existing code which relied on
`stdatomic.h` in C mode on Windows. Simply fallback to the clang header
until that header is available as a complete implementation.
---
clang/lib/Headers/stdatomic.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Headers/stdatomic.h b/clang/lib/Headers/stdatomic.h
index 665551ea69a4..1e47bcb2bacf 100644
--- a/clang/lib/Headers/stdatomic.h
+++ b/clang/lib/Headers/stdatomic.h
@@ -12,8 +12,12 @@
/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
* example, already has a Clang-compatible stdatomic.h header.
+ *
+ * Exclude the MSVC path as well as the MSVC header as of the 14.31.30818
+ * explicitly disallows `stdatomic.h` in the C mode via an `#error`. Fallback
+ * to the clang resource header until that is fully supported.
*/
-#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
+#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>) && !defined(_MSC_VER)
# include_next <stdatomic.h>
#else
--
2.35.0.1.g829a698654

View File

@ -1,86 +0,0 @@
From c4b45eeb44fdc49d1b6199f242082268f8c017d0 Mon Sep 17 00:00:00 2001
From: Nico Weber <thakis@chromium.org>
Date: Fri, 17 Dec 2021 12:35:52 -0500
Subject: [PATCH] [lld/mac] Don't lose "weak ref" bit when doing LTO
Fixes #52778.
Probably fixes Chromium crashing on startup on macOS 10.15 (and older) systems
when building with LTO, but I haven't verified that yet.
Differential Revision: https://reviews.llvm.org/D115949
---
lld/MachO/InputFiles.cpp | 3 +--
lld/test/MachO/lto-weak-ref.ll | 45 ++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 2 deletions(-)
create mode 100644 lld/test/MachO/lto-weak-ref.ll
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index a4fb9035193c..14cd224520f7 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -1272,9 +1272,8 @@ static macho::Symbol *createBitcodeSymbol(const lto::InputFile::Symbol &objSym,
BitcodeFile &file) {
StringRef name = saver.save(objSym.getName());
- // TODO: support weak references
if (objSym.isUndefined())
- return symtab->addUndefined(name, &file, /*isWeakRef=*/false);
+ return symtab->addUndefined(name, &file, /*isWeakRef=*/objSym.isWeak());
assert(!objSym.isCommon() && "TODO: support common symbols in LTO");
diff --git a/lld/test/MachO/lto-weak-ref.ll b/lld/test/MachO/lto-weak-ref.ll
new file mode 100644
index 000000000000..b9dbd47dd415
--- /dev/null
+++ b/lld/test/MachO/lto-weak-ref.ll
@@ -0,0 +1,45 @@
+; REQUIRES: x86
+
+; RUN: rm -rf %t; split-file %s %t
+
+; RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/dylib.s -o %t/dylib.o
+; RUN: %lld -dylib -lSystem %t/dylib.o -o %t/dylib.dylib
+
+;; As baseline, compile the .ll file to a real .o file and check behavior.
+; RUN: llc -filetype=obj %t/weak-ref.ll -o %t/obj.o
+; RUN: %lld -dylib -lSystem %t/obj.o %t/dylib.dylib -o %t/test.obj
+; RUN: llvm-objdump --macho --syms %t/test.obj | FileCheck %s --check-prefixes=WEAK-REF
+
+;; Check that we get the same behavior compiling the .ll file to a bitcode .o
+;; file and linking that.
+; RUN: opt -module-summary %t/weak-ref.ll -o %t/bitcode.o
+; RUN: %lld -dylib -lSystem %t/bitcode.o %t/dylib.dylib -o %t/test.lto
+; RUN: llvm-objdump --macho --syms %t/test.lto | FileCheck %s --check-prefixes=WEAK-REF
+
+; WEAK-REF: SYMBOL TABLE:
+; WEAK-REF: w *UND* _my_weak_extern_function
+
+;--- dylib.s
+
+.globl _my_weak_extern_function
+_my_weak_extern_function:
+ ret
+
+;--- weak-ref.ll
+target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.15.0"
+
+declare extern_weak void @my_weak_extern_function()
+
+; Function Attrs: noinline nounwind optnone ssp uwtable
+define i32 @bar(i1 zeroext %0) {
+entry:
+ br i1 %0, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ call void @my_weak_extern_function()
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret i32 0
+}
--
2.34.0.1.g4c8d2d0e3e

View File

@ -1,141 +0,0 @@
From 319181f7671868be6cd4865e9bcc63f6ba2ddb06 Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh@glandium.org>
Date: Tue, 28 Dec 2021 19:01:01 -0500
Subject: [PATCH] [lld-macho] Fix alignment of TLV data sections
References from thread-local variable sections are treated as offsets
relative to the start of the thread-local data memory area, which is
initialized via copying all the TLV data sections (which are all
contiguous). If later data sections require a greater alignment than
earlier ones, the offsets of data within those sections won't be
guaranteed to aligned unless we normalize alignments. We therefore use
the largest alignment for all TLV data sections.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D116263
---
lld/MachO/Writer.cpp | 19 +++++++++++++++++--
lld/test/MachO/tlv.s | 30 ++++++++++++++++++++++--------
2 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 8903f0189ef9..3c7bea335c66 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -908,13 +908,28 @@ static void sortSegmentsAndSections() {
uint32_t sectionIndex = 0;
for (OutputSegment *seg : outputSegments) {
seg->sortOutputSections();
+ // References from thread-local variable sections are treated as offsets
+ // relative to the start of the thread-local data memory area, which
+ // is initialized via copying all the TLV data sections (which are all
+ // contiguous). If later data sections require a greater alignment than
+ // earlier ones, the offsets of data within those sections won't be
+ // guaranteed to aligned unless we normalize alignments. We therefore use
+ // the largest alignment for all TLV data sections.
+ uint32_t tlvAlign = 0;
+ for (const OutputSection *osec : seg->getSections())
+ if (isThreadLocalData(osec->flags) && osec->align > tlvAlign)
+ tlvAlign = osec->align;
+
for (OutputSection *osec : seg->getSections()) {
// Now that the output sections are sorted, assign the final
// output section indices.
if (!osec->isHidden())
osec->index = ++sectionIndex;
- if (!firstTLVDataSection && isThreadLocalData(osec->flags))
- firstTLVDataSection = osec;
+ if (isThreadLocalData(osec->flags)) {
+ if (!firstTLVDataSection)
+ firstTLVDataSection = osec;
+ osec->align = tlvAlign;
+ }
if (!isecPriorities.empty()) {
if (auto *merged = dyn_cast<ConcatOutputSection>(osec)) {
diff --git a/lld/test/MachO/tlv.s b/lld/test/MachO/tlv.s
index f188bf7279a8..e71fe76980e2 100644
--- a/lld/test/MachO/tlv.s
+++ b/lld/test/MachO/tlv.s
@@ -24,12 +24,12 @@
# RUN: llvm-objdump -d --bind --rebase %t/regular-and-tbss | FileCheck %s --check-prefixes=REG,TBSS,LINKEDIT
# RUN: llvm-objdump --macho --section=__DATA,__thread_vars %t/regular-and-tbss | \
# RUN: FileCheck %s --check-prefix=REG-TBSS-TLVP
-# RUN: llvm-objdump --section-headers %t/regular-and-tbss | FileCheck %s --check-prefix=SECTION-ORDER
+# RUN: llvm-objdump --section-headers %t/regular-and-tbss | FileCheck %s --check-prefix=SECTIONS
## Check that we always put __thread_bss immediately after __thread_data,
## regardless of the order of the input files.
# RUN: %lld -lSystem %t/tbss.o %t/regular.o -o %t/regular-and-tbss
-# RUN: llvm-objdump --section-headers %t/regular-and-tbss | FileCheck %s --check-prefix=SECTION-ORDER
+# RUN: llvm-objdump --section-headers %t/regular-and-tbss | FileCheck %s --check-prefix=SECTIONS
# HEADER: MH_HAS_TLV_DESCRIPTORS
@@ -41,6 +41,7 @@
# TBSS: <_f>:
# TBSS-NEXT: leaq {{.*}}(%rip), %rax ## {{.*}} <_baz>
# TBSS-NEXT: leaq {{.*}}(%rip), %rax ## {{.*}} <_qux>
+# TBSS-NEXT: leaq {{.*}}(%rip), %rax ## {{.*}} <_hoge>
# TBSS-NEXT: retq
# REG-TLVP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@@ -53,10 +54,12 @@
# REG-TBSS-TLVP: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# REG-TBSS-TLVP-NEXT: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-# REG-TBSS-TLVP-NEXT: 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
+# REG-TBSS-TLVP-NEXT: 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00
# REG-TBSS-TLVP-NEXT: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-# REG-TBSS-TLVP-NEXT: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-# REG-TBSS-TLVP-NEXT: 00 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00
+# REG-TBSS-TLVP-NEXT: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+# REG-TBSS-TLVP-NEXT: 00 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00
+# REG-TBSS-TLVP-NEXT: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+# REG-TBSS-TLVP-NEXT: 30 00 00 00 00 00 00 00
## Make sure we don't emit rebase opcodes for relocations in __thread_vars.
# LINKEDIT: Rebase table:
@@ -66,9 +69,14 @@
# LINKEDIT: __DATA __thread_vars 0x{{[0-9a-f]*}} pointer 0 libSystem __tlv_bootstrap
# LINKEDIT: __DATA __thread_vars 0x{{[0-9a-f]*}} pointer 0 libSystem __tlv_bootstrap
-# SECTION-ORDER: __thread_data
-# SECTION-ORDER: more_thread_data
-# SECTION-ORDER-NEXT: __thread_bss
+## Make sure we have an odd number of tlv vars, and that the __thread_vars
+## section starts 16-bytes aligned. This is the setup required for __thread_data
+## not to be automatically 16-bytes aligned, ensuring the linker does its
+## expected job of aligning _hoge$tlv$init.
+# SECTIONS: __thread_vars {{[0-9]+}}8 {{[0-9]+}}0
+# SECTIONS: __thread_data
+# SECTIONS: more_thread_data
+# SECTIONS-NEXT: __thread_bss
#--- regular.s
.globl _main
@@ -102,10 +110,12 @@ _bar:
_f:
mov _baz@TLVP(%rip), %rax
mov _qux@TLVP(%rip), %rax
+ mov _hoge@TLVP(%rip), %rax
ret
.tbss _baz$tlv$init, 8, 3
.tbss _qux$tlv$init, 8, 3
+.tbss _hoge$tlv$init, 16, 4
.section __DATA,__thread_vars,thread_local_variables
_baz:
@@ -116,3 +126,7 @@ _qux:
.quad __tlv_bootstrap
.quad 0
.quad _qux$tlv$init
+_hoge:
+ .quad __tlv_bootstrap
+ .quad 0
+ .quad _hoge$tlv$init
--
2.34.0.1.g4c8d2d0e3e

View File

@ -1,60 +0,0 @@
From 782791ee84d29db137f441c1e033582a7a78ad5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20B=C3=B6ck?= <markus.boeck02@gmail.com>
Date: Fri, 24 Dec 2021 21:55:07 +0100
Subject: [PATCH] [clang][#52782] Bail on incomplete parameter type in stdcall
name mangling
stdcall name mangling requires a suffix with the number equal to the sum of the byte count of all parameter types. In the case of a function prototype that has a parameter type of an incomplete type it is impossible to get the size of the type. While such a function is not callable or able to be defined in the TU, it may still be mangled when generating debug info, which would previously lead to a crash.
This patch fixes that by simply bailing out of the loop and using the so far accumulated byte count. This matches GCCs behaviour as well: https://github.com/gcc-mirror/gcc/blob/bc8d6c60137f8bbf173b86ddf31b15d7ba2a33dd/gcc/config/i386/winnt.c#L203
Fixes https://github.com/llvm/llvm-project/issues/52782
Differential Revision: https://reviews.llvm.org/D116020
---
clang/lib/AST/Mangle.cpp | 8 +++++++-
clang/test/CodeGen/pr52782-stdcall-func-decl.cpp | 10 ++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
diff --git a/clang/lib/AST/Mangle.cpp b/clang/lib/AST/Mangle.cpp
index 54dbf484f377..984da9909ce2 100644
--- a/clang/lib/AST/Mangle.cpp
+++ b/clang/lib/AST/Mangle.cpp
@@ -225,11 +225,17 @@ void MangleContext::mangleName(GlobalDecl GD, raw_ostream &Out) {
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD))
if (!MD->isStatic())
++ArgWords;
- for (const auto &AT : Proto->param_types())
+ for (const auto &AT : Proto->param_types()) {
+ // If an argument type is incomplete there is no way to get its size to
+ // correctly encode into the mangling scheme.
+ // Follow GCCs behaviour by simply breaking out of the loop.
+ if (AT->isIncompleteType())
+ break;
// Size should be aligned to pointer size.
ArgWords +=
llvm::alignTo(ASTContext.getTypeSize(AT), TI.getPointerWidth(0)) /
TI.getPointerWidth(0);
+ }
Out << ((TI.getPointerWidth(0) / 8) * ArgWords);
}
diff --git a/clang/test/CodeGen/pr52782-stdcall-func-decl.cpp b/clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
new file mode 100644
index 000000000000..c3c94ece24b2
--- /dev/null
+++ b/clang/test/CodeGen/pr52782-stdcall-func-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple i686-w64-windows-gnu -o - -emit-llvm -debug-info-kind=constructor %s | FileCheck %s
+
+enum nsresult {};
+
+class NotNull;
+
+class nsICanvasRenderingContextInternal {
+ // CHECK: !DISubprogram(name: "InitializeWithDrawTarget", linkageName: "\01__ZN33nsICanvasRenderingContextInternal24InitializeWithDrawTargetE7NotNull@4"
+ nsresult __stdcall InitializeWithDrawTarget(NotNull);
+} nsTBaseHashSet;
--
2.34.0.1.g4c8d2d0e3e

View File

@ -1,75 +0,0 @@
From d9ab62ca3d292c69d69701541b85efba0f195264 Mon Sep 17 00:00:00 2001
From: Jez Ng <jezng@fb.com>
Date: Sat, 4 Sep 2021 17:40:07 -0400
Subject: [PATCH] [lld-macho] Initialize LTO backend with diagnostic handler
Failing to do so results in `std::bad_function_call` being
thrown when a pass tries to emit a diagnostic.
I've copied the relevant test over from LLD-ELF's test suite.
Reviewed By: #lld-macho, thevinster
Differential Revision: https://reviews.llvm.org/D109274
---
lld/MachO/LTO.cpp | 1 +
lld/test/MachO/lto-irmover-warning.ll | 35 +++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
create mode 100644 lld/test/MachO/lto-irmover-warning.ll
diff --git a/lld/MachO/LTO.cpp b/lld/MachO/LTO.cpp
index 366193a27eba..09b05ed0dffe 100644
--- a/lld/MachO/LTO.cpp
+++ b/lld/MachO/LTO.cpp
@@ -37,6 +37,7 @@ static lto::Config createConfig() {
c.CodeModel = getCodeModelFromCMModel();
c.CPU = getCPUStr();
c.MAttrs = getMAttrs();
+ c.DiagHandler = diagnosticHandler;
c.UseNewPM = config->ltoNewPassManager;
c.PreCodeGenPassesHook = [](legacy::PassManager &pm) {
pm.add(createObjCARCContractPass());
diff --git a/lld/test/MachO/lto-irmover-warning.ll b/lld/test/MachO/lto-irmover-warning.ll
new file mode 100644
index 000000000000..f781215c83c9
--- /dev/null
+++ b/lld/test/MachO/lto-irmover-warning.ll
@@ -0,0 +1,35 @@
+; REQUIRES: x86
+; RUN: rm -rf %t; split-file %s %t
+; RUN: llvm-as -o %t/first.bc %t/first.ll
+; RUN: llvm-as -o %t/second.bc %t/second.ll
+; RUN: %no_fatal_warnings_lld -dylib %t/first.bc %t/second.bc -o /dev/null 2>&1 | FileCheck %s
+
+;; FIXME: can we replace ld-temp.o with a proper name?
+; CHECK: warning: linking module flags 'foo': IDs have conflicting values ('i32 2' from {{.*}}second.bc with 'i32 1' from ld-temp.o)
+
+;--- first.ll
+target triple = "x86_64-apple-macosx10.15.0"
+target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+
+declare void @f()
+
+define void @g() {
+ call void @f()
+ ret void
+}
+
+!0 = !{ i32 2, !"foo", i32 1 }
+
+!llvm.module.flags = !{ !0 }
+
+;--- second.ll
+target triple = "x86_64-apple-macosx10.15.0"
+target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @f() {
+ ret void
+}
+
+!0 = !{ i32 2, !"foo", i32 2 }
+
+!llvm.module.flags = !{ !0 }
--
2.34.0.1.g4c8d2d0e3e

View File

@ -1,181 +0,0 @@
From 22ea0cea595e1b44b46c520243f2292bc4e3d943 Mon Sep 17 00:00:00 2001
From: Toshihito Kikuchi <leamovret@gmail.com>
Date: Tue, 21 Sep 2021 15:49:03 -0700
Subject: [PATCH] [compiler-rt] [windows] Add more assembly patterns for
interception
To intercept the functions in Win11's ntdll.dll, we need to use the trampoline
technique because there are bytes other than 0x90 or 0xcc in the gaps between
exported functions. This patch adds more patterns that appear in ntdll's
functions.
Bug: https://bugs.llvm.org/show_bug.cgi?id=51721
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D109941
---
.../lib/interception/interception_win.cpp | 46 +++++++++++++++++++
.../tests/interception_win_test.cpp | 45 ++++++++++++++++++
2 files changed, 91 insertions(+)
diff --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp
index 635499c2b385..38b8c058246a 100644
--- a/compiler-rt/lib/interception/interception_win.cpp
+++ b/compiler-rt/lib/interception/interception_win.cpp
@@ -398,8 +398,42 @@ static uptr AllocateMemoryForTrampoline(uptr image_address, size_t size) {
return allocated_space;
}
+// The following prologues cannot be patched because of the short jump
+// jumping to the patching region.
+
+// ntdll!wcslen in Win11
+// 488bc1 mov rax,rcx
+// 0fb710 movzx edx,word ptr [rax]
+// 4883c002 add rax,2
+// 6685d2 test dx,dx
+// 75f4 jne -12
+static const u8 kPrologueWithShortJump1[] = {
+ 0x48, 0x8b, 0xc1, 0x0f, 0xb7, 0x10, 0x48, 0x83,
+ 0xc0, 0x02, 0x66, 0x85, 0xd2, 0x75, 0xf4,
+};
+
+// ntdll!strrchr in Win11
+// 4c8bc1 mov r8,rcx
+// 8a01 mov al,byte ptr [rcx]
+// 48ffc1 inc rcx
+// 84c0 test al,al
+// 75f7 jne -9
+static const u8 kPrologueWithShortJump2[] = {
+ 0x4c, 0x8b, 0xc1, 0x8a, 0x01, 0x48, 0xff, 0xc1,
+ 0x84, 0xc0, 0x75, 0xf7,
+};
+
// Returns 0 on error.
static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
+#if SANITIZER_WINDOWS64
+ if (memcmp((u8*)address, kPrologueWithShortJump1,
+ sizeof(kPrologueWithShortJump1)) == 0 ||
+ memcmp((u8*)address, kPrologueWithShortJump2,
+ sizeof(kPrologueWithShortJump2)) == 0) {
+ return 0;
+ }
+#endif
+
switch (*(u64*)address) {
case 0x90909090909006EB: // stub: jmp over 6 x nop.
return 8;
@@ -477,6 +511,14 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
case 0xA1: // A1 XX XX XX XX XX XX XX XX :
// movabs eax, dword ptr ds:[XXXXXXXX]
return 9;
+
+ case 0x83:
+ const u8 next_byte = *(u8*)(address + 1);
+ const u8 mod = next_byte >> 6;
+ const u8 rm = next_byte & 7;
+ if (mod == 1 && rm == 4)
+ return 5; // 83 ModR/M SIB Disp8 Imm8
+ // add|or|adc|sbb|and|sub|xor|cmp [r+disp8], imm8
}
switch (*(u16*)address) {
@@ -493,6 +535,8 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
case 0x5641: // push r14
case 0x5741: // push r15
case 0x9066: // Two-byte NOP
+ case 0xc084: // test al, al
+ case 0x018a: // mov al, byte ptr [rcx]
return 2;
case 0x058B: // 8B 05 XX XX XX XX : mov eax, dword ptr [XX XX XX XX]
@@ -509,6 +553,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
case 0xd12b48: // 48 2b d1 : sub rdx, rcx
case 0x07c1f6: // f6 c1 07 : test cl, 0x7
case 0xc98548: // 48 85 C9 : test rcx, rcx
+ case 0xd28548: // 48 85 d2 : test rdx, rdx
case 0xc0854d: // 4d 85 c0 : test r8, r8
case 0xc2b60f: // 0f b6 c2 : movzx eax, dl
case 0xc03345: // 45 33 c0 : xor r8d, r8d
@@ -522,6 +567,7 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) {
case 0xca2b48: // 48 2b ca : sub rcx, rdx
case 0x10b70f: // 0f b7 10 : movzx edx, WORD PTR [rax]
case 0xc00b4d: // 3d 0b c0 : or r8, r8
+ case 0xc08b41: // 41 8b c0 : mov eax, r8d
case 0xd18b48: // 48 8b d1 : mov rdx, rcx
case 0xdc8b4c: // 4c 8b dc : mov r11, rsp
case 0xd18b4c: // 4c 8b d1 : mov r10, rcx
diff --git a/compiler-rt/lib/interception/tests/interception_win_test.cpp b/compiler-rt/lib/interception/tests/interception_win_test.cpp
index f8ab4ec67443..084a98602969 100644
--- a/compiler-rt/lib/interception/tests/interception_win_test.cpp
+++ b/compiler-rt/lib/interception/tests/interception_win_test.cpp
@@ -208,6 +208,28 @@ const u8 kUnpatchableCode6[] = {
0x90, 0x90, 0x90, 0x90,
};
+const u8 kUnpatchableCode7[] = {
+ 0x33, 0xc0, // xor eax,eax
+ 0x48, 0x85, 0xd2, // test rdx,rdx
+ 0x74, 0x10, // je +16 (unpatchable)
+};
+
+const u8 kUnpatchableCode8[] = {
+ 0x48, 0x8b, 0xc1, // mov rax,rcx
+ 0x0f, 0xb7, 0x10, // movzx edx,word ptr [rax]
+ 0x48, 0x83, 0xc0, 0x02, // add rax,2
+ 0x66, 0x85, 0xd2, // test dx,dx
+ 0x75, 0xf4, // jne -12 (unpatchable)
+};
+
+const u8 kUnpatchableCode9[] = {
+ 0x4c, 0x8b, 0xc1, // mov r8,rcx
+ 0x8a, 0x01, // mov al,byte ptr [rcx]
+ 0x48, 0xff, 0xc1, // inc rcx
+ 0x84, 0xc0, // test al,al
+ 0x75, 0xf7, // jne -9 (unpatchable)
+};
+
const u8 kPatchableCode6[] = {
0x48, 0x89, 0x54, 0x24, 0xBB, // mov QWORD PTR [rsp + 0xBB], rdx
0x33, 0xC9, // xor ecx,ecx
@@ -226,6 +248,23 @@ const u8 kPatchableCode8[] = {
0xC3, // ret
};
+const u8 kPatchableCode9[] = {
+ 0x8a, 0x01, // al,byte ptr [rcx]
+ 0x45, 0x33, 0xc0, // xor r8d,r8d
+ 0x84, 0xc0, // test al,al
+};
+
+const u8 kPatchableCode10[] = {
+ 0x45, 0x33, 0xc0, // xor r8d,r8d
+ 0x41, 0x8b, 0xc0, // mov eax,r8d
+ 0x48, 0x85, 0xd2, // test rdx,rdx
+};
+
+const u8 kPatchableCode11[] = {
+ 0x48, 0x83, 0xec, 0x38, // sub rsp,38h
+ 0x83, 0x64, 0x24, 0x28, 0x00, // and dword ptr [rsp+28h],0
+};
+
// A buffer holding the dynamically generated code under test.
u8* ActiveCode;
const size_t ActiveCodeLength = 4096;
@@ -610,6 +649,12 @@ TEST(Interception, PatchableFunctionWithTrampoline) {
EXPECT_TRUE(TestFunctionPatching(kPatchableCode2, override, prefix));
#if SANITIZER_WINDOWS64
EXPECT_FALSE(TestFunctionPatching(kPatchableCode3, override, prefix));
+ EXPECT_TRUE(TestFunctionPatching(kPatchableCode9, override, prefix));
+ EXPECT_TRUE(TestFunctionPatching(kPatchableCode10, override, prefix));
+ EXPECT_TRUE(TestFunctionPatching(kPatchableCode11, override, prefix));
+ EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode7, override, prefix));
+ EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode8, override, prefix));
+ EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode9, override, prefix));
#else
EXPECT_TRUE(TestFunctionPatching(kPatchableCode3, override, prefix));
#endif
--
2.28.0.windows.1

View File

@ -0,0 +1,27 @@
From 4db89e23190d1d1590d88df08056d327e651c94c Mon Sep 17 00:00:00 2001
From: Shoaib Meenai <smeenai@fb.com>
Date: Thu, 3 Feb 2022 13:39:54 -0800
Subject: [PATCH] [cmake] Increase -fms-compatibility-version in Windows
toolchain file
Make it match LLVM's new minimum requirement (after https://reviews.llvm.org/D114639).
---
llvm/cmake/platforms/WinMsvc.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/cmake/platforms/WinMsvc.cmake b/llvm/cmake/platforms/WinMsvc.cmake
index d30701a31858..ebb4da419e46 100644
--- a/llvm/cmake/platforms/WinMsvc.cmake
+++ b/llvm/cmake/platforms/WinMsvc.cmake
@@ -259,7 +259,7 @@ set(CROSS_TOOLCHAIN_FLAGS_NATIVE "${_CTF_NATIVE_DEFAULT}" CACHE STRING "")
set(COMPILE_FLAGS
-D_CRT_SECURE_NO_WARNINGS
--target=${TRIPLE_ARCH}-windows-msvc
- -fms-compatibility-version=19.14
+ -fms-compatibility-version=19.20
-imsvc "${ATLMFC_INCLUDE}"
-imsvc "${MSVC_INCLUDE}"
-imsvc "${WINSDK_INCLUDE}/ucrt"
--
2.35.0.1.g829a698654

View File

@ -0,0 +1,67 @@
From cfa4fe7c51870fe6b480d541938f556cf0736fa2 Mon Sep 17 00:00:00 2001
From: Ahmed Bougacha <ahmed@bougacha.org>
Date: Tue, 12 Apr 2022 09:23:11 -0700
Subject: [PATCH] [AArch64][LOH] Don't ignore regmasks in bundles by iterating
over instrs.
The LOH pass iterates over instructions to build its custom register
state machine, but it uses the top-level bundle iterator.
This should be okay, because when the wrapper BUNDLE MI is built,
it aggregates the register defs/uses in its instructions into MOs.
However, that doesn't apply to regmasks, and accumulating regmasks
across multiple instructions would be messy business.
There are a couple AnalyzePhysRegInBundle (/Virt) helpers that
do look at regmasks, but those don't fit in very well here.
AArch64 has started to use a few bundle instructions, specifically
as glorified pseudos for variant call instructions, which have regmasks.
So the LOH pass ends up ignoring regmasks.
Concretely, this has been wrong for a while, but, on aarch64, the
most common bundle (rv_marker call) was always followed by the
attached call instruction, a plain BL with a regmask. Which
was properly detected by the pass.
However, we recently started keeping the attached call in the bundle,
so the regmask is now ignored. And the pass happily combines ADRPs, of
say, x8, across the bundle, resulting in corrupt pointers later.
---
llvm/lib/Target/AArch64/AArch64CollectLOH.cpp | 2 +-
llvm/test/CodeGen/AArch64/loh.mir | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/AArch64/AArch64CollectLOH.cpp b/llvm/lib/Target/AArch64/AArch64CollectLOH.cpp
index ac243347b24d..b31b709c0c0a 100644
--- a/llvm/lib/Target/AArch64/AArch64CollectLOH.cpp
+++ b/llvm/lib/Target/AArch64/AArch64CollectLOH.cpp
@@ -559,7 +559,7 @@ bool AArch64CollectLOH::runOnMachineFunction(MachineFunction &MF) {
// Walk the basic block backwards and update the per register state machine
// in the process.
for (const MachineInstr &MI :
- instructionsWithoutDebug(MBB.rbegin(), MBB.rend())) {
+ instructionsWithoutDebug(MBB.instr_rbegin(), MBB.instr_rend())) {
unsigned Opcode = MI.getOpcode();
switch (Opcode) {
case AArch64::ADDXri:
diff --git a/llvm/test/CodeGen/AArch64/loh.mir b/llvm/test/CodeGen/AArch64/loh.mir
index 8c482fa27b1d..c816a5344bdb 100644
--- a/llvm/test/CodeGen/AArch64/loh.mir
+++ b/llvm/test/CodeGen/AArch64/loh.mir
@@ -190,4 +190,13 @@ body: |
bb.14:
liveins: $x10
$x12 = ADDXri $x10, target-flags(aarch64-pageoff) @g0, 0
+
+ bb.15:
+ ; Should not produce a LOH when reg is clobbered by bundled regmask
+ ; CHECK-NOT: MCLOH_AdrpAdrp
+ $x8 = ADRP target-flags(aarch64-page) @g0
+ BUNDLE {
+ BL @extfunc, csr_aarch64_aapcs
+ }
+ $x8 = ADRP target-flags(aarch64-page) @g1
...
--
2.35.0.1.g829a698654

View File

@ -1,17 +0,0 @@
llvmorg-12-init-7827-g2a078c307204 leads to linker complaints in shippable
builds. It may be related to LTO with IR from rustc. The patch author and I
were unable to get to the bottom of it, and in the end they suggested that
it's safe to undo the change locally.
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 368fc87dc801..96c2388d776e 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -1902,7 +1902,6 @@ AttrBuilder AttributeFuncs::typeIncompatible(Type *Ty) {
.addAttribute(Attribute::ReadNone)
.addAttribute(Attribute::ReadOnly)
.addAttribute(Attribute::SwiftError)
- .addAlignmentAttr(1) // the int here is ignored
.addDereferenceableAttr(1) // the int here is ignored
.addDereferenceableOrNullAttr(1) // the int here is ignored
.addPreallocatedAttr(Ty)

View File

@ -1,44 +0,0 @@
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index 4f0cbf986b31..e129481fc0e4 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -618,8 +618,8 @@ public:
}
/// Return the largest alignment for which a suitably-sized allocation with
- /// '::operator new(size_t)' or 'malloc' is guaranteed to produce a
- /// correctly-aligned pointer.
+ /// '::operator new(size_t)' is guaranteed to produce a correctly-aligned
+ /// pointer.
unsigned getNewAlign() const {
return NewAlign ? NewAlign : std::max(LongDoubleAlign, LongLongAlign);
}
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 47a4ed35be85..f77db7bdcecf 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2052,24 +2052,6 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
// allows it to work on indirect virtual function calls.
if (AttrOnCallSite && TargetDecl->hasAttr<NoMergeAttr>())
FuncAttrs.addAttribute(llvm::Attribute::NoMerge);
-
- // Add known guaranteed alignment for allocation functions.
- if (unsigned BuiltinID = Fn->getBuiltinID()) {
- switch (BuiltinID) {
- case Builtin::BIaligned_alloc:
- case Builtin::BIcalloc:
- case Builtin::BImalloc:
- case Builtin::BImemalign:
- case Builtin::BIrealloc:
- case Builtin::BIstrdup:
- case Builtin::BIstrndup:
- RetAttrs.addAlignmentAttr(Context.getTargetInfo().getNewAlign() /
- Context.getTargetInfo().getCharWidth());
- break;
- default:
- break;
- }
- }
}
// 'const', 'pure' and 'noalias' attributed functions are also nounwind.

View File

@ -0,0 +1,173 @@
From c8a5013045b5aff8e45418925688ca670545980f Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh@glandium.org>
Date: Fri, 18 Mar 2022 17:58:28 +0900
Subject: [PATCH] Revert "[lsan] Move out suppression of invalid PCs from
StopTheWorld"
This reverts commit f86deb18cab6479a0961ade3807e4729f3a27bdf
because of permafail for a sizable amount of ASan test jobs, where the
worker would die without even leaving any logs.
---
compiler-rt/lib/lsan/lsan_common.cpp | 108 +++++++++++++++++----------
1 file changed, 67 insertions(+), 41 deletions(-)
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index fd7aa38d99db..658415bce507 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -71,11 +71,9 @@ class LeakSuppressionContext {
SuppressionContext context;
bool suppressed_stacks_sorted = true;
InternalMmapVector<u32> suppressed_stacks;
- const LoadedModule *suppress_module = nullptr;
- void LazyInit();
Suppression *GetSuppressionForAddr(uptr addr);
- bool SuppressInvalid(const StackTrace &stack);
+ void LazyInit();
bool SuppressByRule(const StackTrace &stack, uptr hit_count, uptr total_size);
public:
@@ -126,8 +124,6 @@ void LeakSuppressionContext::LazyInit() {
if (&__lsan_default_suppressions)
context.Parse(__lsan_default_suppressions());
context.Parse(kStdSuppressions);
- if (flags()->use_tls && flags()->use_ld_allocations)
- suppress_module = GetLinker();
}
}
@@ -152,41 +148,6 @@ Suppression *LeakSuppressionContext::GetSuppressionForAddr(uptr addr) {
return s;
}
-static uptr GetCallerPC(const StackTrace &stack) {
- // The top frame is our malloc/calloc/etc. The next frame is the caller.
- if (stack.size >= 2)
- return stack.trace[1];
- return 0;
-}
-
-// On Linux, treats all chunks allocated from ld-linux.so as reachable, which
-// covers dynamically allocated TLS blocks, internal dynamic loader's loaded
-// modules accounting etc.
-// Dynamic TLS blocks contain the TLS variables of dynamically loaded modules.
-// They are allocated with a __libc_memalign() call in allocate_and_init()
-// (elf/dl-tls.c). Glibc won't tell us the address ranges occupied by those
-// blocks, but we can make sure they come from our own allocator by intercepting
-// __libc_memalign(). On top of that, there is no easy way to reach them. Their
-// addresses are stored in a dynamically allocated array (the DTV) which is
-// referenced from the static TLS. Unfortunately, we can't just rely on the DTV
-// being reachable from the static TLS, and the dynamic TLS being reachable from
-// the DTV. This is because the initial DTV is allocated before our interception
-// mechanism kicks in, and thus we don't recognize it as allocated memory. We
-// can't special-case it either, since we don't know its size.
-// Our solution is to include in the root set all allocations made from
-// ld-linux.so (which is where allocate_and_init() is implemented). This is
-// guaranteed to include all dynamic TLS blocks (and possibly other allocations
-// which we don't care about).
-// On all other platforms, this simply checks to ensure that the caller pc is
-// valid before reporting chunks as leaked.
-bool LeakSuppressionContext::SuppressInvalid(const StackTrace &stack) {
- uptr caller_pc = GetCallerPC(stack);
- // If caller_pc is unknown, this chunk may be allocated in a coroutine. Mark
- // it as reachable, as we can't properly report its allocation stack anyway.
- return !caller_pc ||
- (suppress_module && suppress_module->containsAddress(caller_pc));
-}
-
bool LeakSuppressionContext::SuppressByRule(const StackTrace &stack,
uptr hit_count, uptr total_size) {
for (uptr i = 0; i < stack.size; i++) {
@@ -205,7 +166,7 @@ bool LeakSuppressionContext::Suppress(u32 stack_trace_id, uptr hit_count,
uptr total_size) {
LazyInit();
StackTrace stack = StackDepotGet(stack_trace_id);
- if (!SuppressInvalid(stack) && !SuppressByRule(stack, hit_count, total_size))
+ if (!SuppressByRule(stack, hit_count, total_size))
return false;
suppressed_stacks_sorted = false;
suppressed_stacks.push_back(stack_trace_id);
@@ -569,6 +530,68 @@ static void CollectIgnoredCb(uptr chunk, void *arg) {
}
}
+static uptr GetCallerPC(const StackTrace &stack) {
+ // The top frame is our malloc/calloc/etc. The next frame is the caller.
+ if (stack.size >= 2)
+ return stack.trace[1];
+ return 0;
+}
+
+struct InvalidPCParam {
+ Frontier *frontier;
+ bool skip_linker_allocations;
+};
+
+// ForEachChunk callback. If the caller pc is invalid or is within the linker,
+// mark as reachable. Called by ProcessPlatformSpecificAllocations.
+static void MarkInvalidPCCb(uptr chunk, void *arg) {
+ CHECK(arg);
+ InvalidPCParam *param = reinterpret_cast<InvalidPCParam *>(arg);
+ chunk = GetUserBegin(chunk);
+ LsanMetadata m(chunk);
+ if (m.allocated() && m.tag() != kReachable && m.tag() != kIgnored) {
+ u32 stack_id = m.stack_trace_id();
+ uptr caller_pc = 0;
+ if (stack_id > 0)
+ caller_pc = GetCallerPC(StackDepotGet(stack_id));
+ // If caller_pc is unknown, this chunk may be allocated in a coroutine. Mark
+ // it as reachable, as we can't properly report its allocation stack anyway.
+ if (caller_pc == 0 || (param->skip_linker_allocations &&
+ GetLinker()->containsAddress(caller_pc))) {
+ m.set_tag(kIgnored);
+ param->frontier->push_back(chunk);
+ }
+ }
+}
+
+// On Linux, treats all chunks allocated from ld-linux.so as reachable, which
+// covers dynamically allocated TLS blocks, internal dynamic loader's loaded
+// modules accounting etc.
+// Dynamic TLS blocks contain the TLS variables of dynamically loaded modules.
+// They are allocated with a __libc_memalign() call in allocate_and_init()
+// (elf/dl-tls.c). Glibc won't tell us the address ranges occupied by those
+// blocks, but we can make sure they come from our own allocator by intercepting
+// __libc_memalign(). On top of that, there is no easy way to reach them. Their
+// addresses are stored in a dynamically allocated array (the DTV) which is
+// referenced from the static TLS. Unfortunately, we can't just rely on the DTV
+// being reachable from the static TLS, and the dynamic TLS being reachable from
+// the DTV. This is because the initial DTV is allocated before our interception
+// mechanism kicks in, and thus we don't recognize it as allocated memory. We
+// can't special-case it either, since we don't know its size.
+// Our solution is to include in the root set all allocations made from
+// ld-linux.so (which is where allocate_and_init() is implemented). This is
+// guaranteed to include all dynamic TLS blocks (and possibly other allocations
+// which we don't care about).
+// On all other platforms, this simply checks to ensure that the caller pc is
+// valid before reporting chunks as leaked.
+static void ProcessPC(Frontier *frontier) {
+ InvalidPCParam arg;
+ arg.frontier = frontier;
+ arg.skip_linker_allocations =
+ flags()->use_tls && flags()->use_ld_allocations && GetLinker() != nullptr;
+ ForEachChunk(MarkInvalidPCCb, &arg);
+}
+
// Sets the appropriate tag on each chunk.
static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads,
Frontier *frontier) {
@@ -584,6 +607,9 @@ static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads,
ProcessRootRegions(frontier);
FloodFillTag(frontier, kReachable);
+ CHECK_EQ(0, frontier->size());
+ ProcessPC(frontier);
+
// The check here is relatively expensive, so we do this in a separate flood
// fill. That way we can skip the check for chunks that are reachable
// otherwise.
--
2.35.0.1.g829a698654

View File

@ -0,0 +1,78 @@
From e602ffe1785cef7f5502223e81345e6b9395fae1 Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh@glandium.org>
Date: Fri, 11 Mar 2022 10:38:51 +0900
Subject: [PATCH] Revert "[CMake][WinMsvc] Fix user passed compiler/linker
flags"
This reverts commit d6d3000a2f6d88ac73e5d4da4005ceadec788a9a
because of bustage building 32-bits compiler-rt for Windows.
See https://reviews.llvm.org/D116709#3374131
---
llvm/cmake/platforms/WinMsvc.cmake | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/llvm/cmake/platforms/WinMsvc.cmake b/llvm/cmake/platforms/WinMsvc.cmake
index d30701a31858..9a5078894182 100644
--- a/llvm/cmake/platforms/WinMsvc.cmake
+++ b/llvm/cmake/platforms/WinMsvc.cmake
@@ -84,7 +84,6 @@
# up a VFS overlay for the SDK headers and case-correcting symlinks for the
# libraries when running on a case-sensitive filesystem.
-include_guard(GLOBAL)
# When configuring CMake with a toolchain file against a top-level CMakeLists.txt,
# it will actually run CMake many times, once for each small test program used to
@@ -252,8 +251,6 @@ list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_ASM_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/b
list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_C_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/bin/clang")
list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_CXX_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/bin/clang++")
-# These flags are used during build time. So if CFLAGS/CXXFLAGS/LDFLAGS is set
-# for the target, makes sure these are unset during build time.
set(CROSS_TOOLCHAIN_FLAGS_NATIVE "${_CTF_NATIVE_DEFAULT}" CACHE STRING "")
set(COMPILE_FLAGS
@@ -280,8 +277,18 @@ if(case_sensitive_filesystem)
endif()
string(REPLACE ";" " " COMPILE_FLAGS "${COMPILE_FLAGS}")
-string(APPEND CMAKE_C_FLAGS_INIT " ${COMPILE_FLAGS}")
-string(APPEND CMAKE_CXX_FLAGS_INIT " ${COMPILE_FLAGS}")
+
+# We need to preserve any flags that were passed in by the user. However, we
+# can't append to CMAKE_C_FLAGS and friends directly, because toolchain files
+# will be re-invoked on each reconfigure and therefore need to be idempotent.
+# The assignments to the _INITIAL cache variables don't use FORCE, so they'll
+# only be populated on the initial configure, and their values won't change
+# afterward.
+set(_CMAKE_C_FLAGS_INITIAL "${CMAKE_C_FLAGS}" CACHE STRING "")
+set(CMAKE_C_FLAGS "${_CMAKE_C_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE)
+
+set(_CMAKE_CXX_FLAGS_INITIAL "${CMAKE_CXX_FLAGS}" CACHE STRING "")
+set(CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE)
set(LINK_FLAGS
# Prevent CMake from attempting to invoke mt.exe. It only recognizes the slashed form and not the dashed form.
@@ -305,9 +312,16 @@ if(case_sensitive_filesystem)
endif()
string(REPLACE ";" " " LINK_FLAGS "${LINK_FLAGS}")
-string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${LINK_FLAGS}")
-string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " ${LINK_FLAGS}")
-string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${LINK_FLAGS}")
+
+# See explanation for compiler flags above for the _INITIAL variables.
+set(_CMAKE_EXE_LINKER_FLAGS_INITIAL "${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "")
+set(CMAKE_EXE_LINKER_FLAGS "${_CMAKE_EXE_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
+
+set(_CMAKE_MODULE_LINKER_FLAGS_INITIAL "${CMAKE_MODULE_LINKER_FLAGS}" CACHE STRING "")
+set(CMAKE_MODULE_LINKER_FLAGS "${_CMAKE_MODULE_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
+
+set(_CMAKE_SHARED_LINKER_FLAGS_INITIAL "${CMAKE_SHARED_LINKER_FLAGS}" CACHE STRING "")
+set(CMAKE_SHARED_LINKER_FLAGS "${_CMAKE_SHARED_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
# CMake populates these with a bunch of unnecessary libraries, which requires
# extra case-correcting symlinks and what not. Instead, let projects explicitly
--
2.35.0.1.g829a698654

View File

@ -1,8 +1,8 @@
diff --git a/llvm/cmake/modules/LLVMInstallSymlink.cmake b/llvm/cmake/modules/LLVMInstallSymlink.cmake
index 3e6a2c9a2648..09fed8085c23 100644
index b5c35f706cb7..d9f629be06a7 100644
--- a/llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ b/llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -4,17 +4,18 @@
@@ -6,17 +6,18 @@ include(GNUInstallDirs)
function(install_symlink name target outdir)
set(DESTDIR $ENV{DESTDIR})
@ -12,7 +12,7 @@ index 3e6a2c9a2648..09fed8085c23 100644
+ set(LINK_OR_COPY copy)
+ endif()
+
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
message(STATUS "Creating ${name}")

View File

@ -109,6 +109,11 @@ if CONFIG["ENABLE_CLANG_PLUGIN_ALPHA"]:
# variable to limit ourselves to what we need to build the clang plugin.
if CONFIG["HOST_OS_ARCH"] == "WINNT":
extra_cxxflags = ["-GR-", "-EHsc"]
# Clang 14 headers enforce a requirement upon Visual Studio 2019 headers,
# for support of newer C++ versions, which is necessary for clang itself,
# but as of writing, it's not necessary for the plugin code, so enable
# the escape hatch, at least until we generally upgrade to VS 2019.
HOST_DEFINES["LLVM_FORCE_USE_OLD_TOOLCHAIN"] = True
else:
extra_cxxflags = ["-fno-rtti", "-fno-exceptions"]

View File

@ -352,12 +352,12 @@ clang-5.0:
repo: https://github.com/llvm/llvm-project
revision: 6a075b6de4cafebec9ca1ff9eec7229a617c93f6
clang-13:
description: clang 13.0.1 source code
clang-14:
description: clang 14.0.0 source code + libc++ fixes
fetch:
type: git
repo: https://github.com/llvm/llvm-project
revision: 75e33f71c2dae584b13a7d1186ae0a038ba98838
revision: 3f43d803382d57e3fc010ca19833077d1023e9c9
clang-trunk:
description: clang main branch source code

View File

@ -23,7 +23,7 @@ job-defaults:
- 'build/build-clang/build-clang.py'
fetches:
fetch:
- clang-13
- clang-14
linux64-clang-tidy:
index:
@ -40,7 +40,7 @@ linux64-clang-tidy:
- trunk
fetches:
toolchain:
- linux64-clang-13
- linux64-clang-14
- linux64-toolchain-sysroot
macosx64-clang-tidy:
@ -60,7 +60,7 @@ macosx64-clang-tidy:
fetches:
toolchain:
- linux64-cctools-port
- linux64-clang-13
- linux64-clang-14
- macosx64-sdk-11.0
macosx64-arch64-clang-tidy:
@ -83,7 +83,7 @@ macosx64-arch64-clang-tidy:
fetches:
toolchain:
- linux64-cctools-port
- linux64-clang-13
- linux64-clang-14
- macosx64-sdk-11.0
win64-clang-tidy:
@ -109,7 +109,7 @@ win64-clang-tidy:
- cmake
- ninja
toolchain:
- win64-vs2017
- win64-vs2019
linux64-clang-tidy-external:
attributes:
@ -135,5 +135,5 @@ linux64-clang-tidy-external:
fetch:
- civet-source
toolchain:
- linux64-clang-13
- linux64-clang-14
- linux64-toolchain-sysroot

View File

@ -32,8 +32,8 @@ linux64-clang-5.0:
toolchain:
- linux64-toolchain-sysroot
linux64-clang-13-mingw-x86:
description: "MinGW-Clang 13 x86 toolchain build"
linux64-clang-14-mingw-x86:
description: "MinGW-Clang 14 x86 toolchain build"
treeherder:
symbol: TMW(clang-x86)
worker-type: b-linux
@ -45,16 +45,16 @@ linux64-clang-13-mingw-x86:
toolchain-artifact: public/build/clangmingw.tar.zst
fetches:
fetch:
- clang-13
- clang-14
- mingw-w64
- libunwind
- llvm-mingw
- gcc-9.3.0
toolchain:
- linux64-clang-13
- linux64-clang-14
linux64-clang-13-mingw-x64:
description: "MinGW-Clang 13 x64 toolchain build"
linux64-clang-14-mingw-x64:
description: "MinGW-Clang 14 x64 toolchain build"
treeherder:
symbol: TMW(clang-x64)
tier: 1
@ -67,96 +67,96 @@ linux64-clang-13-mingw-x64:
toolchain-artifact: public/build/clangmingw.tar.zst
fetches:
fetch:
- clang-13
- clang-14
- mingw-w64
- libunwind
- llvm-mingw
- gcc-9.3.0
toolchain:
- linux64-clang-13
- linux64-clang-14
linux64-clang-13-stage1:
description: "Clang 13 toolchain build"
linux64-clang-14-stage1:
description: "Clang 14 toolchain build"
treeherder:
symbol: TL(clang13-stage1)
symbol: TL(clang14-stage1)
run-on-projects: [trunk]
run:
using: toolchain-script
script: build-clang.sh
arguments:
- 'build/build-clang/linux64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/1stage.json'
resources:
- 'build/build-clang/linux64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/1stage.json'
toolchain-alias:
- linux64-clang-toolchain
toolchain-artifact: public/build/clang.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-toolchain-sysroot
linux64-clang-13-profile:
description: "Clang 13 toolchain build"
linux64-clang-14-profile:
description: "Clang 14 toolchain build"
treeherder:
symbol: TL(clang13-profile)
symbol: TL(clang14-profile)
run:
using: toolchain-script
script: build-clang.sh
arguments:
- 'build/build-clang/linux64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-stage-1.json'
- 'build/build-clang/profile.json'
resources:
- 'build/build-clang/linux64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-stage-1.json'
- 'build/build-clang/profile.json'
toolchain-artifact: public/build/merged.profdata
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-x64-compiler-rt-13
- linux64-clang-14-stage1
- linux64-x64-compiler-rt-14
- linux64-toolchain-sysroot
linux64-clang-13-raw:
description: "Clang 13 toolchain build"
linux64-clang-14-raw:
description: "Clang 14 toolchain build"
treeherder:
symbol: TL(clang13-raw)
symbol: TL(clang14-raw)
run:
script: build-clang.sh
arguments:
- 'build/build-clang/linux64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-3-stages.json'
- 'build/build-clang/4stages-pgo.json'
resources:
- 'build/build-clang/linux64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-3-stages.json'
- 'build/build-clang/4stages-pgo.json'
toolchain-artifact: public/build/clang.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-13-profile
- linux64-clang-14-stage1
- linux64-clang-14-profile
- linux64-toolchain-sysroot
linux64-clang-13:
description: "Clang 13 toolchain build"
linux64-clang-14:
description: "Clang 14 toolchain build"
attributes:
local-toolchain: true
treeherder:
symbol: TL(clang13)
symbol: TL(clang14)
worker-type: b-linux
worker:
max-run-time: 600
@ -169,24 +169,24 @@ linux64-clang-13:
fetches:
toolchain:
- linux64-cctools-port
- linux64-clang-13-raw
- android-aarch64-compiler-rt-13
- android-arm-compiler-rt-13
- android-x64-compiler-rt-13
- android-x86-compiler-rt-13
- linux64-aarch64-compiler-rt-13
- linux64-x64-compiler-rt-13
- linux64-x86-compiler-rt-13
- macosx64-aarch64-compiler-rt-13
- macosx64-x64-compiler-rt-13
- wasm32-wasi-compiler-rt-13
- win32-compiler-rt-13
- win64-compiler-rt-13
- linux64-clang-14-raw
- android-aarch64-compiler-rt-14
- android-arm-compiler-rt-14
- android-x64-compiler-rt-14
- android-x86-compiler-rt-14
- linux64-aarch64-compiler-rt-14
- linux64-x64-compiler-rt-14
- linux64-x86-compiler-rt-14
- macosx64-aarch64-compiler-rt-14
- macosx64-x64-compiler-rt-14
- wasm32-wasi-compiler-rt-14
- win32-compiler-rt-14
- win64-compiler-rt-14
macosx64-clang-13-raw:
description: "Clang 13 toolchain build"
macosx64-clang-14-raw:
description: "Clang 14 toolchain build"
treeherder:
symbol: TM(clang-13-raw)
symbol: TM(clang-14-raw)
worker-type: b-linux-large
worker:
max-run-time: 3600
@ -194,31 +194,31 @@ macosx64-clang-13-raw:
script: build-clang.sh
arguments:
- 'build/build-clang/macosx64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-3-stages.json'
- 'build/build-clang/4stages-pgo.json'
resources:
- 'build/build-clang/macosx64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-3-stages.json'
- 'build/build-clang/4stages-pgo.json'
toolchain-artifact: public/build/clang.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-cctools-port
- linux64-clang-13-stage1
- linux64-clang-13-profile
- linux64-clang-14-stage1
- linux64-clang-14-profile
- macosx64-sdk-11.0
- macosx64-x64-compiler-rt-13
- macosx64-x64-compiler-rt-14
macosx64-clang-13:
description: "Clang 13 toolchain repack with MacOS Compiler RT libs"
macosx64-clang-14:
description: "Clang 14 toolchain repack with MacOS Compiler RT libs"
attributes:
local-toolchain: true
treeherder:
symbol: TM(clang-13)
symbol: TM(clang-14)
worker-type: b-linux
worker:
max-run-time: 600
@ -233,24 +233,24 @@ macosx64-clang-13:
fetches:
toolchain:
- linux64-cctools-port
- macosx64-clang-13-raw
- android-aarch64-compiler-rt-13
- android-arm-compiler-rt-13
- android-x64-compiler-rt-13
- android-x86-compiler-rt-13
- linux64-aarch64-compiler-rt-13
- linux64-x64-compiler-rt-13
- linux64-x86-compiler-rt-13
- macosx64-aarch64-compiler-rt-13
- macosx64-x64-compiler-rt-13
- wasm32-wasi-compiler-rt-13
- win32-compiler-rt-13
- win64-compiler-rt-13
- macosx64-clang-14-raw
- android-aarch64-compiler-rt-14
- android-arm-compiler-rt-14
- android-x64-compiler-rt-14
- android-x86-compiler-rt-14
- linux64-aarch64-compiler-rt-14
- linux64-x64-compiler-rt-14
- linux64-x86-compiler-rt-14
- macosx64-aarch64-compiler-rt-14
- macosx64-x64-compiler-rt-14
- wasm32-wasi-compiler-rt-14
- win32-compiler-rt-14
- win64-compiler-rt-14
macosx64-aarch64-clang-13-raw:
description: "Clang 13 toolchain build"
macosx64-aarch64-clang-14-raw:
description: "Clang 14 toolchain build"
treeherder:
symbol: TM(clang-13-aarch64-raw)
symbol: TM(clang-14-aarch64-raw)
worker-type: b-linux-large
worker:
env:
@ -260,31 +260,31 @@ macosx64-aarch64-clang-13-raw:
script: build-clang.sh
arguments:
- 'build/build-clang/macosx64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-3-stages.json'
- 'build/build-clang/4stages-pgo.json'
resources:
- 'build/build-clang/macosx64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-3-stages.json'
- 'build/build-clang/4stages-pgo.json'
toolchain-artifact: public/build/clang.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-cctools-port
- linux64-clang-13-stage1
- linux64-clang-13-profile
- linux64-clang-14-stage1
- linux64-clang-14-profile
- macosx64-sdk-11.0
- macosx64-aarch64-compiler-rt-13
- macosx64-aarch64-compiler-rt-14
macosx64-aarch64-clang-13:
description: "Clang 13 toolchain repack with MacOS Compiler RT libs"
macosx64-aarch64-clang-14:
description: "Clang 14 toolchain repack with MacOS Compiler RT libs"
attributes:
local-toolchain: true
treeherder:
symbol: TM(clang-13-aarch64)
symbol: TM(clang-14-aarch64)
worker-type: b-linux
worker:
max-run-time: 600
@ -297,15 +297,15 @@ macosx64-aarch64-clang-13:
fetches:
toolchain:
- linux64-cctools-port
- macosx64-aarch64-clang-13-raw
- macosx64-aarch64-compiler-rt-13
- macosx64-x64-compiler-rt-13
- wasm32-wasi-compiler-rt-13
- macosx64-aarch64-clang-14-raw
- macosx64-aarch64-compiler-rt-14
- macosx64-x64-compiler-rt-14
- wasm32-wasi-compiler-rt-14
win64-clang-13-raw:
description: "Clang-cl 13 toolchain build"
win64-clang-14-raw:
description: "Clang-cl 14 toolchain build"
treeherder:
symbol: TW64(clang-13-raw)
symbol: TW64(clang-14-raw)
worker-type: b-win2012
worker:
max-run-time: 9000
@ -313,31 +313,31 @@ win64-clang-13-raw:
script: build-clang.sh
arguments:
- 'build/build-clang/win64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-stage-1-win64.json'
- 'build/build-clang/4stages-pgo.json'
resources:
- 'build/build-clang/win64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/skip-stage-1-win64.json'
- 'build/build-clang/4stages-pgo.json'
toolchain-artifact: public/build/clang.tar.zst
fetches:
fetch:
- clang-13
- clang-14
- cmake
- ninja
toolchain:
- win64-clang-13-stage1
- win64-compiler-rt-13
- win64-vs2017
- win64-clang-14-stage1
- win64-compiler-rt-14
- win64-vs2019
win64-clang-13:
description: "Clang-cl 13 toolchain build"
win64-clang-14:
description: "Clang-cl 14 toolchain build"
attributes:
local-toolchain: true
treeherder:
symbol: TW64(clang-13)
symbol: TW64(clang-14)
worker-type: b-linux
worker:
max-run-time: 600
@ -350,44 +350,44 @@ win64-clang-13:
fetches:
toolchain:
- linux64-cctools-port
- win64-clang-13-raw
- android-aarch64-compiler-rt-13
- android-arm-compiler-rt-13
- android-x64-compiler-rt-13
- android-x86-compiler-rt-13
- linux64-aarch64-compiler-rt-13
- linux64-x64-compiler-rt-13
- linux64-x86-compiler-rt-13
- macosx64-aarch64-compiler-rt-13
- macosx64-x64-compiler-rt-13
- wasm32-wasi-compiler-rt-13
- win32-compiler-rt-13
- win64-compiler-rt-13
- win64-clang-14-raw
- android-aarch64-compiler-rt-14
- android-arm-compiler-rt-14
- android-x64-compiler-rt-14
- android-x86-compiler-rt-14
- linux64-aarch64-compiler-rt-14
- linux64-x64-compiler-rt-14
- linux64-x86-compiler-rt-14
- macosx64-aarch64-compiler-rt-14
- macosx64-x64-compiler-rt-14
- wasm32-wasi-compiler-rt-14
- win32-compiler-rt-14
- win64-compiler-rt-14
win64-clang-13-stage1:
description: "Clang-cl 13 toolchain build stage 1"
win64-clang-14-stage1:
description: "Clang-cl 14 toolchain build stage 1"
treeherder:
symbol: TW64(clang-13-stage1)
symbol: TW64(clang-14-stage1)
worker-type: b-win2012
run:
script: build-clang.sh
arguments:
- 'build/build-clang/win64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/1stage.json'
resources:
- 'build/build-clang/win64.json'
- 'build/build-clang/clang-13.json'
- 'build/build-clang/clang-14.json'
- 'build/build-clang/1stage.json'
toolchain-alias: win64-clang-toolchain
toolchain-artifact: public/build/clang.tar.zst
fetches:
fetch:
- clang-13
- clang-14
- cmake
- ninja
toolchain:
- win64-vs2017
- win64-vs2019
linux64-clang-trunk-raw:
description: "Clang trunk toolchain build"

View File

@ -10,210 +10,210 @@ job-defaults:
using: toolchain-script
script: build-compiler-rt.sh
android-aarch64-compiler-rt-13:
description: "android aarch64 Compiler-rt for Clang 13 toolchain build"
android-aarch64-compiler-rt-14:
description: "android aarch64 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TA(aarch64-crt-13)
symbol: TA(aarch64-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-aarch64-linux-android.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- linux64-android-ndk-linux-repack
android-arm-compiler-rt-13:
description: "android arm Compiler-rt for Clang 13 toolchain build"
android-arm-compiler-rt-14:
description: "android arm Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TA(arm-crt-13)
symbol: TA(arm-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-armv7-linux-android.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- linux64-android-ndk-linux-repack
android-x86-compiler-rt-13:
description: "android x86 Compiler-rt for Clang 13 toolchain build"
android-x86-compiler-rt-14:
description: "android x86 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TA(x86-crt-13)
symbol: TA(x86-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-i686-linux-android.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- linux64-android-ndk-linux-repack
android-x64-compiler-rt-13:
description: "android x64 Compiler-rt for Clang 13 toolchain build"
android-x64-compiler-rt-14:
description: "android x64 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TA(x64-crt-13)
symbol: TA(x64-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-x86_64-linux-android.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- linux64-android-ndk-linux-repack
linux64-x86-compiler-rt-13:
description: "Linux x86 Compiler-rt for Clang 13 toolchain build"
linux64-x86-compiler-rt-14:
description: "Linux x86 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TL(x86-crt-13)
symbol: TL(x86-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-i686-unknown-linux-gnu.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- sysroot-i686-linux-gnu
linux64-x64-compiler-rt-13:
description: "Linux x64 Compiler-rt for Clang 13 toolchain build"
linux64-x64-compiler-rt-14:
description: "Linux x64 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TL(x64-crt-13)
symbol: TL(x64-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-x86_64-unknown-linux-gnu.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- sysroot-x86_64-linux-gnu
linux64-aarch64-compiler-rt-13:
description: "Linux aarch64 Compiler-rt for Clang 13 toolchain build"
linux64-aarch64-compiler-rt-14:
description: "Linux aarch64 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TL(aarch64-crt-13)
symbol: TL(aarch64-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-aarch64-unknown-linux-gnu.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- sysroot-aarch64-linux-gnu
macosx64-x64-compiler-rt-13:
description: "macOS x64 Compiler-rt for Clang 13 toolchain build"
macosx64-x64-compiler-rt-14:
description: "macOS x64 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TM(x64-crt-13)
symbol: TM(x64-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-x86_64-apple-darwin.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- macosx64-sdk-11.0
macosx64-aarch64-compiler-rt-13:
description: "macOS aarch64 Compiler-rt for Clang 13 toolchain build"
macosx64-aarch64-compiler-rt-14:
description: "macOS aarch64 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TM(aarch64-crt-13)
symbol: TM(aarch64-crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-aarch64-apple-darwin.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- macosx64-sdk-11.0
win32-compiler-rt-13:
description: "win32 x86 Compiler-rt for Clang 13 toolchain build"
win32-compiler-rt-14:
description: "win32 x86 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TW32(crt-13)
symbol: TW32(crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-i686-pc-windows-msvc.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- linux64-liblowercase
- win64-vs2017
- win64-vs2019
win64-compiler-rt-13:
description: "win64 x64 Compiler-rt for Clang 13 toolchain build"
win64-compiler-rt-14:
description: "win64 x64 Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TW64(crt-13)
symbol: TW64(crt-14)
run:
arguments:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
toolchain-artifact: public/build/compiler-rt-x86_64-pc-windows-msvc.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
- linux64-liblowercase
- win64-vs2017
- win64-vs2019
wasm32-wasi-compiler-rt-13:
description: "wasm32-wasi Compiler-rt for Clang 13 toolchain build"
wasm32-wasi-compiler-rt-14:
description: "wasm32-wasi Compiler-rt for Clang 14 toolchain build"
treeherder:
symbol: TL(wasi-crt-13)
symbol: TL(wasi-crt-14)
worker-type: b-linux-xlarge
run:
script: build-compiler-rt-wasi.sh
@ -221,7 +221,7 @@ wasm32-wasi-compiler-rt-13:
toolchain-alias: wasm32-wasi-compiler-rt
fetches:
fetch:
- clang-13
- clang-14
- wasi-sdk
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1

View File

@ -11,9 +11,9 @@ job-defaults:
toolchain-artifact: public/build/llvm-symbolizer.tar.zst
fetches:
fetch:
- clang-13
- clang-14
toolchain:
- linux64-clang-13-stage1
- linux64-clang-14-stage1
linux64-llvm-symbolizer:
description: "llvm-symbolizer for Linux"
@ -22,9 +22,9 @@ linux64-llvm-symbolizer:
run:
arguments:
- x86_64-unknown-linux-gnu
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
fetches:
toolchain:
@ -37,9 +37,9 @@ macosx64-llvm-symbolizer:
run:
arguments:
- x86_64-apple-darwin
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
fetches:
toolchain:
@ -52,11 +52,11 @@ win64-llvm-symbolizer:
run:
arguments:
- x86_64-pc-windows-msvc
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
resources:
- build/build-clang/clang-13.json
- build/build-clang/clang-14.json
- taskcluster/scripts/misc/build-llvm-common.sh
fetches:
toolchain:
- linux64-liblowercase
- win64-vs2017
- win64-vs2019

View File

@ -75,10 +75,10 @@ sysroot-wasm32-wasi:
toolchain-artifact: public/build/sysroot-wasm32-wasi.tar.zst
fetches:
fetch:
- clang-13
- clang-14
- wasi-sdk
toolchain:
- linux64-clang-13
- linux64-clang-14
sysroot-aarch64-linux-gnu:
description: "Sysroot for linux64 aarch64 builds"

View File

@ -107,15 +107,15 @@ jobs:
name: public/build/wrench-macos-headless.tar.bz2
path: /builds/worker/artifacts/wrench-macos-headless.tar.bz2
dependencies:
macosx64-clang-13: toolchain-macosx64-clang-13
macosx64-clang-14: toolchain-macosx64-clang-14
fetches:
toolchain:
- linux64-rust-macos
- linux64-cctools-port
- linux64-clang-13
- linux64-clang-14
- macosx64-sdk-10.12
- wrench-deps
macosx64-clang-13:
macosx64-clang-14:
- artifact: clang.tar.zst
dest: clang-mac
run:

View File

@ -7,6 +7,34 @@ dir=${artifact%.tar.*}
cd $MOZ_FETCHES_DIR/wasi-sdk
LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project
# Apply patch from https://github.com/WebAssembly/wasi-libc/pull/265
patch -p1 <<'EOF'
diff --git a/src/wasi-libc/Makefile b/src/wasi-libc/Makefile
index f597985..1bec3ae 100644
--- a/src/wasi-libc/Makefile
+++ b/src/wasi-libc/Makefile
@@ -530,6 +530,7 @@ check-symbols: startup_files libc
@#
@# TODO: Undefine __FLOAT128__ for now since it's not in clang 8.0.
@# TODO: Filter out __FLT16_* for now, as not all versions of clang have these.
+ @# TODO: Filter out __NO_MATH_ERRNO_ and a few __*WIDTH__ that are new to clang 14.
$(WASM_CC) $(CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \
-isystem $(SYSROOT_INC) \
-std=gnu17 \
@@ -548,8 +549,11 @@ check-symbols: startup_files libc
-U__GNUC_PATCHLEVEL__ \
-U__VERSION__ \
-U__FLOAT128__ \
+ -U__NO_MATH_ERRNO__ \
+ -U__BITINT_MAXWIDTH__ \
| sed -e 's/__[[:upper:][:digit:]]*_ATOMIC_\([[:upper:][:digit:]_]*\)_LOCK_FREE/__compiler_ATOMIC_\1_LOCK_FREE/' \
| grep -v '^#define __FLT16_' \
+ | grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \
> "$(SYSROOT_SHARE)/predefined-macros.txt"
# Check that the computed metadata matches the expected metadata.
EOF
mkdir -p build/install/wasi
# The wasi-sdk build system wants to build clang itself. We trick it into
# thinking it did, and put our own clang where it would have built its own.

View File

@ -129,9 +129,9 @@ case "$target" in
$EXTRA_CMAKE_FLAGS
-DCMAKE_TOOLCHAIN_FILE=$MOZ_FETCHES_DIR/llvm-project/llvm/cmake/platforms/WinMsvc.cmake
-DLLVM_NATIVE_TOOLCHAIN=$MOZ_FETCHES_DIR/clang
-DMSVC_BASE=$MOZ_FETCHES_DIR/vs/vc/tools/msvc/14.16.27023
-DMSVC_BASE=$MOZ_FETCHES_DIR/vs/vc/tools/msvc/14.29.30133
-DWINSDK_BASE=$MOZ_FETCHES_DIR/vs/sdk
-DWINSDK_VER=10.0.17134.0
-DWINSDK_VER=10.0.19041.0
-DHOST_ARCH=${target%-pc-windows-msvc}
"
;;

View File

@ -7,6 +7,34 @@ sysroot=${artifact%.tar.*}
cd $MOZ_FETCHES_DIR/wasi-sdk
LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project
# Apply patch from https://github.com/WebAssembly/wasi-libc/pull/265
patch -p1 <<'EOF'
diff --git a/src/wasi-libc/Makefile b/src/wasi-libc/Makefile
index f597985..1bec3ae 100644
--- a/src/wasi-libc/Makefile
+++ b/src/wasi-libc/Makefile
@@ -530,6 +530,7 @@ check-symbols: startup_files libc
@#
@# TODO: Undefine __FLOAT128__ for now since it's not in clang 8.0.
@# TODO: Filter out __FLT16_* for now, as not all versions of clang have these.
+ @# TODO: Filter out __NO_MATH_ERRNO_ and a few __*WIDTH__ that are new to clang 14.
$(WASM_CC) $(CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \
-isystem $(SYSROOT_INC) \
-std=gnu17 \
@@ -548,8 +549,11 @@ check-symbols: startup_files libc
-U__GNUC_PATCHLEVEL__ \
-U__VERSION__ \
-U__FLOAT128__ \
+ -U__NO_MATH_ERRNO__ \
+ -U__BITINT_MAXWIDTH__ \
| sed -e 's/__[[:upper:][:digit:]]*_ATOMIC_\([[:upper:][:digit:]_]*\)_LOCK_FREE/__compiler_ATOMIC_\1_LOCK_FREE/' \
| grep -v '^#define __FLT16_' \
+ | grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \
> "$(SYSROOT_SHARE)/predefined-macros.txt"
# Check that the computed metadata matches the expected metadata.
EOF
mkdir -p build/install/wasi
# The wasi-sdk build system wants to build clang itself. We trick it into
# thinking it did, and put our own clang where it would have built its own.

View File

@ -2,8 +2,14 @@ VSDIR=vs
VSPATH="${MOZ_FETCHES_DIR}/${VSDIR}"
UNIX_VSPATH="$(cd ${MOZ_FETCHES_DIR} && pwd)/${VSDIR}"
VCDIR=vc/tools/msvc/14.16.27023
if [ ! -d "${VSPATH}/${VCDIR}" ]; then
VCDIR=vc/tools/msvc/14.29.30133
fi
SDKDIR="windows kits/10"
SDK_VERSION=10.0.17134.0
if [ ! -d "${VSPATH}/${SDKDIR}/lib/${SDK_VERSION}" ]; then
SDK_VERSION=10.0.19041.0
fi
export INCLUDE="${VSPATH}/${VCDIR}/include;${VSPATH}/${VCDIR}/atlmfc/include;${VSPATH}/${SDKDIR}/include/${SDK_VERSION}/ucrt;${VSPATH}/${SDKDIR}/include/${SDK_VERSION}/shared;${VSPATH}/${SDKDIR}/include/${SDK_VERSION}/um;${VSPATH}/${SDKDIR}/include/${SDK_VERSION}/winrt;${VSPATH}/dia sdk/include"
export LIB="${VSPATH}/${VCDIR}/lib/x64;${VSPATH}/${VCDIR}/atlmfc/lib/x64;${VSPATH}/${SDKDIR}/lib/${SDK_VERSION}/um/x64;${VSPATH}/${SDKDIR}/lib/${SDK_VERSION}/ucrt/x64;${VSPATH}/dia sdk/lib/amd64"

View File

@ -2,8 +2,14 @@ VSDIR=vs
VSPATH="${MOZ_FETCHES_DIR}/${VSDIR}"
UNIX_VSPATH="$(cd ${MOZ_FETCHES_DIR} && pwd)/${VSDIR}"
VCDIR=vc/tools/msvc/14.16.27023
if [ ! -d "${VSPATH}/${VCDIR}" ]; then
VCDIR=vc/tools/msvc/14.29.30133
fi
SDKDIR="windows kits/10"
SDK_VERSION=10.0.17134.0
if [ ! -d "${VSPATH}/${SDKDIR}/lib/${SDK_VERSION}" ]; then
SDK_VERSION=10.0.19041.0
fi
export INCLUDE="${VSPATH}/${VCDIR}/include;${VSPATH}/${VCDIR}/atlmfc/include;${VSPATH}/${SDKDIR}/include/${SDK_VERSION}/ucrt;${VSPATH}/${SDKDIR}/include/${SDK_VERSION}/shared;${VSPATH}/${SDKDIR}/include/${SDK_VERSION}/um;${VSPATH}/${SDKDIR}/include/${SDK_VERSION}/winrt;${VSPATH}/dia sdk/include"
export LIB="${VSPATH}/${VCDIR}/lib/x86;${VSPATH}/${VCDIR}/atlmfc/lib/x86;${VSPATH}/${SDKDIR}/lib/${SDK_VERSION}/um/x86;${VSPATH}/${SDKDIR}/lib/${SDK_VERSION}/ucrt/x86;${VSPATH}/dia sdk/lib"

View File

@ -19,7 +19,7 @@ platforms:
# Minimum clang-tidy version that is required for all the following checkers
# to work properly.
# This is also used by 'mach clang-format'
package_version: "13.0.1"
package_version: "14.0.0"
clang_checkers:
- name: -*
publish: !!bool no