1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 02:20:51 +03:00

Support R_AARCH64_LDST128_ABS_LO12_NC

With this change, mold can self-host it on ARM64 machines.
This commit is contained in:
Rui Ueyama 2021-08-24 07:07:49 +00:00
parent 684962b84c
commit 8bb9fe654e

View File

@ -110,10 +110,14 @@ void EhFrameSection<AARCH64>::apply_reloc(Context<AARCH64> &ctx,
*(u64 *)(base + loc) = val;
return;
case R_AARCH64_PREL32:
*(u32 *)(base + loc) = val;
*(u32 *)(base + loc) = val - this->shdr.sh_addr - loc;
return;
case R_AARCH64_PREL64:
*(u64 *)(base + loc) = val - this->shdr.sh_addr - loc;
return;
}
unreachable(ctx);
Fatal(ctx) << "unsupported relocation in .eh_frame: "
<< rel_to_string<AARCH64>(rel.r_type);
}
template <>
@ -168,6 +172,9 @@ void InputSection<AARCH64>::apply_reloc_alloc(Context<AARCH64> &ctx, u8 *base) {
case R_AARCH64_LDST64_ABS_LO12_NC:
*(u32 *)loc |= extract(S + A, 11, 3) << 10;
continue;
case R_AARCH64_LDST128_ABS_LO12_NC:
*(u32 *)loc |= extract(S + A, 11, 4) << 10;
continue;
case R_AARCH64_ADD_ABS_LO12_NC:
*(u32 *)loc |= extract(S + A, 11, 0) << 10;
continue;
@ -391,8 +398,9 @@ void InputSection<AARCH64>::scan_relocations(Context<AARCH64> &ctx) {
sym.flags |= NEEDS_TLSDESC;
break;
case R_AARCH64_ADD_ABS_LO12_NC:
case R_AARCH64_LDST64_ABS_LO12_NC:
case R_AARCH64_LDST32_ABS_LO12_NC:
case R_AARCH64_LDST64_ABS_LO12_NC:
case R_AARCH64_LDST128_ABS_LO12_NC:
case R_AARCH64_LDST8_ABS_LO12_NC:
case R_AARCH64_MOVW_UABS_G0_NC:
case R_AARCH64_MOVW_UABS_G1_NC: