diff mbox

Another AIX Bootstrap failure

Message ID 20140617165056.GB28053@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka June 17, 2014, 4:50 p.m. UTC
> > 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.

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

Comments

David Edelsohn June 17, 2014, 4:57 p.m. UTC | #1
On Tue, Jun 17, 2014 at 12:50 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> > 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 weak function is the problem, but I don't know why.  And I don't
understand how this is different than past uses of weak functions.  Or
is that new?

This is very confusing because the library, libstdc++, is being linked
statically. It provides a weak definition of the function. There
should be no glink code (PLT stub).  If the function is declared
.lglobl, it is called directly and no PLT stub is created.  I need to
call in the help of the AIX linker expert to figure out why it is
inserting PLT stub code, especially when linking statically.

Thanks, David
diff mbox

Patch

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);