Reland "[LLD] Remove global state in lld/COFF" after fixing asan and msan test failures
Original commit description:
[LLD] Remove global state in lld/COFF
This patch removes globals from the lldCOFF library, by moving globals
into a context class (COFFLinkingContext) and passing it around wherever
it's needed.
See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for
context about removing globals from LLD.
I also haven't moved the `driver` or `config` variables yet.
Differential Revision: https://reviews.llvm.org/D109634
This reverts commit a2fd05ada9030eab2258fff25e77a05adccae128.
Original commits were b4fa71eed34d967195514fe9b0a5211fca2bc5bc
and e03c7e367adb8f228332e3c2ef8f45484597b719.
diff --git a/lld/COFF/CMakeLists.txt b/lld/COFF/CMakeLists.txt
index bbcd337..b32b9cf 100644
--- a/lld/COFF/CMakeLists.txt
+++ b/lld/COFF/CMakeLists.txt
@@ -5,6 +5,7 @@
add_lld_library(lldCOFF
CallGraphSort.cpp
Chunks.cpp
+ COFFLinkerContext.cpp
DebugTypes.cpp
DLL.cpp
Driver.cpp