diff options
Diffstat (limited to 'recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch')
-rw-r--r-- | recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch b/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch deleted file mode 100644 index d5795d6..0000000 --- a/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | From 421fd7dbd379d6d2d89ee58527eca10da8cc643c Mon Sep 17 00:00:00 2001 | ||
2 | From: Evangelos Foutras <evangelos@foutrelis.com> | ||
3 | Date: Thu, 20 Sep 2018 06:20:28 +0300 | ||
4 | Subject: [PATCH] clang: Enable SSP and PIE by default | ||
5 | |||
6 | This is a minimal set of changes needed to make clang use SSP and PIE by | ||
7 | default on Arch Linux. Tests that were easy to adjust have been changed | ||
8 | accordingly; only test/Driver/linux-ld.c has been marked as "expected | ||
9 | failure" due to the number of changes it would require (mostly replacing | ||
10 | crtbegin.o with crtbeginS.o). | ||
11 | |||
12 | Doing so is needed in order to align clang with the new default GCC | ||
13 | behavior in Arch which generates PIE executables by default and also | ||
14 | defaults to -fstack-protector-strong. It is not meant to be a long term | ||
15 | solution, but a simple temporary fix. | ||
16 | |||
17 | Hopefully these changes will be obsoleted by the introduction upstream | ||
18 | of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410) | ||
19 | --- | ||
20 | clang/lib/Driver/ToolChains/Linux.cpp | 14 ++++++++++++-- | ||
21 | clang/lib/Driver/ToolChains/Linux.h | 1 + | ||
22 | 2 files changed, 13 insertions(+), 2 deletions(-) | ||
23 | |||
24 | diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp | ||
25 | index 7f59bc77f52..ed907549929 100644 | ||
26 | --- a/clang/lib/Driver/ToolChains/Linux.cpp | ||
27 | +++ b/clang/lib/Driver/ToolChains/Linux.cpp | ||
28 | @@ -975,8 +975,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs, | ||
29 | } | ||
30 | |||
31 | bool Linux::isPIEDefault() const { | ||
32 | - return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) || | ||
33 | - getTriple().isMusl() || getSanitizerArgs().requiresPIE(); | ||
34 | + const bool IsMips = getTriple().isMIPS(); | ||
35 | + const bool IsAndroid = getTriple().isAndroid(); | ||
36 | + | ||
37 | + if (IsMips || IsAndroid) | ||
38 | + return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) || | ||
39 | + getTriple().isMusl() || getSanitizerArgs().requiresPIE(); | ||
40 | + | ||
41 | + return true; | ||
42 | +} | ||
43 | + | ||
44 | +unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const { | ||
45 | + return 2; | ||
46 | } | ||
47 | |||
48 | bool Linux::isNoExecStackDefault() const { | ||
49 | diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h | ||
50 | index 4c61994691c..66134a3a327 100644 | ||
51 | --- a/clang/lib/Driver/ToolChains/Linux.h | ||
52 | +++ b/clang/lib/Driver/ToolChains/Linux.h | ||
53 | @@ -39,6 +39,7 @@ public: | ||
54 | CXXStdlibType GetDefaultCXXStdlibType() const override; | ||
55 | bool isPIEDefault() const override; | ||
56 | bool isNoExecStackDefault() const override; | ||
57 | + unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override; | ||
58 | bool IsMathErrnoDefault() const override; | ||
59 | SanitizerMask getSupportedSanitizers() const override; | ||
60 | void addProfileRTLibs(const llvm::opt::ArgList &Args, | ||