[lld] r338959 - [LLD][ELF] - Added file name and a test for case when we fail to write the output.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 4 05:48:38 PDT 2018
Author: grimar
Date: Sat Aug 4 05:48:38 2018
New Revision: 338959
URL: http://llvm.org/viewvc/llvm-project?rev=338959&view=rev
Log:
[LLD][ELF] - Added file name and a test for case when we fail to write the output.
We did not report the file name and had no test for that case.
Added:
lld/trunk/test/ELF/driver-access2.test
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=338959&r1=338958&r2=338959&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sat Aug 4 05:48:38 2018
@@ -513,7 +513,8 @@ template <class ELFT> void Writer<ELFT>:
return;
if (auto E = Buffer->commit())
- error("failed to write to the output file: " + toString(std::move(E)));
+ error("failed to write to the output file " + Config->OutputFile + " :" +
+ toString(std::move(E)));
}
static bool shouldKeepInSymtab(SectionBase *Sec, StringRef SymName,
Added: lld/trunk/test/ELF/driver-access2.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/driver-access2.test?rev=338959&view=auto
==============================================================================
--- lld/trunk/test/ELF/driver-access2.test (added)
+++ lld/trunk/test/ELF/driver-access2.test Sat Aug 4 05:48:38 2018
@@ -0,0 +1,17 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+
+# RUN: rm -f %t.exe
+# RUN: mkdir -p %t.dir
+# RUN: cd %t.dir
+# RUN: touch %t.exe
+# RUN: chmod 100 %t.exe
+# RUN: not ld.lld %t.o -o %t.exe 2>&1 | FileCheck %s
+# RUN: chmod 755 %t.exe
+
+# CHECK: error: failed to write to the output file {{.*}}.exe :permission denied
+
+.globl _start
+_start:
+ nop
More information about the llvm-commits
mailing list