[lld] r317740 - Handle "-" in tryCreateFile.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 15:07:32 PST 2017


Author: rafael
Date: Wed Nov  8 15:07:32 2017
New Revision: 317740

URL: http://llvm.org/viewvc/llvm-project?rev=317740&view=rev
Log:
Handle "-" in tryCreateFile.

Otherwise we would fail with -M if the we didn't have write
permissions to the current directory.

Modified:
    lld/trunk/ELF/Filesystem.cpp
    lld/trunk/test/ELF/driver-access.test

Modified: lld/trunk/ELF/Filesystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Filesystem.cpp?rev=317740&r1=317739&r2=317740&view=diff
==============================================================================
--- lld/trunk/ELF/Filesystem.cpp (original)
+++ lld/trunk/ELF/Filesystem.cpp Wed Nov  8 15:07:32 2017
@@ -80,5 +80,7 @@ void elf::unlinkAsync(StringRef Path) {
 std::error_code elf::tryCreateFile(StringRef Path) {
   if (Path.empty())
     return std::error_code();
+  if (Path == "-")
+    return std::error_code();
   return errorToErrorCode(FileOutputBuffer::create(Path, 1).takeError());
 }

Modified: lld/trunk/test/ELF/driver-access.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/driver-access.test?rev=317740&r1=317739&r2=317740&view=diff
==============================================================================
--- lld/trunk/test/ELF/driver-access.test (original)
+++ lld/trunk/test/ELF/driver-access.test Wed Nov  8 15:07:32 2017
@@ -7,7 +7,7 @@
 # RUN: mkdir -p %t.dir
 # RUN: chmod 100 %t.dir
 # RUN: cd %t.dir
-# RUN: ld.lld %t.o -o %t.exe
+# RUN: ld.lld %t.o -o %t.exe -M
 # RUN: chmod 755 %t.dir
 
 .globl _start




More information about the llvm-commits mailing list