This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/46770] Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them


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

--- Comment #83 from ccoutant at google dot com 2012-04-17 20:10:07 UTC ---
>> Didn't I just do that?
>
> Let me ask it again:
>
> The proposed --reverse-init-array switch will only reverse the order across
> translation units, while keeping the same order within translation unit.
> Is this correct?

Maybe I'm misunderstanding the question. As I said before:

If you have translation unit A with .ctors entries A1 and A2, and
translation unit B with .ctors entries B1 and B2, we'll build a
.init_array section with:

 B1
 B2
 A1
 A2

Expanding on that, we will reverse the order of the individual input
sections relative to one another, but we will not modify the contents
of any input section at all.

Everything I said for .ctors sections goes for .init_array sections,
since we just map .ctors -> .init_array on the way in, and treat them
as if they were .init_array sections from the beginning.

Paul suggested to me offline that maybe you're asking about
translation units with several .ctors or .init_array sections. Since
that doesn't happen in practice, I don't really care so much, and
would prefer to do the easy thing of just reversing the order of all
input sections, even to the point of reversing the order of the
sections within a translation unit. I think the important point is
that we do not reverse the order of entries within a single input
section.

-cary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]