[LLD][COFF] Cover usage of LLD-as-a-library in tests
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>
Thu, 24 Sep 2020 19:00:43 +0000 (15:00 -0400)
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>
Thu, 24 Sep 2020 19:07:50 +0000 (15:07 -0400)
commitf2efb5742cc9f74ad73987760651e3d23894a416
tree14495dbbb4781db5f7c6e93cfe4e40d3d6c4f2e9
parent55624237be725a6feef84db7f46147335e68ebab
[LLD][COFF] Cover usage of LLD-as-a-library in tests

In lit tests, we run each LLD invocation twice (LLD_IN_TEST=2), without shutting down the process in-between. This ensures a full cleanup is properly done between runs.
Only active for the COFF driver for now. Other drivers still use LLD_IN_TEST=1 which executes just one iteration with full cleanup, like before.
When the environment variable LLD_IN_TEST is unset, a shortcut is taken, only one iteration is executed, no cleanup for faster exit, like before.
A public API, lld::safeLldMain(), is also available when using LLD as a library.

Differential Revision: https://reviews.llvm.org/D70378
12 files changed:
lld/COFF/Driver.cpp
lld/COFF/Writer.cpp
lld/COFF/Writer.h
lld/Common/ErrorHandler.cpp
lld/ELF/Driver.cpp
lld/MachO/Driver.cpp
lld/include/lld/Common/Driver.h
lld/include/lld/Common/ErrorHandler.h
lld/lib/Driver/DarwinLdDriver.cpp
lld/test/COFF/lit.local.cfg [new file with mode: 0644]
lld/tools/lld/lld.cpp
lld/wasm/Driver.cpp