[llvm-commits] Fix constructor order on ARM/ELF

Evgeniy Stepanov eugeni.stepanov at gmail.com
Tue Dec 6 04:16:34 PST 2011


Yes, at the moment we only preserve constructor order inside a
translation unit.
AFAIK, gcc emits multiple init_array.<prio> sections, and therefore
preserves correct global constructor order.
On Sun, Dec 4, 2011 at 4:49 PM, Anton Korobeynikov
<anton at korobeynikov.info> wrote:
>> Side note: instead of emitting all the stuff into the same section, we
>> can emit the symbol into e.g. init_array.<priority> section and rely
>> on linker to emit all the stuff in the proper order.
> Ok, it seems we have to *always* emit stuff this way. Consider e.g.
> the following situation:
>
> File foo.o contains stuff with priorities of 100 & 200. We emit
> everything into single init_array section.
> File bar.o contains stuff with priorities of 150 & 250. We emit
> everything into single init_array section.
>
> Surely after linking the order of ctors will be wrong.
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University



More information about the llvm-commits mailing list