> The GNU linker has support to merge .ctor's into init_array. Does the > gold linker have the same feature? This seems more like the real fix > rather than just hacking around the issue.
Recent version have it. I found the bug when using gold 2.21 which doesn't. What seems to happen is: * In an old linux system, the linker leaves ctors in .ctors, crtbeginS.o has a call to __do_global_dtors_aux. The net result is that _init calls the constructors. * In an all new linux system, the compiler uses .init_array (or the linker moves it there) and crtbeginS.o has nothing to do with constructors. * If we have a compiler that doesn't use .init_array and gold 2.21 in a new linux system, we hit the bug. So this is not as bad as I was expecting (old programs still work), but it is still a somewhat annoying ABI change to handle. I think we can add support for this in clang in 3 ways: 1) Require new linkers when using gcc 4.7 libraries. 2) Ship our own versions of crtbeginS.o (and similars). 3) Use .init_array when using gcc 4.7 libraries. I have most of option 3 implemented. Chandler, do you still think that this is a big enough ABI breakage that it should not be supported? > Thanks, > Andrew Pinski Cheers, Rafael
