summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2020-02-21 23:27:21 +0000
committerNicolas Braud-Santoni <nicolas@braud-santoni.eu>2020-02-23 15:14:27 +0100
commita48f266cbda5dcbddc770eef925a75927e97a214 (patch)
treec8944b81ddb8e08b654bafb142e760f4cee0e346
parentdd6879395a03ab2008866c0a8149e33d1c72de8a (diff)
Only use -fstack-protector-all if it is supported
-rw-r--r--debian/patches/conditional-stack-protector-all.patch27
-rw-r--r--debian/patches/series1
2 files changed, 28 insertions, 0 deletions
diff --git a/debian/patches/conditional-stack-protector-all.patch b/debian/patches/conditional-stack-protector-all.patch
new file mode 100644
index 0000000..d58f7ee
--- /dev/null
+++ b/debian/patches/conditional-stack-protector-all.patch
@@ -0,0 +1,27 @@
1From: Colin Watson <cjwatson@debian.org>
2Date: Fri, 21 Feb 2020 23:23:49 +0000
3Subject: Only use -fstack-protector-all if it is supported
4
5This flag isn't available on all Debian ports.
6
7Last-Update: 2020-02-21
8---
9 CMakeLists.txt | 5 ++++-
10 1 file changed, 4 insertions(+), 1 deletion(-)
11
12diff --git a/CMakeLists.txt b/CMakeLists.txt
13index c7c5991..07ca5e1 100644
14--- a/CMakeLists.txt
15+++ b/CMakeLists.txt
16@@ -114,7 +114,10 @@ else()
17 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wbad-function-cast")
18 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
19 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic-errors")
20- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all")
21+ check_c_compiler_flag("-fstack-protector-all" HAVE_STACK_PROTECTOR_ALL)
22+ if(HAVE_STACK_PROTECTOR_ALL)
23+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all")
24+ endif()
25 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
26
27 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g2")
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..d5d2276
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
conditional-stack-protector-all.patch