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

--- Comment #94 from Ian Lance Taylor <ian at airs dot com> 2012-04-19 00:14:01 
UTC ---
It is misleading to think that the linker accumulates code in translation unit
order for a C++ program.  E.g., that is not what happens for template code or
string constants.  And of course the placement of functions called in different
translation units is arbitrary.

A lot of work was done in both GNU ld and gold to move constructors from .ctors
to .init_array, all to improve startup latency for firefox.  If that same
amount of work were done on better layout of initialization code, we would
improve all programs.

Gold already supports arbitrarily sophisticated section layout via plugins, and
I do not think it would be hard to add that support to GNU ld as well.

I really think that this whole approach has been chasing the wrong thing,
fixing a side effect rather than attempting to address the real problem.

In any case, on the issue at hand, changing the default order is the
conservative approach.  Firefox can use an option.

Reply via email to