summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-crypt/swtpm/files/swtpm-build-sys-Use-AC_COMPILE_IFELSE-to-check-for-unused-.patch')
-rw-r--r--app-crypt/swtpm/files/swtpm-build-sys-Use-AC_COMPILE_IFELSE-to-check-for-unused-.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/app-crypt/swtpm/files/swtpm-build-sys-Use-AC_COMPILE_IFELSE-to-check-for-unused-.patch b/app-crypt/swtpm/files/swtpm-build-sys-Use-AC_COMPILE_IFELSE-to-check-for-unused-.patch
new file mode 100644
index 000000000000..582199708057
--- /dev/null
+++ b/app-crypt/swtpm/files/swtpm-build-sys-Use-AC_COMPILE_IFELSE-to-check-for-unused-.patch
@@ -0,0 +1,56 @@
+From b6d16129a525f572ef37d20ba1cd70d59ca4f079 Mon Sep 17 00:00:00 2001
+From: Stefan Berger <stefanb@linux.vnet.ibm.com>
+Date: Tue, 21 Jul 2020 17:38:10 -0400
+Subject: [PATCH 1/2] build-sys: Use AC_COMPILE_IFELSE to check for unused
+ linker flags (clang)
+
+This patch fixes a clang issue report in issue #280.
+
+clang does not use ld, so we cannot grep for support of certain linker
+flags but have to test-compile.
+
+Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
+---
+ configure.ac | 26 +++++++++++++++++++-------
+ 1 file changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b4d4258..56d3f09 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -357,13 +357,25 @@ if test "x$enable_hardening" != "xno"; then
+ if test -z "$TMP1" && test -n "$TPM2"; then
+ HARDENING_CFLAGS="$HARDENING_CFLAGS -D_FORTIFY_SOURCE=2 "
+ fi
+- dnl Check ld for 'relro' and 'now'
+- if $LD --help 2>&1 | $GREP '\-z relro ' > /dev/null; then
+- HARDENING_CFLAGS="$HARDENING_CFLAGS -Wl,-z,relro "
+- fi
+- if $LD --help 2>&1 | $GREP '\-z now ' > /dev/null; then
+- HARDENING_CFLAGS="$HARDENING_CFLAGS -Wl,-z,now "
+- fi
++ dnl Check linker for 'relro' and 'now'
++ save_CFLAGS="$CFLAGS"
++ CFLAGS="-Wl,-z,relro -Werror"
++ AC_MSG_CHECKING([whether linker supports -Wl,-z,relro])
++ AC_COMPILE_IFELSE(
++ [AC_LANG_SOURCE([[int main() { return 0; }]])],
++ [HARDENING_CFLAGS="$HARDENING_CFLAGS -Wl,-z,relro"
++ AC_MSG_RESULT(yes)],
++ [AC_MSG_RESULT(no)]
++ )
++ CFLAGS="-Wl,-z,now -Werror"
++ AC_MSG_CHECKING([whether linker supports -Wl,-z,now])
++ AC_COMPILE_IFELSE(
++ [AC_LANG_SOURCE([[int main() { return 0; }]])],
++ [HARDENING_CFLAGS="$HARDENING_CFLAGS -Wl,-z,now"
++ AC_MSG_RESULT(yes)],
++ [AC_MSG_RESULT(no)]
++ )
++ CFLAGS="$save_CFLAGS"
+ AC_SUBST([HARDENING_CFLAGS])
+ fi
+
+--
+2.26.2
+