Move arch-specific dead code elimination setup into scripts/portability.sh

This commit is contained in:
Rob Landley 2022-04-12 17:25:51 -05:00
parent cecd169cde
commit cda84ae988
2 changed files with 8 additions and 6 deletions

6
configure vendored
View File

@ -20,9 +20,3 @@ CFLAGS="$CFLAGS -Wall -Wundef -Wno-char-subscripts -Werror=implicit-function-dec
: ${OPTIMIZE:=-Os -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-strict-aliasing}
# We accept LDFLAGS, but by default don't have anything in it
if [ "$(uname)" == "Darwin" ]
then
: ${LDOPTIMIZE:=-Wl,-dead_strip} ${STRIP:=strip}
else
: ${LDOPTIMIZE:=-Wl,--gc-sections -Wl,--as-needed} ${STRIP:=strip -s -R .note* -R .comment}
fi

View File

@ -13,6 +13,14 @@ then
[ ! -z "$(command -v gsed 2>/dev/null)" ] && SED=gsed || SED=sed
fi
# Tell linker to do dead code elimination at function level
if [ "$(uname)" == "Darwin" ]
then
: ${LDOPTIMIZE:=-Wl,-dead_strip} ${STRIP:=strip}
else
: ${LDOPTIMIZE:=-Wl,--gc-sections -Wl,--as-needed} ${STRIP:=strip -s -R .note* -R .comment}
fi
# Address Sanitizer
if [ ! -z "$ASAN" ]; then
# Turn ASan on and disable most optimization to get more readable backtraces.