// is called. We use that class without calling commit() to predict
// if the given file is writable.
std::error_code elf::tryCreateFile(StringRef Path) {
+ if (Path.empty())
+ return std::error_code();
return FileOutputBuffer::create(Path, 1).getError();
}
--- /dev/null
+# REQUIRES: x86, shell
+# Make sure that LLD works even if the current directory is not writable.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: ld.lld %t.o -o %t.exe
+
+# RUN: mkdir -p %t.dir
+# RUN: chmod 100 %t.dir
+# RUN: cd %t.dir
+# RUN: ld.lld %t.o -o %t.exe
+
+.globl _start
+_start:
+ nop