[RuntimeDyld][MachO] Support ARM64_RELOC_BRANCH26 for BL instructions by

relaxing an assertion.

llvm-svn: 326290
This commit is contained in:
Lang Hames 2018-02-28 00:58:21 +00:00
parent 4764b5748a
commit 6588f14a6c
2 changed files with 11 additions and 2 deletions

View File

@ -66,9 +66,11 @@ public:
Addend = *reinterpret_cast<support::ulittle64_t *>(LocalAddress);
break;
case MachO::ARM64_RELOC_BRANCH26: {
// Verify that the relocation points to the expected branch instruction.
// Verify that the relocation points to a B/BL instruction.
auto *p = reinterpret_cast<support::aligned_ulittle32_t *>(LocalAddress);
assert((*p & 0xFC000000) == 0x14000000 && "Expected branch instruction.");
assert(((*p & 0xFC000000) == 0x14000000 ||
(*p & 0xFC000000) == 0x94000000)
&& "Expected branch instruction.");
// Get the 26 bit addend encoded in the branch instruction and sign-extend
// to 64 bit. The lower 2 bits are always zeros and are therefore implicit

View File

@ -23,6 +23,13 @@ br1:
b _foo
ret
.globl _test_branch_reloc_bl
.align 2
# rtdyld-check: decode_operand(br2, 0)[25:0] = (_foo - br2)[27:2]
_test_branch_reloc_bl:
br2:
bl _foo
ret
# Test ARM64_RELOC_PAGE21 and ARM64_RELOC_PAGEOFF12 relocation. adrp encodes
# the PC-relative page (4 KiB) difference between the adrp instruction and the