[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 15:46:40 PDT 2021


rnk added a comment.

In D103495#2794870 <https://reviews.llvm.org/D103495#2794870>, @wolfgangp wrote:

> For PS4, we use the .ctors scheme, and so the initialization order was suddenly reversed, which was not noticed for a while until the user had a  dependency on the previous initialization. And using init_array or not has currently no effect on the order of emission of global_ctors.

Exactly, that's my suggestion: if fno-use-init-array is set, emit global_ctors into the .ctors section in reverse order. That way -fno-use-init-array doesn't reverse the order of initialization *inside* a given LLVM module, even if it reverses the order in which *modules* are initialized.


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

https://reviews.llvm.org/D103495



More information about the cfe-commits mailing list