[llvm-dev] LLD: patch to fix libCOFF calling exit() on success in a library function
Andrew Kelley via llvm-dev
llvm-dev at lists.llvm.org
Thu Aug 31 10:45:47 PDT 2017
I believe that LLD is not supposed to call exit on success when you
call lld::coff::link.
>From downstream fork of LLD:
https://github.com/zig-lang/zig/commit/41da9fdb69065082f57c604b12eb02ca166cb18d
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 854c3e69098..8b17f039870 100644
--- a/lld/COFF/Driver.cpp
+++ b/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
@@ -1122,7 +1122,7 @@ void LinkerDriver::link(ArrayRef<const char *>
ArgsArr) {
// This is useful because MSVC link.exe can generate complete PDBs.
if (Args.hasArg(OPT_msvclto)) {
invokeMSVC(Args);
- exit(0);
+ return;
}
// Do LTO by compiling bitcode input files to a set of native COFF files
then
@@ -1173,8 +1173,7 @@ void LinkerDriver::link(ArrayRef<const char *>
ArgsArr) {
// Write the result.
writeResult(&Symtab);
- // Call exit to avoid calling destructors.
- exit(0);
+ return;
}
} // namespace coff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170831/f93e377c/attachment.html>
More information about the llvm-dev
mailing list