[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/02: configure: improved usage of 'pie' mode for harde
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/02: configure: improved usage of 'pie' mode for hardening |
Date: |
Sun, 17 Apr 2022 17:39:10 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 03c29b63e0e4c4036dafaa382cd0db1fe400a7a2
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Apr 17 18:34:17 2022 +0300
configure: improved usage of 'pie' mode for hardening
---
configure.ac | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/configure.ac b/configure.ac
index 84af625d..50f3055e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -313,33 +313,30 @@ AS_VAR_IF([enable_compiler_hardening],["yes"],
MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac],[-fstack-protector-strong],[-fstack-protector-all],[-fstack-protector])
MHD_CHECK_ADD_CC_CFLAGS([-fstack-clash-protection
-ftrivial-auto-var-init=pattern],[CFLAGS_ac])
CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
- AS_VAR_IF([pic_mode],["no"],[],
+ AS_IF([test "x${enable_static}" = "xyes" && test "x${pic_mode}" != "xyes"],
[
- AS_VAR_IF([enable_shared],["yes"],[],
+ # PIE static lib can be used within non-PIE application, but
+ # PIE static lib cannot be used in non-PIE shared lib. Let's assume
+ # that static lib will not be used in shared lib
+ # All "pie" flags will be used automatically by libtool only
+ # for static library objects.
+ CFLAGS="${user_CFLAGS}"
+ # Perform tests here with "-pie" enabled
+ LDFLAGS="${LDFLAGS_ac} -pie ${user_LDFLAGS}"
+ MHD_CHECK_ADD_CC_CFLAG([-fPIE],[CFLAGS_ac],
[
- # PIE cannot be used for shared lib
- # PIE static lib can be used within non-PIE application, but
- # PIE static lib cannot be used in non-PIE shared lib. Let's assume
- # that static lib will not be used in shared lib
- CFLAGS="${user_CFLAGS}"
- # Perform tests with "-pie" enabled
- LDFLAGS="${LDFLAGS_ac} -pie ${user_LDFLAGS}"
- MHD_CHECK_ADD_CC_CFLAG([-fPIE],[CFLAGS_ac],
+ MHD_APPEND_FLAG_TO_VAR([LDFLAGS_ac],[-pie])
+ ],
+ [
+ MHD_CHECK_ADD_CC_CFLAG([-fpie],[CFLAGS_ac],
[
MHD_APPEND_FLAG_TO_VAR([LDFLAGS_ac],[-pie])
- ],
- [
- MHD_CHECK_CC_CFLAG([-fpie],[CFLAGS_ac],
- [
- MHD_APPEND_FLAG_TO_VAR([LDFLAGS_ac],[-pie])
- ]
- )
]
)
- CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
- LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
]
)
+ CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
+ LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
]
)
CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.