Index: ELF/InputFiles.cpp =================================================================== --- ELF/InputFiles.cpp +++ ELF/InputFiles.cpp @@ -764,12 +764,12 @@ unsigned char Endian; std::tie(Size, Endian) = getElfArchType(MB.getBuffer()); if (Endian != ELFDATA2LSB && Endian != ELFDATA2MSB) - fatal("invalid data encoding: " + MB.getBufferIdentifier()); + fatal(MB.getBufferIdentifier() + ": invalid data encoding"); size_t BufSize = MB.getBuffer().size(); if ((Size == ELFCLASS32 && BufSize < sizeof(Elf32_Ehdr)) || (Size == ELFCLASS64 && BufSize < sizeof(Elf64_Ehdr))) - fatal("file is too short"); + fatal(MB.getBufferIdentifier() + ": file is too short"); InputFile *Obj; if (Size == ELFCLASS32 && Endian == ELFDATA2LSB) @@ -781,7 +781,7 @@ else if (Size == ELFCLASS64 && Endian == ELFDATA2MSB) Obj = make>(MB); else - fatal("invalid file class: " + MB.getBufferIdentifier()); + fatal(MB.getBufferIdentifier() + ": invalid file class"); if (!Config->FirstElf) Config->FirstElf = Obj; Index: ELF/InputSection.cpp =================================================================== --- ELF/InputSection.cpp +++ ELF/InputSection.cpp @@ -15,6 +15,7 @@ #include "LinkerScript.h" #include "Memory.h" #include "OutputSections.h" +#include "Relocations.h" #include "SyntheticSections.h" #include "Target.h" #include "Thunks.h" @@ -97,7 +98,7 @@ // Returns a string for an error message. template static std::string getName(SectionT *Sec) { - return (Sec->getFile()->getName() + "(" + Sec->Name + ")").str(); + return (Sec->getFile()->getName() + ":(" + Sec->Name + ")").str(); } template @@ -455,7 +456,7 @@ SymbolBody &Sym = this->File->getRelocTargetSym(Rel); if (Target->getRelExpr(Type, Sym) != R_ABS) { - error(getName(this) + " has non-ABS reloc"); + error(getLocation(*this, Offset) + ": has non-ABS reloc"); return; } Index: ELF/LTO.cpp =================================================================== --- ELF/LTO.cpp +++ ELF/LTO.cpp @@ -104,7 +104,7 @@ void BitcodeCompiler::add(BitcodeFile &F) { lto::InputFile &Obj = *F.Obj; if (Obj.getDataLayoutStr().empty()) - fatal("invalid bitcode file: " + F.getName() + " has no datalayout"); + fatal(F.getName() + ": is invlid - no datalayout"); unsigned SymNum = 0; std::vector Syms = F.getSymbols(); Index: test/ELF/invalid/invalid-elf.test =================================================================== --- test/ELF/invalid/invalid-elf.test +++ test/ELF/invalid/invalid-elf.test @@ -2,11 +2,11 @@ # RUN: not ld.lld %t %p/Inputs/data-encoding.a -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-DATA-ENC %s -# INVALID-DATA-ENC: invalid data encoding: test.o +# INVALID-DATA-ENC: test.o: invalid data encoding # RUN: not ld.lld %t %p/Inputs/file-class.a -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-FILE-CLASS %s -# INVALID-FILE-CLASS: invalid file class: test.o +# INVALID-FILE-CLASS: test.o: invalid file class # RUN: not ld.lld %p/Inputs/symtab-sh_info.elf -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=INVALID-SYMTAB-SHINFO %s Index: test/ELF/lto/invalid-bitcode.ll =================================================================== --- test/ELF/lto/invalid-bitcode.ll +++ test/ELF/lto/invalid-bitcode.ll @@ -2,7 +2,7 @@ ; RUN: llvm-as %s -o %t.o ; RUN: not ld.lld -m elf_x86_64 %t.o 2>&1 | FileCheck %s -; CHECK: invalid bitcode file: +; CHECK: {{.*}}: is invalid - no datalayout ; This bitcode file has no datalayout. target triple = "x86_64-unknown-linux-gnu" Index: test/ELF/merge-string-error.s =================================================================== --- test/ELF/merge-string-error.s +++ test/ELF/merge-string-error.s @@ -8,4 +8,4 @@ .data .long .rodata.str1.1 + 4 -// CHECK: merge-string-error.s.tmp.o(.rodata.str1.1): entry is past the end of the section +// CHECK: merge-string-error.s.tmp.o:(.rodata.str1.1): entry is past the end of the section Index: test/ELF/non-abs-reloc.s =================================================================== --- test/ELF/non-abs-reloc.s +++ test/ELF/non-abs-reloc.s @@ -0,0 +1,11 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s +// CHECK: {{.*}}:(.dummy+0x0): has non-ABS reloc + +.globl _start +_start: + nop + +.section .dummy + .long foo@gotpcrel Index: test/ELF/relocation-past-merge-end.s =================================================================== --- test/ELF/relocation-past-merge-end.s +++ test/ELF/relocation-past-merge-end.s @@ -1,7 +1,7 @@ // REQUIRES: x86 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux // RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s -// CHECK: relocation-past-merge-end.s.tmp.o(.foo): entry is past the end of the section +// CHECK: relocation-past-merge-end.s.tmp.o:(.foo): entry is past the end of the section .data .long .foo + 10