[PATCH] D119913: [lld-macho] Make RegisterCodeFlags a file-scope static again

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 16 06:18:58 PST 2022


aganea added a comment.

Ideally `RegisterCodeGenFlags` should be a function call not a class, since it only registers static `cl::opt`s. I think you can simply remove `cgf` from `CommonLinkerContext.h` and create a short-lived `llvm::codegen::RegisterCodeGenFlags` object on the stack inside the `CommonLinkerContext` constructor definition.

Truly, D108850 <https://reviews.llvm.org/D108850> does not solve yet the multi-threading issues with `cl::opt`s. This is something I wanted to address later (I have a few patches ready). However in the meanwhile, the objective with D108850 <https://reviews.llvm.org/D108850> was also to enable `-Werror=global-constructors`, at least in lldCommon and lldCOFF.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119913



More information about the llvm-commits mailing list