about summary refs log tree commit diff
path: root/configure
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-10-26 11:52:42 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-10-26 11:52:42 +0000
commit2bbc798dc1dcb3bc96110794b17a7dd65f354f3e (patch)
treed166d59c3158128337f1a02a992393ac62371e1f /configure
parentb2fb2ee19f4de8bc3b693fec5cd69f79673994ca (diff)
downloads6-linux-init-2bbc798dc1dcb3bc96110794b17a7dd65f354f3e.tar.gz
s6-linux-init-2bbc798dc1dcb3bc96110794b17a7dd65f354f3e.tar.xz
s6-linux-init-2bbc798dc1dcb3bc96110794b17a7dd65f354f3e.zip
Separate sections for smaller static binaries (thanks Denys Vlasenko)
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure7
1 files changed, 7 insertions, 0 deletions
diff --git a/configure b/configure
index 3ddb7e5..dabd7ef 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,10 +315,12 @@ 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
 
+
 if test -z "$vpaths" ; then
   while read dep ; do
     base=$(basename $dep) ;