Skip to content

Commit a9e92be

Browse files
committed
[ELF] openAuxiliaryFile: open /dev/null if disableOutput and filename is "-"
So that LLD_IN_TEST=2 ld.lld --print-archive-stats=- a.o (and -Map -) only writes the output once.
1 parent 6b87f01 commit a9e92be

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lld/ELF/Driver.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ llvm::raw_fd_ostream Ctx::openAuxiliaryFile(llvm::StringRef filename,
105105
using namespace llvm::sys::fs;
106106
OpenFlags flags =
107107
auxiliaryFiles.insert(filename).second ? OF_None : OF_Append;
108+
if (e.disableOutput && filename == "-") {
109+
#ifdef _WIN32
110+
filename = "NUL";
111+
#else
112+
filename = "/dev/null";
113+
#endif
114+
}
108115
return {filename, ec, flags};
109116
}
110117

0 commit comments

Comments
 (0)