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>
This commit is contained in:
@@ -318,6 +318,7 @@ export KF5_LIBS=$(gb_SPACE)@KF5_LIBS@
|
||||
export KRB5_LIBS=@KRB5_LIBS@
|
||||
export LCMS2_CFLAGS=$(gb_SPACE)@LCMS2_CFLAGS@
|
||||
export LCMS2_LIBS=$(gb_SPACE)@LCMS2_LIBS@
|
||||
export LD_GC_SECTIONS=@LD_GC_SECTIONS@
|
||||
export LD_PLUGIN=@LD_PLUGIN@
|
||||
@x_LDFLAGS@ export LDFLAGS=@LDFLAGS@
|
||||
export LFS_CFLAGS=@LFS_CFLAGS@
|
||||
|
23
configure.ac
23
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
|
||||
|
@@ -95,7 +95,7 @@ gb_PrecompiledHeader_pch_with_obj = $(BUILDING_PCH_WITH_OBJ)
|
||||
ifneq ($(BUILDING_PCH_WITH_OBJ),)
|
||||
# If using Clang's PCH extra object, we may need to strip unused sections, otherwise inline and template functions
|
||||
# emitted in that object may in some cases cause unresolved references to private symbols in other libraries.
|
||||
gb_LinkTarget_LDFLAGS += -Wl,--gc-sections
|
||||
gb_LinkTarget_LDFLAGS += $(LD_GC_SECTIONS)
|
||||
gb_PrecompiledHeader_pch_with_obj += -ffunction-sections -fdata-sections
|
||||
# Enable generating more shared code and debuginfo in the PCH object file.
|
||||
gb_PrecompiledHeader_pch_with_obj += $(PCH_MODULES_DEBUGINFO)
|
||||
|
Reference in New Issue
Block a user