[PATCH] D109634: [LLD] Remove global state in lld/COFF

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 15:53:38 PDT 2021


aganea added a comment.

Thank you Amy for all this!



================
Comment at: lld/COFF/CMakeLists.txt:4
 add_public_tablegen_target(COFFOptionsTableGen)
 
 add_lld_library(lldCOFF
----------------
Can the following be added here? What would be missing for this to work?
```
# Enable errors for any global constructors.
add_flag_if_supported("-Werror=global-constructors" WERROR_GLOBAL_CONSTRUCTOR)
```


================
Comment at: lld/COFF/ICF.cpp:40
 
 static Timer icfTimer("ICF", Timer::root());
 
----------------
Same question here, move to locals if possible.


================
Comment at: lld/COFF/SymbolTable.cpp:38
 
 static Timer ltoTimer("LTO", Timer::root());
 
----------------
Can this be moved to `SymbolTable`?


================
Comment at: lld/COFF/Writer.cpp:86
 // this can be indexed by Chunk::getOutputSection.
-static std::vector<OutputSection *> outputSections;
+// static std::vector<OutputSection *> outputSections;
 
----------------
These commented out bits should probably be removed.


================
Comment at: lld/COFF/Writer.cpp:314
 
 static Timer codeLayoutTimer("Code Layout", Timer::root());
 static Timer diskCommitTimer("Commit Output File", Timer::root());
----------------
Can these `Timer` globals be moved to non-static members of the `Writer` class?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109634



More information about the llvm-commits mailing list