[PATCH] D103495: [static initializers] Don't put ordered dynamic initializers of static variables into global_ctors
Yuanfang Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 2 14:47:58 PDT 2021
ychen added a comment.
In D103495#2794684 <https://reviews.llvm.org/D103495#2794684>, @rnk wrote:
> In D103495#2794667 <https://reviews.llvm.org/D103495#2794667>, @ychen wrote:
>
>> Is there anything preventing us from using the existing priority field to define the order instead of introducing the order among initializers with the same priority? If we go with 1., there would be no way to say that "the order does not matter" right?
>
> The priority is used mainly for inter-object initialization order. It moves the initializer into a `.init_array.N` section, for some number `N`. The programmer may be using existing numbers via `__attribute__((init_priority(N)))`, so it isn't safe for the compiler to use anything other than the default initialization priority.
I see. It makes sense to define the order at IR level then since the order is there in `.init_array.N`/`.ctors` section nevertheless.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103495/new/
https://reviews.llvm.org/D103495
More information about the cfe-commits
mailing list