From 30a4020a7db866990199f523a60ad474d7ec3efa Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Sun, 16 Jan 2022 09:17:29 -0500 Subject: [PATCH] [LLD] Supplement with more comments. Clarify the intention in f860fe362282ed69b9d4503a20e5d20b9a041189. --- lld/Common/CommonLinkerContext.cpp | 5 ++++- lld/include/lld/Common/CommonLinkerContext.h | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lld/Common/CommonLinkerContext.cpp b/lld/Common/CommonLinkerContext.cpp index 75a58e84e03a..e4f6e367f78f 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 ba1074a7869d..3954d38ded63 100644 --- a/lld/include/lld/Common/CommonLinkerContext.h +++ b/lld/include/lld/Common/CommonLinkerContext.h @@ -47,7 +47,9 @@ private: 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 T &context() { -- 2.11.4.GIT