[llvm-dev] LLD COFF not closing mmaps to input files?

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Sun Oct 15 18:45:26 PDT 2017


I've got a patched LLD 5.0.0 like this:

diff --git a/deps/lld/COFF/Driver.cpp b/deps/lld/COFF/Driver.cpp
index 854c3e69..8bab1c11 100644
--- a/deps/lld/COFF/Driver.cpp
+++ b/deps/lld/COFF/Driver.cpp
@@ -1030,7 +1030,7 @@ void LinkerDriver::link(ArrayRef<const char *>
ArgsArr) {
   if (!Args.hasArgNoClaim(OPT_INPUT)) {
     fixupExports();
     createImportLibrary(/*AsLib=*/true);
-    exit(0);
+    return;
   }

   // Handle /delayload
@@ -1172,9 +1172,6 @@ void LinkerDriver::link(ArrayRef<const char *>
ArgsArr) {

   // Write the result.
   writeResult(&Symtab);
-
-  // Call exit to avoid calling destructors.
-  exit(0);
 }

 } // namespace coff


I'm getting this error from LLVM:
unable to write object file
c:\msys64\home\andy\zig\zig-cache\compiler_rt.obj: The requested operation
cannot be performed on a file with a user-mapped section open.

The same process calls LLD with this .obj as  a linker input file, then
tries to write to the same .obj file later.

I believe LLD is mmapping the .obj file and then not cleaning it up.

Can I have some guidance as to where in the code I could discover this and
clean it up?

Regards,
Andrew
http://ziglang.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171015/7176b54e/attachment.html>


More information about the llvm-dev mailing list