summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2015-06-03 17:17:08 +0200
committerKay Sievers <kay@vrfy.org>2015-06-03 17:38:26 +0200
commit2b4919a68cf826efbe939291e6dc4f08e824dc41 (patch)
treeb2bb291e359cf6266eb32dfc8a7d3ec8bfc172ec /configure.ac
parenttest-unit-file.c: fixup the test for commit 3b51f8ddd5 (diff)
downloadsystemd-2b4919a68cf826efbe939291e6dc4f08e824dc41.tar.xz
systemd-2b4919a68cf826efbe939291e6dc4f08e824dc41.zip
build-sys: disable gc-sections if optimization is disabled
This way, development builds will not rely on gc-sections to paper over cyclic link dependencies. Newly introduced broken link requirements will immediatley fail.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac15
1 files changed, 12 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index deafcc195b..ea29ab475a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -183,8 +183,6 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-fdiagnostics-show-option \
-fno-strict-aliasing \
-fvisibility=hidden \
- -ffunction-sections \
- -fdata-sections \
-fstack-protector \
-fstack-protector-strong \
-fPIE \
@@ -208,10 +206,21 @@ AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
[AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags")
+AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
+ [CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
+ -Wl,--gc-sections])],
+ [AC_MSG_RESULT([skipping --gc-sections, optimization not enabled])])
+AC_SUBST([OUR_CFLAGS], "$with_ldflags $sanitizer_cflags")
+
+AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
+ [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+ -ffunction-sections -fdata-sections])],
+ [AC_MSG_RESULT([skipping -ffunction/data-section, optimization not enabled])])
+AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
+
CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-Wl,--as-needed \
-Wl,--no-undefined \
- -Wl,--gc-sections \
-Wl,-z,relro \
-Wl,-z,now \
-pie \