From 85b8d0ca7c98b1c97369e5fb2c7941da3c489b78 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 8 Nov 2017 23:07:32 +0000 Subject: [PATCH] Handle "-" in tryCreateFile. Otherwise we would fail with -M if the we didn't have write permissions to the current directory. llvm-svn: 317740 --- lld/ELF/Filesystem.cpp | 2 ++ lld/test/ELF/driver-access.test | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lld/ELF/Filesystem.cpp b/lld/ELF/Filesystem.cpp index 1aa3453..a7c25c9 100644 --- a/lld/ELF/Filesystem.cpp +++ b/lld/ELF/Filesystem.cpp @@ -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()); } diff --git a/lld/test/ELF/driver-access.test b/lld/test/ELF/driver-access.test index 5209483..46b87c1 100644 --- a/lld/test/ELF/driver-access.test +++ b/lld/test/ELF/driver-access.test @@ -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 -- 2.7.4