[ELF] Mention symbol name in reportRangeError()
authorFangrui Song <maskray@google.com>
Tue, 28 Jan 2020 01:35:06 +0000 (17:35 -0800)
committerFangrui Song <maskray@google.com>
Wed, 29 Jan 2020 17:38:25 +0000 (09:38 -0800)
commit4a4ce14eb2c6b35719d57c2c25cbee7e79d19cb0
tree6983b5953e46a18b10b8e0ca1d1d8400043e4b92
parent25b8e96388197147a14413c0b53c41f918fb49c0
[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 [-21474836482147483647]
```
=>
```
t.o:(function func: .text.func+0x3): relocation R_X86_64_32S out of range: -281474974609120 is not in [-21474836482147483647]; references func
>>> defined in t1.o
```

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D73518
18 files changed:
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