to match the convention we use for other diagnostics.
std::string hint;
if (rel.sym) {
if (!rel.sym->isSection())
- hint = "; references " + lld::toString(*rel.sym);
+ hint = "; references '" + lld::toString(*rel.sym) + '\'';
else if (auto *d = dyn_cast<Defined>(rel.sym))
hint = ("; references section '" + d->section->name + "'").str();
}
ErrorPlace errPlace = getErrorPlace(loc);
std::string hint;
if (!sym.getName().empty())
- hint = "; references " + lld::toString(sym) + getDefinedLocation(sym);
+ hint =
+ "; references '" + lld::toString(sym) + '\'' + getDefinedLocation(sym);
errorOrWarn(errPlace.loc + msg + " is out of range: " + Twine(v) +
" is not in [" + Twine(llvm::minIntN(n)) + ", " +
Twine(llvm::maxIntN(n)) + "]" + hint);
// BE-NEXT: 220158 ffff8000
// 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]; references foo
+// 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]; references foo
+// OVERFLOW2: relocation R_AARCH64_ABS16 out of range: 65536 is not in [-32768, 65535]; references 'foo'
// BE-NEXT: 220158 ffffffff 80000000
// 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]; references foo
+// 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]; references foo
+// OVERFLOW2: relocation R_AARCH64_ABS32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references 'foo'
movn x0, #:prel_g2:.-0x1000100000000
movz x0, #:tprel_g0: v1
-# CHECK: relocation R_AARCH64_TLSLE_MOVW_TPREL_G0 out of range: 65552 is not in [-65536, 65535]; references v1
+# CHECK: relocation R_AARCH64_TLSLE_MOVW_TPREL_G0 out of range: 65552 is not in [-65536, 65535]; references 'v1'
movz x0, #:tprel_g1: v2
-# CHECK: relocation R_AARCH64_TLSLE_MOVW_TPREL_G1 out of range: 4295032848 is not in [-4294967296, 4294967295]; references v2
+# CHECK: relocation R_AARCH64_TLSLE_MOVW_TPREL_G1 out of range: 4295032848 is not in [-4294967296, 4294967295]; references 'v2'
movz x0, #:tprel_g2: v3
-# CHECK: relocation R_AARCH64_TLSLE_MOVW_TPREL_G2 out of range: 281479271743496 is not in [-281474976710656, 281474976710655]; references v3
+# CHECK: relocation R_AARCH64_TLSLE_MOVW_TPREL_G2 out of range: 281479271743496 is not in [-281474976710656, 281474976710655]; references 'v3'
.section .tbss,"awT",@nobits
.balign 16
// BE-NEXT: 202158 ffff8000
// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
-// OVERFLOW1: relocation R_AARCH64_PREL16 out of range: -32769 is not in [-32768, 65535]; references foo
+// 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 /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
-// OVERFLOW2: relocation R_AARCH64_PREL16 out of range: 65536 is not in [-32768, 65535]; references foo
+// OVERFLOW2: relocation R_AARCH64_PREL16 out of range: 65536 is not in [-32768, 65535]; references 'foo'
// BE-NEXT: 202158 ffffffff 80000000
// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
-// OVERFLOW1: relocation R_AARCH64_PREL32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo
+// 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 /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
-// OVERFLOW2: relocation R_AARCH64_PREL32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references foo
+// OVERFLOW2: relocation R_AARCH64_PREL32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references 'foo'
// BE-NEXT: 202158 7fffffff 80000000 ffdfdfa0
// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
-// OVERFLOW1: relocation R_AARCH64_PLT32 out of range: -2147483649 is not in [-2147483648, 2147483647]; references foo
+// OVERFLOW1: relocation R_AARCH64_PLT32 out of range: -2147483649 is not in [-2147483648, 2147483647]; references 'foo'
// RUN: not ld.lld -z max-page-size=4096 %t.o %t257.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
-// OVERFLOW2: relocation R_AARCH64_PLT32 out of range: 2147483648 is not in [-2147483648, 2147483647]; references foo
+// OVERFLOW2: relocation R_AARCH64_PLT32 out of range: 2147483648 is not in [-2147483648, 2147483647]; references 'foo'
.globl _start
_start:
.inst 0xe1c000d0 // ldrd r0, r1, [r0, #0]
.reloc 32, R_ARM_ALU_PC_G0_NC, dat2
.reloc 36, R_ARM_ALU_PC_G1_NC, dat2
-// CHECK: {{.*}}.s.tmp.o:(.text.1+0x28): relocation R_ARM_LDRS_PC_G2 out of range: 4056 is not in [0, 255]; references dat2
+// CHECK: {{.*}}.s.tmp.o:(.text.1+0x28): relocation R_ARM_LDRS_PC_G2 out of range: 4056 is not in [0, 255]; references 'dat2'
.reloc 40, R_ARM_LDRS_PC_G2, dat2
.section .text.2, "ax", %progbits
.balign 512
/// ldrd r0, r1, _start
-// CHECK: {{.*}}.s.tmp.o:(.os1+0x200): relocation R_ARM_LDRS_PC_G0 out of range: 512 is not in [0, 255]; references _start
+// CHECK: {{.*}}.s.tmp.o:(.os1+0x200): relocation R_ARM_LDRS_PC_G0 out of range: 512 is not in [0, 255]; references '_start'
.reloc ., R_ARM_LDRS_PC_G0, _start
.inst 0xe14f00d0
# 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]; references a
+# 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]; references b
+# OVERFLOW2: relocation R_386_16 out of range: 65536 is not in [-32768, 65535]; references 'b'
.code16
.global _start
# 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]; references a
+# 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]; references b
+# OVERFLOW2: relocation R_386_8 out of range: 256 is not in [-128, 255]; references 'b'
.code16
.globl _start
// 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]; references foo
+// ERR: {{.*}}:(.text+0x1): relocation R_386_PC16 out of range: 65536 is not in [-65536, 65535]; references 'foo'
.global _start
_start:
# RUN: ld.lld --script %t/lds %t.o -o %t1 --noinhibit-exec
# RUN: rm %t.o %t1
-# CHECK: error: R12 setup stub offset is out of range: 8589934592 is not in [-8589934592, 8589934591]; references callee
+# CHECK: error: R12 setup stub offset is out of range: 8589934592 is not in [-8589934592, 8589934591]; references 'callee'
# CHECK-NEXT: >>> defined in {{.*}}.o
//--- asm
# RUN: rm %t.o %t1
## Note: GNU ld uses sldi 11, 11, 34 and add 12, 11, 12 to support offsets beyond +-2**33.
-# CHECK: error: R12 setup stub offset is out of range: 8589934592 is not in [-8589934592, 8589934591]; references high
+# CHECK: error: R12 setup stub offset is out of range: 8589934592 is not in [-8589934592, 8589934591]; references 'high'
# CHECK-NEXT: >>> defined in {{.*}}.o
//--- asm
# 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]; references foo
-# OVERFLOW1: relocation R_PPC64_ADDR32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo
+# 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]; references foo
-# OVERFLOW2: relocation R_PPC64_ADDR32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references foo
+# 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:
# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o /dev/null 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 /dev/null 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
-# ERROR-RANGE: relocation R_RISCV_BRANCH out of range: 4096 is not in [-4096, 4095]; references foo
-# ERROR-RANGE: relocation R_RISCV_BRANCH out of range: -4098 is not in [-4096, 4095]; references bar
+# ERROR-RANGE: relocation R_RISCV_BRANCH out of range: 4096 is not in [-4096, 4095]; references 'foo'
+# ERROR-RANGE: relocation R_RISCV_BRANCH out of range: -4098 is not in [-4096, 4095]; references 'bar'
# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start-1 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start-1 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
# 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 /dev/null 2>&1 | \
# RUN: FileCheck --check-prefix=ERROR %s
-# ERROR: relocation R_RISCV_CALL_PLT out of range: 524288 is not in [-524288, 524287]; references foo
-# ERROR: relocation R_RISCV_CALL_PLT out of range: -524289 is not in [-524288, 524287]; references bar
+# ERROR: relocation R_RISCV_CALL_PLT out of range: 524288 is not in [-524288, 524287]; references 'foo'
+# ERROR: relocation R_RISCV_CALL_PLT out of range: -524289 is not in [-524288, 524287]; references 'bar'
.global _start
_start:
# LIMITS-NEXT: 23 a0 b5 80 sw a1, -2048(a1)
# RUN: not ld.lld %t.rv64.o --defsym foo=0x7ffff800 --defsym bar=0xffffffff7ffff7ff -o /dev/null 2>&1 | FileCheck --check-prefix ERROR %s
-# 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
+# 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
# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o /dev/null 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 /dev/null 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
-# ERROR-RANGE: relocation R_RISCV_JAL out of range: 1048576 is not in [-1048576, 1048575]; references foo
-# ERROR-RANGE: relocation R_RISCV_JAL out of range: -1048578 is not in [-1048576, 1048575]; references bar
+# ERROR-RANGE: relocation R_RISCV_JAL out of range: 1048576 is not in [-1048576, 1048575]; references 'foo'
+# ERROR-RANGE: relocation R_RISCV_JAL out of range: -1048578 is not in [-1048576, 1048575]; references 'bar'
# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o /dev/null 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 /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
# 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 /dev/null 2>&1 | FileCheck --check-prefix=ERROR %s
-# 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
+# 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:
## `>>> defined in` for linker synthesized __stop_* symbols (there is no
## associated file or linker script line number).
-# CHECK: error: {{.*}}:(.text+0x2): relocation R_X86_64_GOTPCRELX out of range: 2147483655 is not in [-2147483648, 2147483647]; references __stop_data
-# CHECK-NEXT: error: {{.*}}:(.text+0x9): relocation R_X86_64_REX_GOTPCRELX out of range: 2147483648 is not in [-2147483648, 2147483647]; references __stop_data
+# CHECK: error: {{.*}}:(.text+0x2): relocation R_X86_64_GOTPCRELX out of range: 2147483655 is not in [-2147483648, 2147483647]; references '__stop_data'
+# CHECK-NEXT: error: {{.*}}:(.text+0x9): relocation R_X86_64_REX_GOTPCRELX out of range: 2147483648 is not in [-2147483648, 2147483647]; references '__stop_data'
# CHECK-NOT: error:
#--- a.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]; references big
+# 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: {{.*}}:(.text+0x8): relocation R_X86_64_32S out of range: -281474976710656 is not in [-2147483648, 2147483647]; references 'foo'
# CHECK-NEXT: >>> defined in {{.*}}1.o
## 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]; references func
+# 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
# CHECK-EMPTY:
## Check we are able to report file and location from debug information
## when reporting such kind of errors.
-# CHECK: error: {{.*}}.o:(.text+0x1): relocation R_X86_64_32 out of range: 68719476736 is not in [0, 4294967295]; references big
+# CHECK: error: {{.*}}.o:(.text+0x1): relocation R_X86_64_32 out of range: 68719476736 is not in [0, 4294967295]; references 'big'
# CHECK-NEXT: >>> referenced by test.s:3
# CHECK-NEXT: >>> defined in {{.*}}abs
-# CHECK2: error: {{.*}}.a({{.*}}.o):(.text+0x1): relocation R_X86_64_32 out of range: 68719476736 is not in [0, 4294967295]; references big
+# CHECK2: error: {{.*}}.a({{.*}}.o):(.text+0x1): relocation R_X86_64_32 out of range: 68719476736 is not in [0, 4294967295]; references 'big'
# CHECK2-NEXT: >>> referenced by test.s:3
# CHECK2-NEXT: >>> defined in {{.*}}abs