[lld] 30a4020 - [LLD] Supplement with more comments. Clarify the intention in f860fe362282ed69b9d4503a20e5d20b9a041189.

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 16 06:17:46 PST 2022


Author: Alexandre Ganea
Date: 2022-01-16T09:17:39-05:00
New Revision: 30a4020a7db866990199f523a60ad474d7ec3efa

URL: https://github.com/llvm/llvm-project/commit/30a4020a7db866990199f523a60ad474d7ec3efa
DIFF: https://github.com/llvm/llvm-project/commit/30a4020a7db866990199f523a60ad474d7ec3efa.diff

LOG: [LLD] Supplement with more comments. Clarify the intention in f860fe362282ed69b9d4503a20e5d20b9a041189.

Added: 
    

Modified: 
    lld/Common/CommonLinkerContext.cpp
    lld/include/lld/Common/CommonLinkerContext.h

Removed: 
    


################################################################################
diff  --git a/lld/Common/CommonLinkerContext.cpp b/lld/Common/CommonLinkerContext.cpp
index 75a58e84e03a8..e4f6e367f78fb 100644
--- a/lld/Common/CommonLinkerContext.cpp
+++ b/lld/Common/CommonLinkerContext.cpp
@@ -13,7 +13,10 @@
 using namespace llvm;
 using namespace lld;
 
-// Reference to the current LLD instance.
+// Reference to the current LLD instance. This is a temporary situation, until
+// we pass this context everywhere by reference, or we make it a thread_local,
+// as in https://reviews.llvm.org/D108850?id=370678 where each thread can be
+// associated with a LLD instance. Only then will LLD be free of global state.
 static CommonLinkerContext *lctx;
 
 CommonLinkerContext::CommonLinkerContext() { lctx = this; }

diff  --git a/lld/include/lld/Common/CommonLinkerContext.h b/lld/include/lld/Common/CommonLinkerContext.h
index ba1074a7869d1..3954d38ded636 100644
--- a/lld/include/lld/Common/CommonLinkerContext.h
+++ b/lld/include/lld/Common/CommonLinkerContext.h
@@ -47,7 +47,9 @@ class CommonLinkerContext {
   llvm::codegen::RegisterCodeGenFlags cgf;
 };
 
-// Retrieve the global state. Only one state can exist per application.
+// Retrieve the global state. Currently only one state can exist per process,
+// but in the future we plan on supporting an arbitrary number of LLD instances
+// in a single process.
 CommonLinkerContext &commonContext();
 
 template <typename T = CommonLinkerContext> T &context() {


        


More information about the llvm-commits mailing list