Index: ELF/InputSection.cpp =================================================================== --- ELF/InputSection.cpp +++ ELF/InputSection.cpp @@ -288,14 +288,17 @@ // Returns a source location string. Used to construct an error message. template std::string InputSectionBase::getLocation(uint64_t Offset) { + std::string SecAndOffset = (Name + "+0x" + utohexstr(Offset)).str(); + // We don't have file for synthetic sections. if (getFile() == nullptr) - return (Config->OutputFile + ":(" + Name + "+0x" + utohexstr(Offset) + ")") + return (Config->OutputFile + ":(" + SecAndOffset + ")") .str(); // First check if we can get desired values from debugging information. if (Optional Info = getFile()->getDILineInfo(this, Offset)) - return Info->FileName + ":" + std::to_string(Info->Line); + return Info->FileName + ":" + std::to_string(Info->Line) + ":(" + + SecAndOffset + ")"; // File->SourceFile contains STT_FILE symbol that contains a // source file name. If it's missing, we use an object file name. @@ -304,10 +307,10 @@ SrcFile = toString(File); if (Defined *D = getEnclosingFunction(Offset)) - return SrcFile + ":(function " + toString(*D) + ")"; + return SrcFile + ":(function " + toString(*D) + ": " + SecAndOffset + ")"; // If there's no symbol, print out the offset in the section. - return (SrcFile + ":(" + Name + "+0x" + utohexstr(Offset) + ")").str(); + return (SrcFile + ":(" + SecAndOffset + ")"); } // This function is intended to be used for constructing an error message. Index: test/ELF/ppc64-split-stack-adjust-overflow.s =================================================================== --- test/ELF/ppc64-split-stack-adjust-overflow.s +++ test/ELF/ppc64-split-stack-adjust-overflow.s @@ -20,7 +20,7 @@ # RUN: ld.lld %t1.o %t2.o -o %t --defsym __morestack=0x10010000 -split-stack-adjust-size 4096 # RUN: llvm-objdump -d %t | FileCheck %s -# OVERFLOW: error: {{.*}}.o:(function caller): split-stack prologue adjustment overflows +# OVERFLOW: error: {{.*}}.o:(function caller: .text+0x8): split-stack prologue adjustment overflows .p2align 2 .global caller Index: test/ELF/x86-64-reloc-error2.s =================================================================== --- test/ELF/x86-64-reloc-error2.s +++ test/ELF/x86-64-reloc-error2.s @@ -4,7 +4,7 @@ ## Check we are able to find a function symbol that encloses ## a given location when reporting error messages. -# CHECK: {{.*}}.o:(function func): relocation R_X86_64_32S out of range: -281474974609408 is not in [-2147483648, 2147483647] +# CHECK: {{.*}}.o:(function func: .text.func+0x3): relocation R_X86_64_32S out of range: -281474974609408 is not in [-2147483648, 2147483647] # This mergeable section will be garbage collected. We had a crash issue in that case. Test it. .section .rodata.str1,"aMS",@progbits,1 Index: test/ELF/x86-64-reloc-range-debug-loc.s =================================================================== --- test/ELF/x86-64-reloc-range-debug-loc.s +++ test/ELF/x86-64-reloc-range-debug-loc.s @@ -5,7 +5,7 @@ ## Check we are able to report file and location from debug information ## when reporting such kind of errors. -# CHECK: error: test.s:3: relocation R_X86_64_32 out of range: 68719476736 is not in [0, 4294967295] +# CHECK: error: test.s:3:(.text+0x1): relocation R_X86_64_32 out of range: 68719476736 is not in [0, 4294967295] .section .text,"ax",@progbits foo: