aboutsummaryrefslogtreecommitdiff
path: root/gcc/symtab.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-12-19 11:03:48 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-12-19 10:03:48 +0000
commit40ebe1fc2f136a454b0d5efa119bb516ad767c91 (patch)
tree302cab4062b9e251794530c40e2009eb19eb7509 /gcc/symtab.c
parent44fca83228acc96c19c51e52b5c0448e09329170 (diff)
downloadgcc-40ebe1fc2f136a454b0d5efa119bb516ad767c91.zip
gcc-40ebe1fc2f136a454b0d5efa119bb516ad767c91.tar.gz
gcc-40ebe1fc2f136a454b0d5efa119bb516ad767c91.tar.bz2
Fix symver attribute with LTO
* cgraph.c (cgraph_node_cannot_be_local_p_1): Prevent targets of symver attributes to be localized. * ipa-visibility.c (cgraph_externally_visible_p, varpool_node::externally_visible_p): Likewise. * symtab.c (symtab_node::verify_base): Check visibility of symbol versions. * lto-common.c (read_cgraph_and_symbols): Work around binutils PR25424 Co-Authored-By: Xi Ruoyao <xry111@mengyan1223.wang> From-SVN: r279566
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r--gcc/symtab.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 10b8ed1..9c52192 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -1156,6 +1156,22 @@ symtab_node::verify_base (void)
error ("node is symver but not alias");
error_found = true;
}
+ /* Limitation of gas requires us to output targets of symver aliases as
+ global symbols. This is binutils PR 25295. */
+ if (symver
+ && (!TREE_PUBLIC (get_alias_target ()->decl)
+ || DECL_VISIBILITY (get_alias_target ()->decl) != VISIBILITY_DEFAULT))
+ {
+ error ("symver target is not exported with default visibility");
+ error_found = true;
+ }
+ if (symver
+ && (!TREE_PUBLIC (decl)
+ || DECL_VISIBILITY (decl) != VISIBILITY_DEFAULT))
+ {
+ error ("symver is not exported with default visibility");
+ error_found = true;
+ }
if (same_comdat_group)
{
symtab_node *n = same_comdat_group;