mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-15 07:59:57 +00:00
[llvm-objdump] Properly print MachO aarch64 addend relocations
Previously such relocations fell into the last case for local symbols, using the relocation addend as symbol index, leading to a crash. Differential Revision: https://reviews.llvm.org/D35239 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307927 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d7b55ebbd0
commit
5dbda1ece1
Binary file not shown.
6
test/tools/llvm-objdump/AArch64/macho-reloc-addend.test
Normal file
6
test/tools/llvm-objdump/AArch64/macho-reloc-addend.test
Normal file
@ -0,0 +1,6 @@
|
||||
RUN: llvm-objdump -r %p/Inputs/reloc-addend.obj.macho-aarch64 | FileCheck %s
|
||||
|
||||
CHECK-DAG: 0000000000000004 ARM64_RELOC_ADDEND 0x999
|
||||
CHECK-DAG: 0000000000000004 ARM64_RELOC_PAGEOFF12 _stringbuf
|
||||
CHECK-DAG: 0000000000000000 ARM64_RELOC_ADDEND 0x999
|
||||
CHECK-DAG: 0000000000000000 ARM64_RELOC_PAGE21 _stringbuf
|
@ -870,7 +870,10 @@ static void printRelocationTargetName(const MachOObjectFile *O,
|
||||
bool isExtern = O->getPlainRelocationExternal(RE);
|
||||
uint64_t Val = O->getPlainRelocationSymbolNum(RE);
|
||||
|
||||
if (isExtern) {
|
||||
if (O->getAnyRelocationType(RE) == MachO::ARM64_RELOC_ADDEND) {
|
||||
fmt << format("0x%x", Val);
|
||||
return;
|
||||
} else if (isExtern) {
|
||||
symbol_iterator SI = O->symbol_begin();
|
||||
advance(SI, Val);
|
||||
Expected<StringRef> SOrErr = SI->getName();
|
||||
|
Loading…
Reference in New Issue
Block a user