mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-03 13:47:04 +03:00
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.
This commit is contained in:
parent
ce54255fa5
commit
2b4919a68c
@ -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) \
|
||||
|
15
configure.ac
15
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 \
|
||||
|
Loading…
x
Reference in New Issue
Block a user