From f587789bd44d4fe0f05c2d2802a1d546896fca70 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 18 Mar 2016 13:22:48 +0000 Subject: main/clang: upgrade to 3.8.0 and move out from llvm --- ...ack-protector-by-default-for-alpine-linux.patch | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 main/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch (limited to 'main/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch') 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 +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 + -- cgit v1.2.3