Skip to content

Commit

Permalink
[ELF][ARM64] Support R_AARCH64_LD_PREL_LO19 relocations
Browse files Browse the repository at this point in the history
Implement support for the R_AARCH64_LD_PREL_LO19 relocation type. Since
this actually behaves the same way as R_AARCH64_CONDBR19, reuse the
relevant code.

Signed-off-by: Alois Wohlschlager <alois1@gmx-topmail.de>
  • Loading branch information
alois31 committed Mar 17, 2022
1 parent 66a057c commit 146ddd7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion elf/arch-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ void InputSection<E>::apply_reloc_alloc(Context<E> &ctx, u8 *base) {
*(u32 *)loc |= (val >> 2) & 0x3ffffff;
continue;
}
case R_AARCH64_CONDBR19: {
case R_AARCH64_CONDBR19:
case R_AARCH64_LD_PREL_LO19: {
i64 val = S + A - P;
overflow_check(val, -((i64)1 << 20), (i64)1 << 20);
*(u32 *)loc |= bits(val, 20, 2) << 5;
Expand Down Expand Up @@ -452,6 +453,7 @@ void InputSection<E>::scan_relocations(Context<E> &ctx) {
case R_AARCH64_ADD_ABS_LO12_NC:
case R_AARCH64_ADR_PREL_LO21:
case R_AARCH64_CONDBR19:
case R_AARCH64_LD_PREL_LO19:
case R_AARCH64_LDST16_ABS_LO12_NC:
case R_AARCH64_LDST32_ABS_LO12_NC:
case R_AARCH64_LDST64_ABS_LO12_NC:
Expand Down

0 comments on commit 146ddd7

Please sign in to comment.