David, thanks for the analysis! > Without the ipa-inline-analysis.c change, g++ creates a static > constructor with global visibility > > .globl > ._GLOBAL__I_65535_0__home_dje_src_src_libstdc___v3_src_c__98_parallel_settings.cc_2984A295_0 > > ._GLOBAL__I_65535_0__home_dje_src_src_libstdc___v3_src_c__98_parallel_settings.cc_2984A295_0: > > With the patch, g++ creates weak method > > .weak ._ZN14__gnu_parallel9_SettingsC1Ev > ._ZN14__gnu_parallel9_SettingsC1Ev: > > with non-global alias > > .lglobl ._ZN14__gnu_parallel9_SettingsC1Ev.localalias.0 > .set > ._ZN14__gnu_parallel9_SettingsC1Ev.localalias.0,._ZN14__gnu_parallel9_SettingsC1Ev > > and the static constructor branches to the alias > > .globl > ._GLOBAL__I_65535_0__home_dje_src_src_libstdc___v3_src_c__98_parallel_settings.cc_2984A295_0 > ._GLOBAL__I_65535_0__home_dje_src_src_libstdc___v3_src_c__98_parallel_settings.cc_2984A295_0: > lwz 3,LC..8(2) > b ._ZN14__gnu_parallel9_SettingsC1Ev.localalias.0 > > The code where it's hanging is the AIX "glink" code, essentially a PLT > stub, trying to call the method ._ZN14__gnu_parallel9_SettingsC1Ev
I see, one can get this with -fno-inline more easily and probably it affects 4.9, too. > > The linker is not seeing the local definition of > ._ZN14__gnu_parallel9_SettingsC1Ev. libstdc++ is built with > Linux-like semantics, so it allows symbols to be overridden. AIX calls > everything through the PLT. But the real definition of the function is Even static functions? > not being seen. > > I'm not exactly sure why inlining changing this and what these extra > levels of indirections are trying to accomplish. The visibility of the To avoid using PLT and GOT when the unit refers to the symbol and we know that interposition does not matter. 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? > symbols as declared in the XCOFF assembly files appears to be > preventing the AIX linker and loader from resolving the static > constructor functions. 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) I can get simliar code with -fno-inline. Here we apparently handle first call correctly but fail in the second call. First is to static function other is to static alias of global function. Both should result in same code but doesn't One is: .lglobl ._GLOBAL__sub_I_parallel_settings.cc .csect _GLOBAL__sub_I_parallel_settings.cc[DS] _GLOBAL__sub_I_parallel_settings.cc: .long ._GLOBAL__sub_I_parallel_settings.cc, TOC[tc0], 0 .csect ..text.startup[PR],2 ._GLOBAL__sub_I_parallel_settings.cc: Other is .csect ._ZN14__gnu_parallel9_SettingsC1Ev[PR],2 .align 2 .align 4 .weak _ZN14__gnu_parallel9_SettingsC1Ev[DS] .weak ._ZN14__gnu_parallel9_SettingsC1Ev .csect _ZN14__gnu_parallel9_SettingsC1Ev[DS] _ZN14__gnu_parallel9_SettingsC1Ev: .long ._ZN14__gnu_parallel9_SettingsC1Ev, TOC[tc0], 0 .csect ._ZN14__gnu_parallel9_SettingsC1Ev[PR],2 ._ZN14__gnu_parallel9_SettingsC1Ev: .bi "/home/jh/trunk/build/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/parallel/settings.h" .stabx "_ZN14__gnu_parallel9_SettingsC1Ev:F-11",._ZN14__gnu_parallel9_SettingsC1Ev,142,0 .function ._ZN14__gnu_parallel9_SettingsC1Ev,._ZN14__gnu_parallel9_SettingsC1Ev,16,044,FE.._ZN14__gnu_parallel9_SettingsC1Ev-._ZN14__gnu_parallel9_SettingsC1Ev .... FE.._ZN14__gnu_parallel9_SettingsC1Ev: LFE..146: .lglobl ._ZN14__gnu_parallel9_SettingsC1Ev.localalias.0 .lglobl _ZN14__gnu_parallel9_SettingsC1Ev.localalias.0 .set ._ZN14__gnu_parallel9_SettingsC1Ev.localalias.0,._ZN14__gnu_parallel9_SettingsC1Ev .set _ZN14__gnu_parallel9_SettingsC1Ev.localalias.0,_ZN14__gnu_parallel9_SettingsC1Ev Let me see if I can derive something more self contained. Honza > > Thanks David