> On 2019-12-19 19:12 +0800, Xi Ruoyao wrote: > > On 2019-12-19 11:06 +0100, Jan Hubicka wrote: > > > - /* 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; > > > > Are these two lines removed intentionally? > > Oh I see, it was a duplicated branch. > > Sorry for noise. I should have mentioned that in the changelog. Indeed that function was checked twice.
Looking into it more, we still have issue since call foo_v1 tranlsates as 5: e8 00 00 00 00 callq a <foo@VERS_1+0xa> while gcc believes that really foo_v1 is called. So after symver i guess foo_v1 symbol becomes completely unreachable from the current unit which is not what gcc expect. Since we do not allow any references to the symbol and we hacked gcc to believe that symvered symbol is externaly visible, I suppose things are more or less safe, but it is not working at it should. It would probably be best if gas supported something like .symver_set with similar semantics of .set but creating a symbol version alias which woud not add the translation of all references from symbol to its version. Honza