http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770

--- Comment #29 from Mark Mitchell <mark at codesourcery dot com> 2010-12-11 
21:06:41 UTC ---
On 12/11/2010 1:01 PM, hubicka at ucw dot cz wrote:

> So I take that, the ctor order is to support priotities, since the
> .ctor.priority sections get merged into single and ordered in increasing 
> rather
> than decreasing order, while init_array gets around the problem.

I don't think "gets around the problem" is true.  In both cases, you
need to honor the order of constructor priorities.  That's a GNU C
extension, so not part of most standard ABIs, but it's one people use.
Whether you use .ctor.* or .init_array, you have a bunch of stuff that
has to run in a particular order and the linker has to make sure that
happens.

> Can't linker be told to translate .ctor section into init_array upon
> seeing the fact that both are used? (or just do it by default)

Maybe...

Certainly, linker magic seems like the obvious way to solve a binary
compatibility problem.

Reply via email to