PATCH: PR ld/12730: regression] crash when allocating in a static constructor

Alan Modra amodra@gmail.com
Thu May 5 08:27:00 GMT 2011


On Wed, May 04, 2011 at 10:18:32PM -0700, H.J. Lu wrote:
> When we put .ctors into .init_array, we have to reverse copy .ctors secton.
> Otherwise, constructor function may not work with C++ run-time library
> correctly.  OK for trunk?

What about .dtors?  You have the same problem there.  I suspect, but
haven't verified, that .ctors.* and .dtors.* also need reversing.  If
that is true then it would be better to do your reversing trick for
anything going to the .init_array output section that isn't named
.init_array* and similarly for .fini_array.

You also need to reverse any dynamic relocations applying to the
sections you are reversing.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list