On Mon, May 3, 2021 at 9:51 AM Eric Botcazou <botca...@adacore.com> wrote:
>
> 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?

OK.

>
> 2021-05-03  Eric Botcazou  <ebotca...@adacore.com>
>
>         * configure.ac: Make test for variables more robust.
>         * configure: Regenerate.
>
> --
> Eric Botcazou

Reply via email to