Skip to content

Commit

Permalink
gold-plugin: Add the file path to the file open error diagnostic.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293013 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pcc committed Jan 25, 2017
1 parent 7b09fb7 commit 6e6c6de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions test/tools/gold/X86/error-unopenable.ll
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 2 additions & 1 deletion tools/gold/gold-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};
Expand Down

0 comments on commit 6e6c6de

Please sign in to comment.