aboutsummaryrefslogtreecommitdiffstats
path: root/devel/llvm12/files/patch-clang_lib_Driver_ToolChains_FreeBSD.cpp
blob: 4c13ad977b21090ab16370a2a92334f57e6aa8fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
 }