summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/Common/ErrorHandler.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp
index d1cb3dbbe03..c059516daf9 100644
--- a/lld/Common/ErrorHandler.cpp
+++ b/lld/Common/ErrorHandler.cpp
@@ -47,8 +47,9 @@ ErrorHandler &lld::errorHandler() {
}
void lld::exitLld(int Val) {
- // Delete the output buffer so that any tempory file is deleted.
- errorHandler().OutputBuffer.reset();
+ // Delete any temporary file, while keeping the memory mapping open.
+ if (errorHandler().OutputBuffer)
+ errorHandler().OutputBuffer->discard();
// Dealloc/destroy ManagedStatic variables before calling
// _exit(). In a non-LTO build, this is a nop. In an LTO
OpenPOWER on IntegriCloud