diff options
Diffstat (limited to 'main/clang/20-Enable-stack-protector-by-default-for-Alpine-Linux.patch')
-rw-r--r-- | main/clang/20-Enable-stack-protector-by-default-for-Alpine-Linux.patch | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/main/clang/20-Enable-stack-protector-by-default-for-Alpine-Linux.patch b/main/clang/20-Enable-stack-protector-by-default-for-Alpine-Linux.patch index 795daf35f0..d545a5aff8 100644 --- a/main/clang/20-Enable-stack-protector-by-default-for-Alpine-Linux.patch +++ b/main/clang/20-Enable-stack-protector-by-default-for-Alpine-Linux.patch @@ -1,9 +1,12 @@ Based on original patchset from Jakub Jirutka <jakub@jirutka.cz> Updated by Eric Molitor <eric@molitor.org> +Updated by Natanael Copa <ncopa@alpinelinux.org> +diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp +index f8f3623..9c8c748 100644 --- a/lib/Driver/ToolChains/Linux.cpp +++ b/lib/Driver/ToolChains/Linux.cpp -@@ -907,6 +907,13 @@ +@@ -907,6 +907,13 @@ bool Linux::isPIEDefault() const { getTriple().isMusl() || getSanitizerArgs().requiresPIE(); } @@ -11,15 +14,17 @@ Updated by Eric Molitor <eric@molitor.org> + StringRef VendorName = Linux::getTriple().getVendorName(); + if (VendorName.compare("alpine") == 0) + return 2; -+ return 1; ++ return Generic_ELF::GetDefaultStackProtectorLevel(KernelOrKext); +} + SanitizerMask Linux::getSupportedSanitizers() const { const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; +diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h +index 22dbbec..ba0d558 100644 --- a/lib/Driver/ToolChains/Linux.h +++ b/lib/Driver/ToolChains/Linux.h -@@ -38,6 +38,7 @@ +@@ -38,6 +38,7 @@ public: void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; bool isPIEDefault() const override; @@ -27,9 +32,11 @@ Updated by Eric Molitor <eric@molitor.org> SanitizerMask getSupportedSanitizers() const override; void addProfileRTLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const override; +diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c +index 304e759..29ead22 100644 --- a/test/Driver/fsanitize.c +++ b/test/Driver/fsanitize.c -@@ -585,12 +585,12 @@ +@@ -585,18 +585,17 @@ // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP // NOSP-NOT: "-fsanitize=safe-stack" @@ -45,6 +52,14 @@ Updated by Eric Molitor <eric@molitor.org> // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP // NO-SP-NOT: stack-protector // NO-SP: "-fsanitize=safe-stack" + // SP-ASAN: error: invalid argument '-fsanitize=safe-stack' not allowed with '-fsanitize=address' + // SP: "-fsanitize=safe-stack" +-// SP: -stack-protector + // NO-SP-NOT: stack-protector + + // RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM +diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c +index a3e40b5..60ec2a8 100644 --- a/test/Driver/stack-protector.c +++ b/test/Driver/stack-protector.c @@ -24,6 +24,20 @@ |