summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-01-18 15:44:45 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-01-18 16:55:55 +0100
commit4a93a7954e49b42b0e23a9ca8d962b6d4614b005 (patch)
tree8615c692d11782e7175d4d51a71232329425301d /configure.ac
parent0d2084e198717301da0678eae311f10e6a9c5d78 (diff)
use -Wl,-dead_strip on Mac, its linker doesn't know -Wl,--gc-sections
Change-Id: Ic69d0030a46fe4753cc75da58bb2c15cf009b135 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87023 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac23
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 5b9fd601ef9e..5c1dc1e5f919 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4062,6 +4062,29 @@ printf ("hello world\n");
fi
AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
+LD_GC_SECTIONS=
+if test "$GCC" = "yes"; then
+ for flag in "--gc-sections" "-dead_strip"; do
+ AC_MSG_CHECKING([for $flag linker support])
+ ldflags_save=$LDFLAGS
+ LDFLAGS="$LDFLAGS -Wl,$flag"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <stdio.h>
+ ],[
+printf ("hello world\n");
+ ])],[
+ LD_GC_SECTIONS="-Wl,$flag"
+ AC_MSG_RESULT( found )
+ ], [
+ AC_MSG_RESULT( not found )
+ ])
+ LDFLAGS=$ldflags_save
+ if test -n "$LD_GC_SECTIONS"; then
+ break
+ fi
+ done
+fi
+AC_SUBST(LD_GC_SECTIONS)
HAVE_GSPLIT_DWARF=
if test "$enable_split_debug" != no; then