[RuntimeDyld] Fix R_AARCH64_TSTBR14 relocation

Wrong mask was used to get branch instruction imm value.

Differential Revision: https://reviews.llvm.org/D128740
This commit is contained in:
Vladislav Khmelevsky 2022-06-28 19:54:59 +03:00
parent e4d1d0cc2c
commit b27d6ffe4e
2 changed files with 15 additions and 1 deletions

View File

@ -479,7 +479,7 @@ void RuntimeDyldELF::resolveAArch64Relocation(const SectionEntry &Section,
*TargetPtr &= 0xfff8001fU;
// Immediate:15:2 goes in bits 18:5 of TBZ, TBNZ
or32le(TargetPtr, (BranchImm & 0x0FFFFFFC) << 3);
or32le(TargetPtr, (BranchImm & 0x0000FFFC) << 3);
break;
}
case ELF::R_AARCH64_CALL26: // fallthrough

View File

@ -0,0 +1,14 @@
# RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %t %s
# RUN: llvm-rtdyld -triple=aarch64_be-none-linux-gnu -verify -check=%s %t
.section .text.1,"ax"
.globl foo
foo:
ret
.globl _main
_main:
tbnz x0, #1, foo
## Branch 1 instruction back from _main
# rtdyld-check: *{4}(_main) = 0x370FFFE0