[PATCH] D103495: [static initializers] Don't put ordered dynamic initializers of static variables into global_ctors

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 2 14:22:08 PDT 2021


rnk added a comment.

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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103495/new/

https://reviews.llvm.org/D103495



More information about the cfe-commits mailing list