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

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 24 07:37:14 PST 2022


aganea added inline comments.


================
Comment at: lld/COFF/Driver.cpp:1239
   ScopedTimer rootTimer(ctx.rootTimer);
+  Configuration &config = ctx.config;
 
----------------
akhuang wrote:
> aganea wrote:
> > Sorry I actually meant `Configuration *config = &ctx.config;` just so that you don’t have all these changes below when you do a git blame.
> haha right, makes sense
Up to your discretion, I think you can apply the same "recipe" in a few other places (see other comments).


================
Comment at: lld/COFF/DriverUtils.cpp:100
+void LinkerDriver::parseGuard(StringRef fullArg) {
   SmallVector<StringRef, 1> splitArgs;
   fullArg.split(splitArgs, ",");
----------------
And here?


================
Comment at: lld/COFF/Writer.cpp:972
 
   // Create Debug Information Chunks
+  OutputSection *debugInfoSec = ctx.config.mingw ? buildidSec : rdataSec;
----------------
And here?


================
Comment at: lld/COFF/Writer.cpp:1363
 
   // Write COFF header
   auto *coff = reinterpret_cast<coff_file_header *>(buf);
----------------
And here.


================
Comment at: lld/COFF/Writer.cpp:1705
 
   // Add the longjmp target table unless the user told us not to.
+  if (ctx.config.guardCF & GuardCFLevel::LongJmp)
----------------
Maybe here too.


================
Comment at: lld/COFF/Writer.cpp:1890
 void Writer::writeBuildId() {
   // There are two important parts to the build ID.
   // 1) If building with debug info, the COFF debug directory contains a
----------------
You could probably do the same thing here: `Configuration *config = ctx.config;`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110450



More information about the llvm-commits mailing list