[lld] r248724 - ELF2: Include file names in error messages.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 11:20:41 PDT 2015


Author: ruiu
Date: Mon Sep 28 13:20:41 2015
New Revision: 248724

URL: http://llvm.org/viewvc/llvm-project?rev=248724&view=rev
Log:
ELF2: Include file names in error messages.

Modified:
    lld/trunk/ELF/InputFiles.h
    lld/trunk/test/elf2/invalid-elf.test

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=248724&r1=248723&r2=248724&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Mon Sep 28 13:20:41 2015
@@ -221,7 +221,7 @@ std::unique_ptr<ELFFileBase> createELFFi
   std::pair<unsigned char, unsigned char> Type =
     object::getElfArchType(MB.getBuffer());
   if (Type.second != ELF::ELFDATA2LSB && Type.second != ELF::ELFDATA2MSB)
-    error("Invalid data encoding");
+    error("Invalid data encoding: " + MB.getBufferIdentifier());
 
   if (Type.first == ELF::ELFCLASS32) {
     if (Type.second == ELF::ELFDATA2LSB)
@@ -233,7 +233,7 @@ std::unique_ptr<ELFFileBase> createELFFi
       return make_unique<T<object::ELF64LE>>(MB);
     return make_unique<T<object::ELF64BE>>(MB);
   }
-  error("Invalid file class");
+  error("Invalid file class: " + MB.getBufferIdentifier());
 }
 
 } // namespace elf2

Modified: lld/trunk/test/elf2/invalid-elf.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/invalid-elf.test?rev=248724&r1=248723&r2=248724&view=diff
==============================================================================
--- lld/trunk/test/elf2/invalid-elf.test (original)
+++ lld/trunk/test/elf2/invalid-elf.test Mon Sep 28 13:20:41 2015
@@ -1,10 +1,10 @@
 RUN: not lld -flavor gnu2 %p/Inputs/invalid-data-encoding.elf -o %t2 2>&1 | \
 RUN:   FileCheck --check-prefix=INVALID-DATA-ENC %s
-INVALID-DATA-ENC: Invalid data encoding
+INVALID-DATA-ENC: Invalid data encoding: {{.*}}/invalid-data-encoding.elf
 
 RUN: not lld -flavor gnu2 %p/Inputs/invalid-file-class.elf -o %t2 2>&1 | \
 RUN:   FileCheck --check-prefix=INVALID-FILE-CLASS %s
-INVALID-FILE-CLASS: Invalid file class
+INVALID-FILE-CLASS: Invalid file class: {{.*}}/invalid-file-class.elf
 
 RUN: not lld -flavor gnu2 %p/Inputs/invalid-symtab-sh_info.elf -o %t2 2>&1 | \
 RUN:   FileCheck --check-prefix=INVALID-SYMTAB-SHINFO %s




More information about the llvm-commits mailing list