> > To avoid using PLT and GOT when the unit refers to the symbol and we know > > that interposition does not matter. > > I am not certain if the linker is creating the PLT stub code because > it wants to allow interpolation or because it cannot see a definition > of the function and wants to allow for some other shared library to > provide the definition at runtime.
OK, but the definition appears in the same file.. > > > Why branch to a non-global (static) symbol > > b ._ZN14__gnu_parallel9_SettingsC1Ev.localalias.0 > > leads to PLT stub here and why branching to such symbols seems to work > > otherwise? > > Branching to non-global (static) symbol, even an alias, is working > here. The weak function seems to be the problem. > > > The failing branch is > >> b ._ZN14__gnu_parallel9_SettingsC1Ev.localalias.0 > > so the call to static construction seems to have happened correctly but we > > can > > not get right the call from the constructor to static function (that is an > > alias > > of a global symbol) > > The linker appears to not want to resolve the weak function. If I > change ._ZN14__gnu_parallel9_SettingsC1Ev to lglobl, it works. If I > change the static constructor to call the weak function directly, > avoiding the alias, it shows the same failure mode. > > I don't know what code generation looked like before. Was GCC > generating calls to weak functions within the same file? Yes, this is how you implement COMDAT functions, right? I looked at rs6000 call expansion and it does not seem to care about visibility properties (just about direct wrt indirect call). One problem I can think of is a scenario where linked unify calls comdat functoins in between units somehow forgetting about the aliases, but this function seems to not be shared. Index: symtab.c =================================================================== --- symtab.c (revision 211693) +++ symtab.c (working copy) @@ -1327,10 +1327,8 @@ (void *)&new_node, true); if (new_node) return new_node; -#ifndef ASM_OUTPUT_DEF /* If aliases aren't supported by the assembler, fail. */ return NULL; -#endif /* Otherwise create a new one. */ new_decl = copy_node (node->decl); disable generation of the local aliases completely. I do not see much of difference in the actual codegen with this... I will check older GCC Honza > > Thanks, David