1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

configure.ac: enable -ffat-lto-objects with -flto when available

Without -ffat-lto-objects libguile.a ends up with no symbols, visible
via "nm t libguile.a".
cf. https://lintian.debian.org/tags/no-code-sections.html

* configure.ac: enable -ffat-lto-objects with -flto when available.
This commit is contained in:
Rob Browning 2025-03-01 11:24:19 -06:00
parent e1a6622b3b
commit d7475d4073
2 changed files with 21 additions and 0 deletions

3
NEWS
View file

@ -90,6 +90,9 @@ every line in a file.
This used to trigger a warning, unduly.
** SRFI-19: 'date->string' converter ~V is now correctly interpreted
(<https://bugs.gnu.org/74841>)
** When -flto is enabled configure now adds -ffat-lto-objects if it exists
Otherwise libguile.a can end up with no code.
https://lintian.debian.org/tags/no-code-sections.html
Changes in 3.0.10 (since 3.0.9)

View file

@ -98,6 +98,24 @@ else
AC_MSG_RESULT([no])
fi
# https://lintian.debian.org/tags/no-code-sections.html
if test "$LTO_CFLAGS"; then
if ! test "$LTO_CFLAGS" = -flto; then # currently expected below
AC_MSG_ERROR([LTO_CFLAGS wasn't just -flto])
fi
AC_MSG_CHECKING([whether the compiler supports -ffat-lto-objects])
old_CFLAGS="$CFLAGS"
LTO_CFLAGS="-flto -ffat-lto-objects"
CFLAGS="$CFLAGS $LTO_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo;], [])],, [LTO_CFLAGS=-flto])
CFLAGS="$old_CFLAGS"
if test -n "$LTO_CFLAGS"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
AC_ARG_ENABLE(lto,
[AS_HELP_STRING([--enable-lto]
[enable link-time optimization for libguile])],