Hi,
the test for the presence of variables (really symbols) does not work when you
add -Ox -flto to CFLAGS:
for v in $vars; do
AC_MSG_CHECKING([for $v])
AC_CACHE_VAL(libiberty_cv_var_$v,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p =
$v;]])],
[eval "libiberty_cv_var_$v=yes"],
[eval "libiberty_cv_var_$v=no"])])
if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
AC_MSG_RESULT(yes)
n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
AC_DEFINE_UNQUOTED($n)
else
AC_MSG_RESULT(no)
fi
done
because the assignment to 'p' is optimized away by LTO. This is visible on
MinGW platforms in the form of a link failure for sys_siglist.
Tested on x86-64/Linux, x86-64/Windows and x86/Windows, OK for the mainline?
2021-05-03 Eric Botcazou
* configure.ac: Make test for variables more robust.
* configure: Regenerate.
--
Eric Botcazoudiff --git a/libiberty/configure.ac b/libiberty/configure.ac
index ad952963971..3c03f24d368 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -665,7 +665,7 @@ if test -z "${setobjs}"; then
for v in $vars; do
AC_MSG_CHECKING([for $v])
AC_CACHE_VAL(libiberty_cv_var_$v,
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int $v [];]],[[if ($v [0]) return 1;]])],
[eval "libiberty_cv_var_$v=yes"],
[eval "libiberty_cv_var_$v=no"])])
if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then