summarylogtreecommitdiffstats
path: root/enable-SSP-and-PIE-by-default.patch
diff options
context:
space:
mode:
Diffstat (limited to 'enable-SSP-and-PIE-by-default.patch')
-rw-r--r--enable-SSP-and-PIE-by-default.patch56
1 files changed, 38 insertions, 18 deletions
diff --git a/enable-SSP-and-PIE-by-default.patch b/enable-SSP-and-PIE-by-default.patch
index 2c8bd20f5de..351dc1b090f 100644
--- a/enable-SSP-and-PIE-by-default.patch
+++ b/enable-SSP-and-PIE-by-default.patch
@@ -1,6 +1,6 @@
-From a076711d030ca5777465dab9f11c0639478a5cc8 Mon Sep 17 00:00:00 2001
+From 6a5a1f705fe44ab47ad8b52c1096451caa951b5c Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
-Date: Tue, 26 Mar 2019 01:35:50 +0200
+Date: Sat, 21 Sep 2019 02:36:46 +0300
Subject: [PATCH] Enable SSP and PIE by default
This is a minimal set of changes needed to make clang use SSP and PIE by
@@ -28,14 +28,15 @@ of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410)
test/Driver/linux-ld.c | 2 ++
test/Driver/ppc-abi.c | 4 ++--
test/Driver/riscv32-toolchain.c | 4 ++--
+ test/Driver/riscv64-toolchain.c | 4 ++--
test/Driver/stack-protector.c | 4 ++--
- 12 files changed, 41 insertions(+), 28 deletions(-)
+ 13 files changed, 43 insertions(+), 30 deletions(-)
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index 65ab9b2daf..5b757b8028 100644
+index d900508ad9..3e68d50dac 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -968,8 +968,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
+@@ -972,8 +972,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
}
bool Linux::isPIEDefault() const {
@@ -55,14 +56,14 @@ index 65ab9b2daf..5b757b8028 100644
+ return 2;
}
- bool Linux::IsMathErrnoDefault() const {
+ bool Linux::isNoExecStackDefault() const {
diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h
-index 4a662cb4b4..4f369c6090 100644
+index 4c61994691..c60a50cb27 100644
--- a/lib/Driver/ToolChains/Linux.h
+++ b/lib/Driver/ToolChains/Linux.h
@@ -40,6 +40,7 @@ public:
- CXXStdlibType GetDefaultCXXStdlibType() const override;
bool isPIEDefault() const override;
+ bool isNoExecStackDefault() const override;
bool IsMathErrnoDefault() const override;
+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
SanitizerMask getSupportedSanitizers() const override;
@@ -130,10 +131,10 @@ index 0371bc91c4..ea89f52512 100644
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c
-index db88872399..76af9bd8fe 100644
+index 2896eda5aa..45a1873ace 100644
--- a/test/Driver/fsanitize.c
+++ b/test/Driver/fsanitize.c
-@@ -331,15 +331,15 @@
+@@ -318,15 +318,15 @@
// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1
// OK
@@ -153,7 +154,7 @@ index db88872399..76af9bd8fe 100644
// CHECK-NO-PIE-NOT: "-pie"
// CHECK-NO-PIE: "-mrelocation-model" "static"
-@@ -687,12 +687,12 @@
+@@ -645,12 +645,12 @@
// RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP
// NOSP-NOT: "-fsanitize=safe-stack"
@@ -195,7 +196,7 @@ index a7eeca0fdb..32f648372e 100644
// CHECK042-NEXT: llvm-mc
// CHECK042: "-gpsize=8"
diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c
-index a9335ebf71..a72041865b 100644
+index 77ac05f309..cb474f3289 100644
--- a/test/Driver/linux-as.c
+++ b/test/Driver/linux-as.c
@@ -164,7 +164,7 @@
@@ -217,7 +218,7 @@ index a9335ebf71..a72041865b 100644
// CHECK-SPARCV9PIC: as
// CHECK-SPARCV9PIC: -64
diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
-index 3ab81be490..fd6b67dd9a 100644
+index 70fc178c56..b52c84ce85 100644
--- a/test/Driver/linux-ld.c
+++ b/test/Driver/linux-ld.c
@@ -1,3 +1,5 @@
@@ -227,7 +228,7 @@ index 3ab81be490..fd6b67dd9a 100644
// sysroot to make these tests independent of the host system.
//
diff --git a/test/Driver/ppc-abi.c b/test/Driver/ppc-abi.c
-index a82a01de27..35de94a4ad 100644
+index fdcf45da29..cbd1106b7d 100644
--- a/test/Driver/ppc-abi.c
+++ b/test/Driver/ppc-abi.c
@@ -26,11 +26,11 @@
@@ -245,7 +246,7 @@ index a82a01de27..35de94a4ad 100644
// CHECK-ELFv2-BE: "-mrelocation-model" "pic" "-pic-level" "2"
// CHECK-ELFv2-BE: "-target-abi" "elfv2"
diff --git a/test/Driver/riscv32-toolchain.c b/test/Driver/riscv32-toolchain.c
-index 9e8af3a8ff..171392d172 100644
+index 117c773ec9..9fffbf2aaf 100644
--- a/test/Driver/riscv32-toolchain.c
+++ b/test/Driver/riscv32-toolchain.c
@@ -78,7 +78,7 @@
@@ -266,6 +267,28 @@ index 9e8af3a8ff..171392d172 100644
// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d"
// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d"
// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d"
+diff --git a/test/Driver/riscv64-toolchain.c b/test/Driver/riscv64-toolchain.c
+index 3d574947c6..20e3dc1556 100644
+--- a/test/Driver/riscv64-toolchain.c
++++ b/test/Driver/riscv64-toolchain.c
+@@ -78,7 +78,7 @@
+ // C-RV64-LINUX-MULTI-LP64: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv"
+ // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64.so.1"
+-// C-RV64-LINUX-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64{{/|\\\\}}crtbegin.o"
++// C-RV64-LINUX-MULTI-LP64: "crtbeginS.o"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64"
+@@ -94,7 +94,7 @@
+ // C-RV64-LINUX-MULTI-LP64D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv"
+ // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64d.so.1"
+-// C-RV64-LINUX-MULTI-LP64D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d{{/|\\\\}}crtbegin.o"
++// C-RV64-LINUX-MULTI-LP64D: "crtbeginS.o"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d"
diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
index a3e40b50ee..dfffe0d6cf 100644
--- a/test/Driver/stack-protector.c
@@ -284,6 +307,3 @@ index a3e40b50ee..dfffe0d6cf 100644
// SSP-BUF: "-stack-protector-buffer-size" "16"
// RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD
---
-2.21.0
-