diff --git a/test/tools/gold/X86/error-unopenable.ll b/test/tools/gold/X86/error-unopenable.ll new file mode 100644 index 000000000000..c8532a5b187f --- /dev/null +++ b/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/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 50e102b04595..1ac542b28764 100644 --- a/tools/gold/gold-plugin.cpp +++ b/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( llvm::make_unique(FD, true)); };