diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2021-05-04 12:40:42 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2021-05-04 12:53:21 +0200 |
commit | f418bc3cd173bc4e679469928d4d96ffcc05fc7e (patch) | |
tree | 9883221a26c13694cf41f221dddf3f4ac2fc9acc /gcc/symtab.c | |
parent | 1b0f570009825ce53a3967ea9a92b1961b7c122b (diff) | |
download | gcc-f418bc3cd173bc4e679469928d4d96ffcc05fc7e.zip gcc-f418bc3cd173bc4e679469928d4d96ffcc05fc7e.tar.gz gcc-f418bc3cd173bc4e679469928d4d96ffcc05fc7e.tar.bz2 |
Fix libiberty link failures in LTO mode for MinGW
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)
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.
There is another link failures for stpcpy: the symbol is both referenced
by libiberty's pex-win32.c and provided by libiberty's stpcpy.c, so it
needs to have a linkage to be resolved in LTO mode.
libiberty/
* configure.ac: Make test for variables more robust.
* configure: Regenerate.
gcc/
* builtins.c (builtin_with_linkage_p): Return true for stp[n]cpy.
* symtab.c (symtab_node::output_to_lto_symbol_table_p): Tidy up.
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r-- | gcc/symtab.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c index 2135b34..8c4cb70 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -2526,10 +2526,7 @@ symtab_node::output_to_lto_symbol_table_p (void) in libraries so make sure to output references into the symbol table to make those libraries referenced. Note this is incomplete handling for now and only covers math functions. */ - if (builtin_with_linkage_p (decl)) - return true; - else - return false; + return builtin_with_linkage_p (decl); } /* We have real symbol that should be in symbol table. However try to trim |