[lld] 4a4ce14 - [ELF] Mention symbol name in reportRangeError()
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 09:40:56 PST 2020
Author: Fangrui Song
Date: 2020-01-29T09:38:25-08:00
New Revision: 4a4ce14eb2c6b35719d57c2c25cbee7e79d19cb0
URL: https://github.com/llvm/llvm-project/commit/4a4ce14eb2c6b35719d57c2c25cbee7e79d19cb0
DIFF: https://github.com/llvm/llvm-project/commit/4a4ce14eb2c6b35719d57c2c25cbee7e79d19cb0.diff
LOG: [ELF] Mention symbol name in reportRangeError()
For an out-of-range relocation referencing a non-local symbol, report the symbol name and the object file that defines the symbol. As an example:
```
t.o:(function func: .text.func+0x3): relocation R_X86_64_32S out of range: -281474974609120 is not in [-2147483648, 2147483647]
```
=>
```
t.o:(function func: .text.func+0x3): relocation R_X86_64_32S out of range: -281474974609120 is not in [-2147483648, 2147483647]; references func
>>> defined in t1.o
```
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D73518
Added:
Modified:
lld/ELF/Relocations.cpp
lld/ELF/Target.h
lld/test/ELF/aarch64-abs16.s
lld/test/ELF/aarch64-abs32.s
lld/test/ELF/aarch64-prel16.s
lld/test/ELF/aarch64-prel32.s
lld/test/ELF/hexagon-jump-error.s
lld/test/ELF/i386-reloc-16.s
lld/test/ELF/i386-reloc-8.s
lld/test/ELF/i386-reloc-range.s
lld/test/ELF/ppc64-reloc-addr.s
lld/test/ELF/riscv-branch.s
lld/test/ELF/riscv-call.s
lld/test/ELF/riscv-hi20-lo12.s
lld/test/ELF/riscv-jal.s
lld/test/ELF/riscv-pcrel-hilo.s
lld/test/ELF/x86-64-reloc-error.s
lld/test/ELF/x86-64-reloc-error2.s
Removed:
################################################################################
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 888bec3f782e..8fa183297743 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -73,6 +73,15 @@ static Optional<std::string> getLinkerScriptLocation(const Symbol &sym) {
return None;
}
+static std::string getDefinedLocation(const Symbol &sym) {
+ std::string msg = "\n>>> defined in ";
+ if (sym.file)
+ msg += toString(sym.file);
+ else if (Optional<std::string> loc = getLinkerScriptLocation(sym))
+ msg += *loc;
+ return msg;
+}
+
// Construct a message in the following format.
//
// >>> defined in /home/alice/src/foo.o
@@ -80,19 +89,30 @@ static Optional<std::string> getLinkerScriptLocation(const Symbol &sym) {
// >>> /home/alice/src/bar.o:(.text+0x1)
static std::string getLocation(InputSectionBase &s, const Symbol &sym,
uint64_t off) {
- std::string msg = "\n>>> defined in ";
- if (sym.file)
- msg += toString(sym.file);
- else if (Optional<std::string> loc = getLinkerScriptLocation(sym))
- msg += *loc;
-
- msg += "\n>>> referenced by ";
+ std::string msg = getDefinedLocation(sym) + "\n>>> referenced by ";
std::string src = s.getSrcMsg(sym, off);
if (!src.empty())
msg += src + "\n>>> ";
return msg + s.getObjMsg(off);
}
+void reportRangeError(uint8_t *loc, const Relocation &rel, const Twine &v,
+ int64_t min, uint64_t max) {
+ ErrorPlace errPlace = getErrorPlace(loc);
+ std::string hint;
+ if (rel.sym && !rel.sym->isLocal())
+ hint = "; references " + lld::toString(*rel.sym) +
+ getDefinedLocation(*rel.sym);
+
+ if (errPlace.isec && errPlace.isec->name.startswith(".debug"))
+ hint += "; consider recompiling with -fdebug-types-section to reduce size "
+ "of debug sections";
+
+ errorOrWarn(errPlace.loc + "relocation " + lld::toString(rel.type) +
+ " out of range: " + v.str() + " is not in [" + Twine(min).str() +
+ ", " + Twine(max).str() + "]" + hint);
+}
+
namespace {
// Build a bitmask with one bit set for each RelExpr.
//
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index 1f094c7ce869..f58f216332a5 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -204,18 +204,8 @@ TargetInfo *getTarget();
template <class ELFT> bool isMipsPIC(const Defined *sym);
-static inline void reportRangeError(uint8_t *loc, const Relocation &rel,
- const Twine &v, int64_t min, uint64_t max) {
- ErrorPlace errPlace = getErrorPlace(loc);
- StringRef hint;
- if (errPlace.isec && errPlace.isec->name.startswith(".debug"))
- hint = "; consider recompiling with -fdebug-types-section to reduce size "
- "of debug sections";
-
- errorOrWarn(errPlace.loc + "relocation " + lld::toString(rel.type) +
- " out of range: " + v.str() + " is not in [" + Twine(min).str() +
- ", " + Twine(max).str() + "]" + hint);
-}
+void reportRangeError(uint8_t *loc, const Relocation &rel, const Twine &v,
+ int64_t min, uint64_t max);
// Make sure that V can be represented as an N bit signed integer.
inline void checkInt(uint8_t *loc, int64_t v, int n, const Relocation &rel) {
diff --git a/lld/test/ELF/aarch64-abs16.s b/lld/test/ELF/aarch64-abs16.s
index af01eb300081..5701be26dceb 100644
--- a/lld/test/ELF/aarch64-abs16.s
+++ b/lld/test/ELF/aarch64-abs16.s
@@ -21,7 +21,7 @@ _start:
// CHECK-NEXT: 220158 ffff0080
// RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
-// OVERFLOW1: relocation R_AARCH64_ABS16 out of range: -32769 is not in [-32768, 65535]
+// OVERFLOW1: relocation R_AARCH64_ABS16 out of range: -32769 is not in [-32768, 65535]; references foo
// RUN: not ld.lld %t.o %t257.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
-// OVERFLOW2: relocation R_AARCH64_ABS16 out of range: 65536 is not in [-32768, 65535]
+// OVERFLOW2: relocation R_AARCH64_ABS16 out of range: 65536 is not in [-32768, 65535]; references foo
diff --git a/lld/test/ELF/aarch64-abs32.s b/lld/test/ELF/aarch64-abs32.s
index b17258a55e7d..8e9a6b07148b 100644
--- a/lld/test/ELF/aarch64-abs32.s
+++ b/lld/test/ELF/aarch64-abs32.s
@@ -21,7 +21,7 @@ _start:
// CHECK-NEXT: 220158 ffffffff 00000080
// RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
-// OVERFLOW1: relocation R_AARCH64_ABS32 out of range: -2147483649 is not in [-2147483648, 4294967295]
+// OVERFLOW1: relocation R_AARCH64_ABS32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo
// RUN: not ld.lld %t.o %t257.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
-// OVERFLOW2: relocation R_AARCH64_ABS32 out of range: 4294967296 is not in [-2147483648, 4294967295]
+// OVERFLOW2: relocation R_AARCH64_ABS32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references foo
diff --git a/lld/test/ELF/aarch64-prel16.s b/lld/test/ELF/aarch64-prel16.s
index 91f193ed4192..af96bf3df7e3 100644
--- a/lld/test/ELF/aarch64-prel16.s
+++ b/lld/test/ELF/aarch64-prel16.s
@@ -25,7 +25,7 @@ _start:
// CHECK-NEXT: 202158 ffff0080
// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o %t2 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
-// OVERFLOW1: relocation R_AARCH64_PREL16 out of range: -32769 is not in [-32768, 65535]
+// OVERFLOW1: relocation R_AARCH64_PREL16 out of range: -32769 is not in [-32768, 65535]; references foo
// RUN: not ld.lld -z max-page-size=4096 %t.o %t257.o -o %t2 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
-// OVERFLOW2: relocation R_AARCH64_PREL16 out of range: 65536 is not in [-32768, 65535]
+// OVERFLOW2: relocation R_AARCH64_PREL16 out of range: 65536 is not in [-32768, 65535]; references foo
diff --git a/lld/test/ELF/aarch64-prel32.s b/lld/test/ELF/aarch64-prel32.s
index fdcbcb67fd83..02e2ad39ed8f 100644
--- a/lld/test/ELF/aarch64-prel32.s
+++ b/lld/test/ELF/aarch64-prel32.s
@@ -25,7 +25,7 @@ _start:
// CHECK-NEXT: 202158 ffffffff 00000080
// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o %t2 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
-// OVERFLOW1: relocation R_AARCH64_PREL32 out of range: -2147483649 is not in [-2147483648, 4294967295]
+// OVERFLOW1: relocation R_AARCH64_PREL32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo
// RUN: not ld.lld -z max-page-size=4096 %t.o %t257.o -o %t2 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
-// OVERFLOW2: relocation R_AARCH64_PREL32 out of range: 4294967296 is not in [-2147483648, 4294967295]
+// OVERFLOW2: relocation R_AARCH64_PREL32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references foo
diff --git a/lld/test/ELF/hexagon-jump-error.s b/lld/test/ELF/hexagon-jump-error.s
index 2aef0d778c3e..edbf8a8f0f12 100644
--- a/lld/test/ELF/hexagon-jump-error.s
+++ b/lld/test/ELF/hexagon-jump-error.s
@@ -12,19 +12,19 @@ _start:
.section b9, "ax"
1:
-# CHECK-NEXT: relocation R_HEX_B13_PCREL out of range: 16388 is not in [-16384, 16383]
+# CHECK: relocation R_HEX_B13_PCREL out of range: 16388 is not in [-16384, 16383]
if (r0==#0) jump:t #1f
.space (1<<14)
.section b13, "ax"
1:
-# CHECK-NEXT: relocation R_HEX_B15_PCREL out of range: 65540 is not in [-65536, 65535]
+# CHECK: relocation R_HEX_B15_PCREL out of range: 65540 is not in [-65536, 65535]
if (p0) jump #1f
.space (1<<16)
.section b15, "ax"
1:
-# CHECK-NEXT: relocation R_HEX_B22_PCREL out of range: 8388612 is not in [-2097152, 2097151]
+# CHECK: relocation R_HEX_B22_PCREL out of range: 8388612 is not in [-2097152, 2097151]
jump #1f
.space (1<<23)
.section b22, "ax"
diff --git a/lld/test/ELF/i386-reloc-16.s b/lld/test/ELF/i386-reloc-16.s
index aef2394a691a..9b894e8beb78 100644
--- a/lld/test/ELF/i386-reloc-16.s
+++ b/lld/test/ELF/i386-reloc-16.s
@@ -7,11 +7,11 @@
# RUN: not ld.lld %t.o --defsym=a=-1 --defsym=b=0 -o /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=OVERFLOW1 %s
-# OVERFLOW1: relocation R_386_16 out of range: -32769 is not in [-32768, 65535]
+# OVERFLOW1: relocation R_386_16 out of range: -32769 is not in [-32768, 65535]; references a
# RUN: not ld.lld %t.o --defsym=a=0 --defsym=b=32769 -o /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=OVERFLOW2 %s
-# OVERFLOW2: relocation R_386_16 out of range: 65536 is not in [-32768, 65535]
+# OVERFLOW2: relocation R_386_16 out of range: 65536 is not in [-32768, 65535]; references b
.code16
.global _start
diff --git a/lld/test/ELF/i386-reloc-8.s b/lld/test/ELF/i386-reloc-8.s
index 6949ab651f60..ddf1c1de392d 100644
--- a/lld/test/ELF/i386-reloc-8.s
+++ b/lld/test/ELF/i386-reloc-8.s
@@ -7,11 +7,11 @@
# RUN: not ld.lld %t.o --defsym=a=-1 --defsym=b=0 -o /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=OVERFLOW1 %s
-# OVERFLOW1: relocation R_386_8 out of range: -129 is not in [-128, 255]
+# OVERFLOW1: relocation R_386_8 out of range: -129 is not in [-128, 255]; references a
# RUN: not ld.lld %t.o --defsym=a=0 --defsym=b=129 -o /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=OVERFLOW2 %s
-# OVERFLOW2: relocation R_386_8 out of range: 256 is not in [-128, 255]
+# OVERFLOW2: relocation R_386_8 out of range: 256 is not in [-128, 255]; references b
.code16
.globl _start
diff --git a/lld/test/ELF/i386-reloc-range.s b/lld/test/ELF/i386-reloc-range.s
index 758cc491b91a..033a9ed78386 100644
--- a/lld/test/ELF/i386-reloc-range.s
+++ b/lld/test/ELF/i386-reloc-range.s
@@ -17,7 +17,7 @@
// RUN: not ld.lld -Ttext 0x200 %t.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
-// ERR: {{.*}}:(.text+0x1): relocation R_386_PC16 out of range: 65536 is not in [-65536, 65535]
+// ERR: {{.*}}:(.text+0x1): relocation R_386_PC16 out of range: 65536 is not in [-65536, 65535]; references foo
.global _start
_start:
diff --git a/lld/test/ELF/ppc64-reloc-addr.s b/lld/test/ELF/ppc64-reloc-addr.s
index f3a7708bc38b..ef423a1c2e2b 100644
--- a/lld/test/ELF/ppc64-reloc-addr.s
+++ b/lld/test/ELF/ppc64-reloc-addr.s
@@ -9,12 +9,12 @@
# CHECK: 0x{{[0-9a-f]+}} ffff0080 ffffffff 00000080
# RUN: not ld.lld %t.o %t255.o -o /dev/null 2>&1 | FileCheck --check-prefix=OVERFLOW1 %s
-# OVERFLOW1: relocation R_PPC64_ADDR16 out of range: -32769 is not in [-32768, 65535]
-# OVERFLOW1: relocation R_PPC64_ADDR32 out of range: -2147483649 is not in [-2147483648, 4294967295]
+# OVERFLOW1: relocation R_PPC64_ADDR16 out of range: -32769 is not in [-32768, 65535]; references foo
+# OVERFLOW1: relocation R_PPC64_ADDR32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo
# RUN: not ld.lld %t.o %t257.o -o /dev/null 2>&1 | FileCheck --check-prefix=OVERFLOW2 %s
-# OVERFLOW2: relocation R_PPC64_ADDR16 out of range: 65536 is not in [-32768, 65535]
-# OVERFLOW2: relocation R_PPC64_ADDR32 out of range: 4294967296 is not in [-2147483648, 4294967295]
+# OVERFLOW2: relocation R_PPC64_ADDR16 out of range: 65536 is not in [-32768, 65535]; references foo
+# OVERFLOW2: relocation R_PPC64_ADDR32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references foo
.globl _start
_start:
diff --git a/lld/test/ELF/riscv-branch.s b/lld/test/ELF/riscv-branch.s
index 247b6f3c2240..8d78ab75ad7a 100644
--- a/lld/test/ELF/riscv-branch.s
+++ b/lld/test/ELF/riscv-branch.s
@@ -19,8 +19,8 @@
# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
-# ERROR-RANGE: relocation R_RISCV_BRANCH out of range: 2048 is not in [-2048, 2047]
-# ERROR-RANGE-NEXT: relocation R_RISCV_BRANCH out of range: -2049 is not in [-2048, 2047]
+# ERROR-RANGE: relocation R_RISCV_BRANCH out of range: 2048 is not in [-2048, 2047]; references foo
+# ERROR-RANGE: relocation R_RISCV_BRANCH out of range: -2049 is not in [-2048, 2047]; references bar
# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start-1 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start-1 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
diff --git a/lld/test/ELF/riscv-call.s b/lld/test/ELF/riscv-call.s
index a9a73841fd74..7a8cbf8348e4 100644
--- a/lld/test/ELF/riscv-call.s
+++ b/lld/test/ELF/riscv-call.s
@@ -22,9 +22,10 @@
# LIMITS-NEXT: e7 80 00 80 jalr -2048(ra)
# RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o %t
-# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o %t 2>&1 | FileCheck --check-prefix=ERROR %s
-# ERROR: relocation R_RISCV_CALL out of range: 524288 is not in [-524288, 524287]
-# ERROR-NEXT: relocation R_RISCV_CALL out of range: -524289 is not in [-524288, 524287]
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o %t 2>&1 | \
+# RUN: FileCheck --check-prefix=ERROR %s
+# ERROR: relocation R_RISCV_CALL out of range: 524288 is not in [-524288, 524287]; references foo
+# ERROR: relocation R_RISCV_CALL out of range: -524289 is not in [-524288, 524287]; references bar
.global _start
_start:
diff --git a/lld/test/ELF/riscv-hi20-lo12.s b/lld/test/ELF/riscv-hi20-lo12.s
index 24d2d65027d6..3ef78a0aa616 100644
--- a/lld/test/ELF/riscv-hi20-lo12.s
+++ b/lld/test/ELF/riscv-hi20-lo12.s
@@ -26,8 +26,8 @@
# LIMITS-NEXT: 23 a0 b5 80 sw a1, -2048(a1)
# RUN: not ld.lld %t.rv64.o --defsym foo=0x7ffff800 --defsym bar=0xffffffff7ffff7ff -o %t 2>&1 | FileCheck --check-prefix ERROR %s
-# ERROR: relocation R_RISCV_HI20 out of range: 524288 is not in [-524288, 524287]
-# ERROR-NEXT: relocation R_RISCV_HI20 out of range: -524289 is not in [-524288, 524287]
+# ERROR: relocation R_RISCV_HI20 out of range: 524288 is not in [-524288, 524287]; references foo
+# ERROR: relocation R_RISCV_HI20 out of range: -524289 is not in [-524288, 524287]; references bar
.global _start
diff --git a/lld/test/ELF/riscv-jal.s b/lld/test/ELF/riscv-jal.s
index 5979a5e1110f..b31a0eb960ac 100644
--- a/lld/test/ELF/riscv-jal.s
+++ b/lld/test/ELF/riscv-jal.s
@@ -19,13 +19,13 @@
# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
-# ERROR-RANGE: relocation R_RISCV_JAL out of range: 524288 is not in [-524288, 524287]
-# ERROR-RANGE-NEXT: relocation R_RISCV_JAL out of range: -524289 is not in [-524288, 524287]
+# ERROR-RANGE: relocation R_RISCV_JAL out of range: 524288 is not in [-524288, 524287]; references foo
+# ERROR-RANGE: relocation R_RISCV_JAL out of range: -524289 is not in [-524288, 524287]; references bar
# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
-# ERROR-ALIGN: improper alignment for relocation R_RISCV_JAL: 0x1 is not aligned to 2 bytes
-# ERROR-ALIGN-NEXT: improper alignment for relocation R_RISCV_JAL: 0x3 is not aligned to 2 bytes
+# ERROR-ALIGN: improper alignment for relocation R_RISCV_JAL: 0x1 is not aligned to 2 bytes
+# ERROR-ALIGN: improper alignment for relocation R_RISCV_JAL: 0x3 is not aligned to 2 bytes
.global _start
diff --git a/lld/test/ELF/riscv-pcrel-hilo.s b/lld/test/ELF/riscv-pcrel-hilo.s
index 5ae05036bfbb..9172853d193d 100644
--- a/lld/test/ELF/riscv-pcrel-hilo.s
+++ b/lld/test/ELF/riscv-pcrel-hilo.s
@@ -31,8 +31,8 @@
# RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+12-0x80000801 -o %t
# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+12-0x80000801 -o %t 2>&1 | FileCheck --check-prefix=ERROR %s
-# ERROR: relocation R_RISCV_PCREL_HI20 out of range: 524288 is not in [-524288, 524287]
-# ERROR-NEXT: relocation R_RISCV_PCREL_HI20 out of range: -524289 is not in [-524288, 524287]
+# ERROR: relocation R_RISCV_PCREL_HI20 out of range: 524288 is not in [-524288, 524287]; references foo
+# ERROR: relocation R_RISCV_PCREL_HI20 out of range: -524289 is not in [-524288, 524287]; references bar
.global _start
_start:
diff --git a/lld/test/ELF/x86-64-reloc-error.s b/lld/test/ELF/x86-64-reloc-error.s
index 0c3bebef04b5..9fe24818f949 100644
--- a/lld/test/ELF/x86-64-reloc-error.s
+++ b/lld/test/ELF/x86-64-reloc-error.s
@@ -1,10 +1,12 @@
// REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/x86-64-reloc-error.s -o %tabs
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/x86-64-reloc-error.s -o %t1.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
-// RUN: not ld.lld -shared %tabs %t -o /dev/null 2>&1 | FileCheck %s
+// RUN: not ld.lld -shared %t1.o %t -o /dev/null 2>&1 | FileCheck %s
movl $big, %edx
movq $foo - 0x1000000000000, %rdx
-# CHECK: {{.*}}:(.text+0x1): relocation R_X86_64_32 out of range: 68719476736 is not in [0, 4294967295]
-# CHECK: {{.*}}:(.text+0x8): relocation R_X86_64_32S out of range: -281474976710656 is not in [-2147483648, 2147483647]
+# CHECK: {{.*}}:(.text+0x1): relocation R_X86_64_32 out of range: 68719476736 is not in [0, 4294967295]; references big
+# CHECK-NEXT: >>> defined in {{.*}}1.o
+# CHECK: {{.*}}:(.text+0x8): relocation R_X86_64_32S out of range: -281474976710656 is not in [-2147483648, 2147483647]; references foo
+# CHECK-NEXT: >>> defined in {{.*}}1.o
diff --git a/lld/test/ELF/x86-64-reloc-error2.s b/lld/test/ELF/x86-64-reloc-error2.s
index de5e2848df42..a082a94e6adb 100644
--- a/lld/test/ELF/x86-64-reloc-error2.s
+++ b/lld/test/ELF/x86-64-reloc-error2.s
@@ -4,7 +4,8 @@
## Check we are able to find a function symbol that encloses
## a given location when reporting error messages.
-# CHECK: {{.*}}.o:(function func: .text.func+0x3): relocation R_X86_64_32S out of range: -281474974609120 is not in [-2147483648, 2147483647]
+# CHECK: {{.*}}.o:(function func: .text.func+0x3): relocation R_X86_64_32S out of range: -281474974609120 is not in [-2147483648, 2147483647]; references func
+# CHECK-NEXT: >>> defined in {{.*}}.o
# This mergeable section will be garbage collected. We had a crash issue in that case. Test it.
.section .rodata.str1,"aMS", at progbits,1
More information about the llvm-commits
mailing list