about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-10-26 11:52:50 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-10-26 11:52:50 +0000
commit623808eb97894fc87dec66f51483fbf9082a3892 (patch)
tree86ae01692bd36c2c1405f4c2cef2262cdec3bd80
parentdda3a3244746f6f98179f3b1f65ec302c26d8f48 (diff)
downloads6-portable-utils-623808eb97894fc87dec66f51483fbf9082a3892.tar.gz
s6-portable-utils-623808eb97894fc87dec66f51483fbf9082a3892.tar.xz
s6-portable-utils-623808eb97894fc87dec66f51483fbf9082a3892.zip
Separate sections for smaller static binaries (thanks Denys Vlasenko)
-rwxr-xr-xconfigure6
1 files changed, 6 insertions, 0 deletions
diff --git a/configure b/configure
index 3ddb7e5..ab6a070 100755
--- a/configure
+++ b/configure
@@ -297,6 +297,11 @@ tryflag CPPFLAGS_AUTO -Werror=implicit-function-declaration
 tryflag CPPFLAGS_AUTO -Werror=implicit-int
 tryflag CPPFLAGS_AUTO -Werror=pointer-sign
 tryflag CPPFLAGS_AUTO -Werror=pointer-arith
+tryflag CFLAGS_AUTO -ffunction-sections
+tryflag CFLAGS_AUTO -fdata-sections
+
+tryldflag LDFLAGS_AUTO -Wl,--sort-section=alignment
+tryldflag LDFLAGS_AUTO -Wl,--sort-common
 
 if $evenmorestatic ; then
   LDFLAGS_NOSHARED=-static
@@ -310,6 +315,7 @@ LDFLAGS_SHARED="${LDFLAGS_SHARED}${addlibdpath}"
 
 if $allstatic ; then
   LDFLAGS_NOSHARED="${LDFLAGS_NOSHARED}${addlibspath}"
+  tryldflag LDFLAGS_NOSHARED -Wl,--gc-sections
 else
   LDFLAGS_NOSHARED="${LDFLAGS_NOSHARED}${addlibdpath}"
 fi