This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] Avoid one place of frontend calling into targetm
> Well, the patch fixes the simple testcases I tried, but does not
> completely return to the original behavior. With the patch, both
> _GLOBAL__I_copies and _GLOBAL__I_0_copies are generated, but
> _GLOBAL__I_copies no longer is global, so collect2 doesn't see it.
>
> In other words,
>
> .lglobl ._Z41__static_initialization_and_destruction_0ii
> ._Z41__static_initialization_and_destruction_0ii:
>
> ...
>
>
> .lglobl ._GLOBAL__I_copies
> ._GLOBAL__I_copies:
> bl ._Z41__static_initialization_and_destruction_0ii
>
> .globl ._GLOBAL__I_0_copies
> ._GLOBAL__I_0_copies:
> bl ._GLOBAL__I_copies
>
>
> _GLOBAL__I_0_copies -> _GLOBAL__I_copies
> -> _Z41__static_initialization_and_destruction_0ii
>
> but, at least, the initializer only is called once. Because this change
> in behavior does not return to the original assembly before the first
> patch, I tend to doubt that this patch fixes the regression correctly.
> But closer!
Well, actually this was intended (in fact the code was produced before
my patch too, just because of bug/misunderstanding in cgraph code it was
always optimized out as unreachable and accidentally made everything
working). With -O1 the constructor will be already inlined.
As a next step we can make C++ to register
._Z41__static_initialization_and_destruction_0ii itself, but for that I
would need cgraph code to obey the priorities and thus it is bit more
than I would like to do in this bugfix especially when -O1 code is not
affected.
Honza
>
> David