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

Alan Modra
Mon May 9 13:53:00 GMT 2011

I'm starting to wonder whether ld/testsuite/ld-elf/ is
valid.  Does gcc actually make any guarantee about order of static
constructors and __attribute ((constructor)) functions?

Compiled with gcc-4.3 branch g++, the testcase segfaults at all
optimization levels.  Compiled with gcc-4.4 branch g++, the testcase
runs at -O0 but segfaults at -O1 and above.  It happens to run OK with
gcc mainline and 4.6.  Given that behaviour, and the fact that some
popular distros ship gcc-4.4 based compilers, I'm thinking that the
testcase should be removed.

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list