[Bug target/46770] Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them
mark at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Sat Dec 11 23:55:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
--- Comment #36 from Mark Mitchell <mark at codesourcery dot com> 2010-12-11 23:54:44 UTC ---
On 12/11/2010 3:48 PM, hjl.tools at gmail dot com wrote:
> 1. __attribute__((init_priority(1005))) doesn't map to
> .ctors.1005 section.
It probably maps to .ctors.(65535-1005). There is most definitely a
direct relationship.
> 2. You need to check .init_array.NNNN sections on some
> platforms.
Not now -- because on most platforms those sections aren't used. The
whole point of this PR is to consider switching to .init_array. If we
do that, then, yes, you need to use those sections *and* interleave
correctly with .ctors sections.
>>> 2. How do you run your constructor before "foo"?
>>
>> Given it a higher priority.
>
> The highest priority is 65535. What if foo's
> constructor already has 65535 priority?
There is a maximum priority; you can't have a higher priority than that.
But, so what? Your question is like asking "how do you make a unsigned
int bigger than UINT_MAX?"
In any case, this is totally irrelevant to the issue of mixing .ctors
and .init_array.
> That is the constructor order between A and B. We don't support
> "interleaving constructor priorities" between object files.
Yes, we do. We have for a very long time. This is why the linker sorts
the .ctors sections.
More information about the Gcc-bugs
mailing list