diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-03-07 15:21:48 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-03-07 15:21:48 -0600 |
commit | 7442499990b44130ad9de911808161177b214322 (patch) | |
tree | e0f9588b2552682e1176322fe19b6d15b67e9c47 /system/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch | |
parent | 00f714f7a538159c8a821e1872c1d39d75cbf144 (diff) | |
download | packages-7442499990b44130ad9de911808161177b214322.tar.gz packages-7442499990b44130ad9de911808161177b214322.tar.bz2 packages-7442499990b44130ad9de911808161177b214322.tar.xz packages-7442499990b44130ad9de911808161177b214322.zip |
system/clang: yay, a non-GCC compiler
Diffstat (limited to 'system/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch')
-rw-r--r-- | system/clang/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch | 54 |
1 files changed, 54 insertions, 0 deletions
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 <ncopa@alpinelinux.org> +From: Jakub Jirutka <jakub@jirutka.cz> +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" |