aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2022-04-12 17:25:51 -0500
committerRob Landley <rob@landley.net>2022-04-12 17:25:51 -0500
commitcda84ae98884edd8d2b89003c741d5aafc734510 (patch)
tree27ec05c818cdd604290075807fb01f421b035c32
parentcecd169cde3ccb072dbbcf1cbbf76c5e19145371 (diff)
downloadtoybox-cda84ae98884edd8d2b89003c741d5aafc734510.tar.gz
Move arch-specific dead code elimination setup into scripts/portability.sh
-rwxr-xr-xconfigure6
-rw-r--r--scripts/portability.sh8
2 files changed, 8 insertions, 6 deletions
diff --git a/configure b/configure
index edaa3dad..c718e83b 100755
--- a/configure
+++ b/configure
@@ -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.