diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 22 |
3 files changed, 20 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am index 2e2abaead6..7603b2c0e1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6549,9 +6549,7 @@ clean-local: $(CLEAN_LOCAL_HOOKS) rm -f $(abs_srcdir)/hwdb/usb.ids $(abs_srcdir)/hwdb/pci.ids $(abs_srcdir)/hwdb/oui.txt \ $(abs_srcdir)/hwdb/iab.txt -# disable gc-sections to check limited toolchains for link breakage DISTCHECK_CONFIGURE_FLAGS = \ - CFLAGS='-fno-lto' LDFLAGS='-Wl,--as-needed -Wl,--no-gc-sections' \ --with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \ --with-dbussessionservicedir=$$dc_install_base/$(dbussessionservicedir) \ --with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \ diff --git a/autogen.sh b/autogen.sh index 3027f83153..2d4acdfef1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -47,7 +47,7 @@ fi if [ ! -L /bin ]; then args="$args \ ---with-rootprefix= \ +--with-rootprefix=/ \ --with-rootlibdir=$(libdir /lib) \ " fi diff --git a/configure.ac b/configure.ac index 955113172d..2625e0d15b 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 \ @@ -1378,6 +1387,13 @@ AX_NORMALIZE_PATH([with_zshcompletiondir]) AC_ARG_WITH([rootprefix], AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), [], [with_rootprefix=${ac_default_prefix}]) +# --with-rootprefix= (empty) should default to "/" but AX_NORMALIZE_PATH +# defaults those to ".", solve that here for now until we can find a suitable +# fix for AX_NORMALIZE_PATH upstream at autoconf-archive. +# See: https://github.com/systemd/systemd/issues/54 +if test "x${with_rootprefix}" = "x"; then + with_rootprefix="/" +fi AX_NORMALIZE_PATH([with_rootprefix]) AC_ARG_WITH([rootlibdir], |