+2019-12-19 Jan Hubicka <hubicka@ucw.cz>
+ Xi Ruoyao <xry111@mengyan1223.wang>
+
+ * 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.
+
2019-12-19 Jan Hubicka <hubicka@ucw.cz>
Luo Xiong Hu <luoxhu@linux.ibm.com
{
return !(!node->force_output
&& !node->ifunc_resolver
+ /* Limitation of gas requires us to output targets of symver aliases
+ as global symbols. This is binutils PR 25295. */
+ && !node->symver
&& ((DECL_COMDAT (node->decl)
&& !node->forced_by_abi
&& !node->used_from_object_file_p ()
&& lookup_attribute ("dllexport",
DECL_ATTRIBUTES (node->decl)))
return true;
+
+ /* Limitation of gas requires us to output targets of symver aliases as
+ global symbols. This is binutils PR 25295. */
+ ipa_ref *ref;
+ FOR_EACH_ALIAS (node, ref)
+ if (ref->referring->symver)
+ return true;
+
if (node->resolution == LDPR_PREVAILING_DEF_IRONLY)
return false;
/* When doing LTO or whole program, we can bring COMDAT functoins static.
DECL_ATTRIBUTES (decl)))
return true;
- /* See if we have linker information about symbol not being used or
- if we need to make guess based on the declaration.
+ /* Limitation of gas requires us to output targets of symver aliases as
+ global symbols. This is binutils PR 25295. */
+ ipa_ref *ref;
+ FOR_EACH_ALIAS (this, ref)
+ if (ref->referring->symver)
+ return true;
- Even if the linker clams the symbol is unused, never bring internal
- symbols that are declared by user as used or externally visible.
- This is needed for i.e. references from asm statements. */
- if (used_from_object_file_p ())
- return true;
if (resolution == LDPR_PREVAILING_DEF_IRONLY)
return false;
+2019-12-19 Jan Hubicka <hubicka@ucw.cz>
+ Xi Ruoyao <xry111@mengyan1223.wang>
+
+ * lto-common.c (read_cgraph_and_symbols): Work around binutils
+ PR25424
+
2019-12-07 Jan Hubicka <hubicka@ucw.cz>
* lto-partition.c (lto_balanced_map): Fix printing of tp_first_run.
IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (snode->decl)));
}
+ /* Symbol versions are always used externally, but linker does not
+ report that correctly.
+ This is binutils PR25924. */
+ else if (snode->symver && *res == LDPR_PREVAILING_DEF_IRONLY)
+ snode->resolution = LDPR_PREVAILING_DEF_IRONLY_EXP;
else
snode->resolution = *res;
}
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;