Page MenuHomeFreeBSD

D31316.diff
No OneTemporary

D31316.diff

diff --git a/devel/llvm12/Makefile b/devel/llvm12/Makefile
--- a/devel/llvm12/Makefile
+++ b/devel/llvm12/Makefile
@@ -1,6 +1,6 @@
PORTNAME= llvm
DISTVERSION= 12.0.1
-PORTREVISION= 0
+PORTREVISION= 1
CATEGORIES= devel lang
MASTER_SITES= https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \
https://${PRE_}releases.llvm.org/${LLVM_RELEASE}/${RCDIR}
diff --git a/devel/llvm12/files/patch-clang_lib_Driver_ToolChains_FreeBSD.cpp b/devel/llvm12/files/patch-clang_lib_Driver_ToolChains_FreeBSD.cpp
new file mode 100644
--- /dev/null
+++ b/devel/llvm12/files/patch-clang_lib_Driver_ToolChains_FreeBSD.cpp
@@ -0,0 +1,33 @@
+[Driver] Default to libc++ on FreeBSD
+
+Downstream may naively translate between DSL and LLVM target
+triple. If OS version is lost in the process then Clang would
+default to a version that's no longer supported by OS vendor.
+
+https://reviews.llvm.org/D77776
+
+--- clang/lib/Driver/ToolChains/FreeBSD.cpp.orig 2021-06-28 16:23:38 UTC
++++ clang/lib/Driver/ToolChains/FreeBSD.cpp
+@@ -466,6 +466,7 @@ bool FreeBSD::IsUnwindTablesDefault(const ArgList &Arg
+ bool FreeBSD::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); }
+
+ SanitizerMask FreeBSD::getSupportedSanitizers() const {
++ const bool IsAArch64 = getTriple().getArch() == llvm::Triple::aarch64;
+ const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
+ const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
+ const bool IsMIPS64 = getTriple().isMIPS64();
+@@ -484,8 +485,13 @@ SanitizerMask FreeBSD::getSupportedSanitizers() const
+ Res |= SanitizerKind::Fuzzer;
+ Res |= SanitizerKind::FuzzerNoLink;
+ }
+- if (IsX86_64)
++ if (IsAArch64 || IsX86_64) {
++ Res |= SanitizerKind::KernelAddress;
++ Res |= SanitizerKind::KernelMemory;
++ }
++ if (IsX86_64) {
+ Res |= SanitizerKind::Memory;
++ }
+ return Res;
+ }
+
diff --git a/devel/llvm12/files/patch-clang_test_Driver_fsanitize.c b/devel/llvm12/files/patch-clang_test_Driver_fsanitize.c
new file mode 100644
--- /dev/null
+++ b/devel/llvm12/files/patch-clang_test_Driver_fsanitize.c
@@ -0,0 +1,16 @@
+--- clang/test/Driver/fsanitize.c.orig 2021-06-28 16:23:38 UTC
++++ clang/test/Driver/fsanitize.c
+@@ -689,7 +689,13 @@
+ // RUN: %clang -target x86_64-unknown-cloudabi -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-CLOUDABI
+ // SAFESTACK-CLOUDABI: "-fsanitize=safe-stack"
+
++// RUN: %clang -target x86_64--freebsd -fsanitize=kernel-address %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-ADDRESS-FREEBSD
++// RUN: %clang -target aarch64--freebsd -fsanitize=kernel-address %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-ADDRESS-FREEBSD
++// KERNEL-ADDRESS-FREEBSD: "-fsanitize=kernel-address"
+
++// RUN: %clang -target x86_64--freebsd -fsanitize=kernel-memory %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-MEMORY-FREEBSD
++// RUN: %clang -target aarch64--freebsd -fsanitize=kernel-memory %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-MEMORY-FREEBSD
++// KERNEL-MEMORY-FREEBSD: "-fsanitize=kernel-memory"
+
+ // * NetBSD; please keep ordered as in Sanitizers.def *
+
diff --git a/devel/llvm12/files/patch-llvm_lib_Transforms_Instrumentation_AddressSanitizer.cpp b/devel/llvm12/files/patch-llvm_lib_Transforms_Instrumentation_AddressSanitizer.cpp
new file mode 100644
--- /dev/null
+++ b/devel/llvm12/files/patch-llvm_lib_Transforms_Instrumentation_AddressSanitizer.cpp
@@ -0,0 +1,26 @@
+--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp.orig 2021-06-28 16:23:38 UTC
++++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+@@ -108,6 +108,7 @@ static const uint64_t kAArch64_ShadowOffset64 = 1ULL <
+ static const uint64_t kRISCV64_ShadowOffset64 = 0x20000000;
+ static const uint64_t kFreeBSD_ShadowOffset32 = 1ULL << 30;
+ static const uint64_t kFreeBSD_ShadowOffset64 = 1ULL << 46;
++static const uint64_t kFreeBSDKasan_ShadowOffset64 = 0xdffff7c000000000;
+ static const uint64_t kNetBSD_ShadowOffset32 = 1ULL << 30;
+ static const uint64_t kNetBSD_ShadowOffset64 = 1ULL << 46;
+ static const uint64_t kNetBSDKasan_ShadowOffset64 = 0xdfff900000000000;
+@@ -484,9 +485,12 @@ static ShadowMapping getShadowMapping(Triple &TargetTr
+ Mapping.Offset = kPPC64_ShadowOffset64;
+ else if (IsSystemZ)
+ Mapping.Offset = kSystemZ_ShadowOffset64;
+- else if (IsFreeBSD && !IsMIPS64)
+- Mapping.Offset = kFreeBSD_ShadowOffset64;
+- else if (IsNetBSD) {
++ else if (IsFreeBSD && !IsMIPS64) {
++ if (IsKasan)
++ Mapping.Offset = kFreeBSDKasan_ShadowOffset64;
++ else
++ Mapping.Offset = kFreeBSD_ShadowOffset64;
++ } else if (IsNetBSD) {
+ if (IsKasan)
+ Mapping.Offset = kNetBSDKasan_ShadowOffset64;
+ else

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 16, 10:33 PM (20 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15829942
Default Alt Text
D31316.diff (4 KB)

Event Timeline