From 13c56943b6a7730079680df95f8d04be2f6bb53a Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 24 Jul 2007 12:31:01 +0000 Subject: 2007-07-24 Richard Hughes * configure.in: Check for -Wl,--gc-sections so we can really reduce the size of the setuid binary. --- configure.in | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 877bc0a7..cf0d8ecf 100644 --- a/configure.in +++ b/configure.in @@ -243,6 +243,32 @@ else fi fi +# Check for -Wl,--gc-sections +AC_MSG_CHECKING([for ld that supports "-Wl,--gc-sections"]) +AC_TRY_LINK([ + int one(void) { return 1; } + int two(void) { return 2; } + ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no]) + +if test "$ac_gcsections" = "yes"; then + rm -f conftest.c + touch conftest.c + if $CC -c conftest.c; then + if $LD --gc-sections -o conftest conftest.o 2>&1 | \ + grep "Warning: gc-sections option ignored" > /dev/null; then + ac_gcsections=no + fi + fi + rm -f conftest.c conftest.o conftest +fi +if test "$ac_gcsections" = "yes"; then + SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" + CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" +fi +AC_SUBST(SECTION_FLAGS) +AC_SUBST(SECTION_LDFLAGS) +AC_MSG_RESULT($ac_gcsections) + # Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris # case $target_os in -- cgit