From 7442499990b44130ad9de911808161177b214322 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Wed, 7 Mar 2018 15:21:48 -0600 Subject: system/clang: yay, a non-GCC compiler --- ...ack-protector-by-default-for-alpine-linux.patch | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 system/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch (limited to 'system/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch') diff --git a/system/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch b/system/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch new file mode 100644 index 000000000..3487799b1 --- /dev/null +++ b/system/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch @@ -0,0 +1,54 @@ +From: Natanael Copa +From: Jakub Jirutka +Date: Sun, 16 Apr 2017 16:49:00 +0100 +Subject: [PATCH] Enable stack protector by default for Alpine Linux + +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -4866,6 +4866,13 @@ + CmdArgs.push_back("-lunwind"); + } + ++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, +--- a/lib/Driver/ToolChains.h ++++ b/lib/Driver/ToolChains.h +@@ -880,6 +880,7 @@ + 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; +--- 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" -- cgit v1.2.3-70-g09d2