diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2016-03-18 13:22:48 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-03-22 10:21:07 +0000 |
commit | f587789bd44d4fe0f05c2d2802a1d546896fca70 (patch) | |
tree | ae9ffeb64aebae70744a09d6b99c2e7c905e724c /main/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch | |
parent | 6025d33a147333d0ad8fcfbd2b5d84fee00de11b (diff) | |
download | aports-f587789bd44d4fe0f05c2d2802a1d546896fca70.tar.bz2 aports-f587789bd44d4fe0f05c2d2802a1d546896fca70.tar.xz |
main/clang: upgrade to 3.8.0 and move out from llvm
Diffstat (limited to 'main/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch')
-rw-r--r-- | main/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/main/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch b/main/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch new file mode 100644 index 0000000000..a4cb926181 --- /dev/null +++ b/main/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch @@ -0,0 +1,69 @@ +From da8ea517105fff702f936695dcfae844ac85260d Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Tue, 23 Feb 2016 10:16:54 +0000 +Subject: [PATCH 7/7] Enable stack protector by default for alpine linux + +--- + lib/Driver/ToolChains.cpp | 7 +++++++ + lib/Driver/ToolChains.h | 1 + + test/Driver/stack-protector.c | 14 ++++++++++++++ + 3 files changed, 22 insertions(+) + +diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp +index 1a8ebf5..59b7601 100644 +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -4193,6 +4193,13 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args, + ToolChain::addProfileRTLibs(Args, CmdArgs); + } + ++unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const { ++ StringRef VendorName = Linux::getTriple().getVendorName(); ++ if (VendorName.compare("alpine") == 0) ++ return 2; ++ return 1; ++} ++ + /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly. + + DragonFly::DragonFly(const Driver &D, const llvm::Triple &Triple, +diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h +index f940e58..977ea66 100644 +--- a/lib/Driver/ToolChains.h ++++ b/lib/Driver/ToolChains.h +@@ -796,6 +796,7 @@ public: + void AddCudaIncludeArgs(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/stack-protector.c b/test/Driver/stack-protector.c +index 487af56..2fbd39a 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.7.3 + |