summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-01-25 03:35:28 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-01-25 03:35:28 +0000
commit5b8a1bd4a2409f9ae5715911ba9c14203aeccf5e (patch)
tree75e0317ed1ba045b31cbe381b0fa016a9970a9e5
parenteb185e1f644105aadcc3fc1701dc2bbeafb05eae (diff)
downloadbcm5719-llvm-5b8a1bd4a2409f9ae5715911ba9c14203aeccf5e.tar.gz
bcm5719-llvm-5b8a1bd4a2409f9ae5715911ba9c14203aeccf5e.zip
gold-plugin: Add the file path to the file open error diagnostic.
llvm-svn: 293013
-rw-r--r--llvm/test/tools/gold/X86/error-unopenable.ll8
-rw-r--r--llvm/tools/gold/gold-plugin.cpp3
2 files changed, 10 insertions, 1 deletions
diff --git a/llvm/test/tools/gold/X86/error-unopenable.ll b/llvm/test/tools/gold/X86/error-unopenable.ll
new file mode 100644
index 00000000000..c8532a5b187
--- /dev/null
+++ b/llvm/test/tools/gold/X86/error-unopenable.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as -o %t %s
+; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=obj-path=%T/nonexistent-dir/foo.o \
+; RUN: %t -o %t2 2>&1 | FileCheck %s
+
+; CHECK: Could not open file {{.*}}nonexistent-dir
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 50e102b0459..1ac542b2876 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -826,7 +826,8 @@ static ld_plugin_status allSymbolsReadHook() {
std::error_code EC =
sys::fs::openFileForWrite(Filenames[Task], FD, sys::fs::F_None);
if (EC)
- message(LDPL_FATAL, "Could not open file: %s", EC.message().c_str());
+ message(LDPL_FATAL, "Could not open file %s: %s", Filenames[Task].c_str(),
+ EC.message().c_str());
return llvm::make_unique<lto::NativeObjectStream>(
llvm::make_unique<llvm::raw_fd_ostream>(FD, true));
};
OpenPOWER on IntegriCloud