diff options
author | xentec <xentec@aix0.eu> | 2017-10-23 18:27:32 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-11-14 18:42:44 +0100 |
commit | 60c32c79a11ee7715f20aeebd381299120c43eb0 (patch) | |
tree | 22de0e87cb31a859622fce93eec1afca6440a348 /main/clang/0007-Enable-stack-protector-by-default-for-Alpine-Linux.patch | |
parent | b4767fa4037857bb3393650e351e69d16a5d7e56 (diff) | |
download | aports-60c32c79a11ee7715f20aeebd381299120c43eb0.tar.bz2 aports-60c32c79a11ee7715f20aeebd381299120c43eb0.tar.xz |
main/clang: upgrade to 5.0.0
Diffstat (limited to 'main/clang/0007-Enable-stack-protector-by-default-for-Alpine-Linux.patch')
-rw-r--r-- | main/clang/0007-Enable-stack-protector-by-default-for-Alpine-Linux.patch | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/main/clang/0007-Enable-stack-protector-by-default-for-Alpine-Linux.patch b/main/clang/0007-Enable-stack-protector-by-default-for-Alpine-Linux.patch new file mode 100644 index 0000000000..38865ff15b --- /dev/null +++ b/main/clang/0007-Enable-stack-protector-by-default-for-Alpine-Linux.patch @@ -0,0 +1,100 @@ +From b329713c3249d237d1827c326c1fc065104002a6 Mon Sep 17 00:00:00 2001 +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Sun, 16 Apr 2017 16:49:00 +0100 +Subject: [PATCH 7/7] Enable stack protector by default for Alpine Linux + +--- + lib/Driver/ToolChains/Linux.cpp | 7 +++++++ + lib/Driver/ToolChains/Linux.h | 1 + + test/Driver/fsanitize.c | 10 ++++++---- + test/Driver/stack-protector.c | 14 ++++++++++++++ + 4 files changed, 28 insertions(+), 4 deletions(-) + +diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp +index 1583c9d..981f9ae 100644 +--- a/lib/Driver/ToolChains/Linux.cpp ++++ b/lib/Driver/ToolChains/Linux.cpp +@@ -829,6 +829,13 @@ bool Linux::isPIEDefault() const { + Linux::getTriple().getVendorName().compare("alpine") == 0; + } + ++unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const { ++ StringRef VendorName = Linux::getTriple().getVendorName(); ++ if (VendorName.compare("alpine") == 0) ++ return 2; ++ return 1; ++} ++ + 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 9778c18..ddd46a1 100644 +--- a/lib/Driver/ToolChains/Linux.h ++++ b/lib/Driver/ToolChains/Linux.h +@@ -36,6 +36,7 @@ public: + void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + bool isPIEDefault() const override; ++ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override; + 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 0752ef6..263485f 100644 +--- a/test/Driver/fsanitize.c ++++ b/test/Driver/fsanitize.c +@@ -491,12 +491,12 @@ + // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP + // NOSP-NOT: "-fsanitize=safe-stack" + +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP-ASAN ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN + // RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP + // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP +-// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP +-// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP ++// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP ++// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP + // 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" +@@ -506,6 +506,8 @@ + + // NO-SP-ASAN-NOT: stack-protector + // NO-SP-ASAN: "-fsanitize=address,safe-stack" ++// SP-ASAN: "-fsanitize=address,safe-stack" ++// SP-ASAN: -stack-protector + // NO-SP-ASAN-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 6769b65..553c189 100644 +--- a/test/Driver/stack-protector.c ++++ b/test/Driver/stack-protector.c +@@ -24,6 +24,20 @@ + // SSP-ALL: "-stack-protector" "3" + // SSP-ALL-NOT: "-stack-protector-buffer-size" + ++// RUN: %clang -target x86_64-alpine-linux-musl -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE ++// ALPINE: "-stack-protector" "2" ++ ++// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_SPS ++// ALPINE_SPS: "-stack-protector" "2" ++ ++// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_ALL ++// ALPINE_ALL: "-stack-protector" "3" ++// ALPINE_ALL-NOT: "-stack-protector-buffer-size" ++ ++// RUN: %clang -target x86_64-alpine-linux-musl -fno-stack-protector -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_NOSSP ++// ALPINE_NOSSP-NOT: "-stack-protector" ++// ALPINE_NOSSP-NOT: "-stack-protector-buffer-size" ++ + // RUN: %clang -target x86_64-scei-ps4 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4 + // RUN: %clang -target x86_64-scei-ps4 -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4 + // SSP-PS4: "-stack-protector" "2" +-- +2.14.1 + |