diff options
author | Rob Landley <rob@landley.net> | 2022-04-12 17:25:51 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2022-04-12 17:25:51 -0500 |
commit | cda84ae98884edd8d2b89003c741d5aafc734510 (patch) | |
tree | 27ec05c818cdd604290075807fb01f421b035c32 | |
parent | cecd169cde3ccb072dbbcf1cbbf76c5e19145371 (diff) | |
download | toybox-cda84ae98884edd8d2b89003c741d5aafc734510.tar.gz |
Move arch-specific dead code elimination setup into scripts/portability.sh
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | scripts/portability.sh | 8 |
2 files changed, 8 insertions, 6 deletions
@@ -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 diff --git a/scripts/portability.sh b/scripts/portability.sh index 3e86c36c..1ee43870 100644 --- a/scripts/portability.sh +++ b/scripts/portability.sh @@ -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. |