On Fri, Jun 6, 2014 at 3:09 AM, Jan Hubicka <hubi...@ucw.cz> wrote: > sorry for taking time to get back to it. I went through the code and see no > obvious flaws > except that I am somewhat concerned what happens with local aliases into the > anchors. > The problem however does not seem to be caused by it. I tracked it down to > the following > difference: > > --- d2.s 2014-06-06 08:59:01.101401622 +0200 > +++ d3.s 2014-06-06 08:59:01.491377632 +0200 > @@ -499,7 +499,7 @@ > .long 4 > .long 4 > .long _ZTI1B > - .long _ZTv0_n12_N1B1fEv > + .long _ZTv0_n12_N1B1fEv.localalias.5 > .weak _ZTV1A > .align 2 > _ZTV1A: > > Now _ZTv0_n12_N1B1fEv is thunk declared as: > > .lglobl .LTHUNK..0 > .lglobl LTHUNK..0 > .set .LTHUNK..0,._ZN1B1fEv > .set LTHUNK..0,_ZN1B1fEv > .lglobl ._ZTv0_n12_N1B1fEv.localalias.5 > .lglobl _ZTv0_n12_N1B1fEv.localalias.5 > .set ._ZTv0_n12_N1B1fEv.localalias.5,._ZTv0_n12_N1B1fEv > .set _ZTv0_n12_N1B1fEv.localalias.5,_ZTv0_n12_N1B1fEv > .align 2 > .weak _ZTv0_n12_N1B1fEv[DS] > .weak ._ZTv0_n12_N1B1fEv > .csect _ZTv0_n12_N1B1fEv[DS] > _ZTv0_n12_N1B1fEv: > .long ._ZTv0_n12_N1B1fEv, TOC[tc0], 0 > .csect .text[PR] > ._ZTv0_n12_N1B1fEv: > LFB..16: > lwz 12,0(3) > lwz 12,-12(12) > add 3,3,12 > b .LTHUNK..0 > > Now when I move the declaration of localalias after the thunk: > > --- d3.s 2014-06-06 08:59:01.491377632 +0200 > +++ d4.s 2014-06-06 09:03:58.129810951 +0200 > @@ -212,10 +212,6 @@ > .lglobl LTHUNK..0 > .set .LTHUNK..0,._ZN1B1fEv > .set LTHUNK..0,_ZN1B1fEv > - .lglobl ._ZTv0_n12_N1B1fEv.localalias.5 > - .lglobl _ZTv0_n12_N1B1fEv.localalias.5 > - .set ._ZTv0_n12_N1B1fEv.localalias.5,._ZTv0_n12_N1B1fEv > - .set _ZTv0_n12_N1B1fEv.localalias.5,_ZTv0_n12_N1B1fEv > .align 2 > .weak _ZTv0_n12_N1B1fEv[DS] > .weak ._ZTv0_n12_N1B1fEv > @@ -229,6 +225,10 @@ > lwz 12,-12(12) > add 3,3,12 > b .LTHUNK..0 > + .lglobl ._ZTv0_n12_N1B1fEv.localalias.5 > + .lglobl _ZTv0_n12_N1B1fEv.localalias.5 > + .set ._ZTv0_n12_N1B1fEv.localalias.5,._ZTv0_n12_N1B1fEv > + .set _ZTv0_n12_N1B1fEv.localalias.5,_ZTv0_n12_N1B1fEv > LFE..16: > .align 2 > .weak _ZN1D1fEv[DS] > > The code starts to work. To me both sources should make same binary, but > they don't. > Can you make better sense of this than claiming it is an assembler bug? > > We output aliases after definitions for functions, but before definitions for > thunks. > I am testing patch to change the second order. I remeber tweaking this order > once before > because of problems on solaris. Lets see if we find order that works for > everyone.
Honza, The AIX assembler is a very simple, single-pass assembler. The order has a lot of importance because the assembler makes assumptions about symbols, such as section placement and annotations, if they are referenced before defined. I notice that your change places the .lglobl declaration after the .weak declaration. That may be more important than placing it after the thunk. Thanks, David