[llvm] r293013 - gold-plugin: Add the file path to the file open error diagnostic.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 19:35:28 PST 2017


Author: pcc
Date: Tue Jan 24 21:35:28 2017
New Revision: 293013

URL: http://llvm.org/viewvc/llvm-project?rev=293013&view=rev
Log:
gold-plugin: Add the file path to the file open error diagnostic.

Added:
    llvm/trunk/test/tools/gold/X86/error-unopenable.ll
Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Added: llvm/trunk/test/tools/gold/X86/error-unopenable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/error-unopenable.ll?rev=293013&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/error-unopenable.ll (added)
+++ llvm/trunk/test/tools/gold/X86/error-unopenable.ll Tue Jan 24 21:35:28 2017
@@ -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"

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=293013&r1=293012&r2=293013&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Tue Jan 24 21:35:28 2017
@@ -826,7 +826,8 @@ static ld_plugin_status allSymbolsReadHo
     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));
   };




More information about the llvm-commits mailing list