llvm.org GIT mirror llvm / 7db8ad4
[RuntimeDyld][MachO] Fix assertion in encodeAddend, add missing directive to test case. r326290 fixed the assertion for decodeAddend, but not encodeAddend. The regression test failed to catch this because it was missing the subsections_via_symbols flag, so the desired relocation was not applied. This patch also fixes the formatting of the assertion from r326290. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326406 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 2 years ago
2 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
6868 // Verify that the relocation points to a B/BL instruction.
6969 auto *p = reinterpret_cast(LocalAddress);
7070 assert(((*p & 0xFC000000) == 0x14000000 ||
71 (*p & 0xFC000000) == 0x94000000)
72 && "Expected branch instruction.");
71 (*p & 0xFC000000) == 0x94000000) &&
72 "Expected branch instruction.");
7373
7474 // Get the 26 bit addend encoded in the branch instruction and sign-extend
7575 // to 64 bit. The lower 2 bits are always zeros and are therefore implicit
165165 case MachO::ARM64_RELOC_BRANCH26: {
166166 auto *p = reinterpret_cast(LocalAddress);
167167 // Verify that the relocation points to the expected branch instruction.
168 assert((*p & 0xFC000000) == 0x14000000 && "Expected branch instruction.");
168 assert(((*p & 0xFC000000) == 0x14000000 ||
169 (*p & 0xFC000000) == 0x94000000) &&
170 "Expected branch instruction.");
169171
170172 // Verify addend value.
171173 assert((Addend & 0x3) == 0 && "Branch target is not aligned");
8989 # rtdyld-check: *{8}_subtractor_result = _test_branch_reloc - _foo
9090 _subtractor_result:
9191 .quad _test_branch_reloc - _foo
92
93 .subsections_via_symbols