llvm.org GIT mirror llvm / 5dbda1e
[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 Martin Storsjo 2 years ago
3 changed file(s) with 10 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 RUN: llvm-objdump -r %p/Inputs/reloc-addend.obj.macho-aarch64 | FileCheck %s
1
2 CHECK-DAG: 0000000000000004 ARM64_RELOC_ADDEND 0x999
3 CHECK-DAG: 0000000000000004 ARM64_RELOC_PAGEOFF12 _stringbuf
4 CHECK-DAG: 0000000000000000 ARM64_RELOC_ADDEND 0x999
5 CHECK-DAG: 0000000000000000 ARM64_RELOC_PAGE21 _stringbuf
869869 bool isExtern = O->getPlainRelocationExternal(RE);
870870 uint64_t Val = O->getPlainRelocationSymbolNum(RE);
871871
872 if (isExtern) {
872 if (O->getAnyRelocationType(RE) == MachO::ARM64_RELOC_ADDEND) {
873 fmt << format("0x%x", Val);
874 return;
875 } else if (isExtern) {
873876 symbol_iterator SI = O->symbol_begin();
874877 advance(SI, Val);
875878 Expected SOrErr = SI->getName();