> > gcc/ChangeLog: > > * cgraphunit.c (process_symver_attribute): Remove checks that > are not needed now. > (cgraph_node::assemble_thunks_and_aliases): Change second > argument to decl. > * config/elfos.h (ASM_OUTPUT_SYMVER_DIRECTIVE): Add new > VISIBILITY parameter. > * doc/extend.texi: Document that .symver supports visibility. > * symtab.c (symtab_node::verify_base): Remove checks that > are not needed now. > * varasm.c (do_assemble_symver): Detect visibility .symver > directive argument. > * varpool.c (varpool_node::assemble_aliases): Change second > argument to decl. > > gcc/testsuite/ChangeLog: > > * gcc.dg/ipa/symver2.c: New test. > * gcc.dg/ipa/symver3.c: New test.
Thanks for looking into this! > void > -do_assemble_symver (tree decl, tree target) > +do_assemble_symver (tree decl, tree origin_decl) > { > + tree target = DECL_ASSEMBLER_NAME (origin_decl); > tree id = DECL_ASSEMBLER_NAME (decl); > ultimate_transparent_alias_target (&id); > ultimate_transparent_alias_target (&target); > #ifdef ASM_OUTPUT_SYMVER_DIRECTIVE > + const char *visibility = NULL; > + if (!TREE_PUBLIC (origin_decl)) > + visibility = "remove"; > + else if (DECL_VISIBILITY (origin_decl) == VISIBILITY_INTERNAL) > + visibility = "local"; > + else if (DECL_VISIBILITY (origin_decl) == VISIBILITY_HIDDEN) > + visibility = "hidden"; What will happen here with protected visibility? Otherwise patch makes sense to me. Honza > ASM_OUTPUT_SYMVER_DIRECTIVE (asm_out_file, > IDENTIFIER_POINTER (target), > - IDENTIFIER_POINTER (id)); > + IDENTIFIER_POINTER (id), visibility); > #else > error ("symver is only supported on ELF platforms"); > #endif > diff --git a/gcc/varpool.c b/gcc/varpool.c > index 458cdf1bf37..95d7844a398 100644 > --- a/gcc/varpool.c > +++ b/gcc/varpool.c > @@ -540,8 +540,7 @@ varpool_node::assemble_aliases (void) > { > varpool_node *alias = dyn_cast <varpool_node *> (ref->referring); > if (alias->symver) > - do_assemble_symver (alias->decl, > - DECL_ASSEMBLER_NAME (decl)); > + do_assemble_symver (alias->decl, decl); > else if (!alias->transparent_alias) > do_assemble_alias (alias->decl, > DECL_ASSEMBLER_NAME (decl));