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

--- Comment #79 from Cary Coutant <ccoutant at gcc dot gnu.org> 2012-04-17 
18:00:41 UTC ---
(In reply to comment #77)
> I believe .init_array keeps the same order of .ctors within
> the same translation unit.  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?

Yes. 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

As Paul noted, this is a moot point in practice for .ctors, since GCC emits
only a single .ctors entry per TU, but it could be significant for assembly
code or for TUs with .init_array sections.

-cary

Reply via email to