abi-aa icon indicating copy to clipboard operation
abi-aa copied to clipboard

[PAUTHABIELF64] Introduce `R_AARCH64_AUTH_GOT_ADR_PREL21` relocation

Open kovdan01 opened this issue 1 year ago • 3 comments

It looks like that R_AARCH64_AUTH_GOT_LD_PREL19 described at https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#auth-variant-got-generating-relocations is not enough for tiny code model in case of signed GOT. Since the address of the GOT slot is used as a modifier, we need to store that address somewhere. To take this address, we should probably use adr instruction with 21-bit immediate.

I suggest to add a R_AARCH64_AUTH_GOT_ADR_PREL21 relocation which would correspond to the following assembly operator adr x16, :got_auth:sym.

kovdan01 avatar Apr 18 '24 14:04 kovdan01

Tagging @asl

kovdan01 avatar Apr 18 '24 14:04 kovdan01

Thanks for reporting. I guess that this would take the example for the small code-model

adrp x8, :got_auth: symbol
add x8, x8, :got_auth_lo12: symbol
ldr x0, [x8]
// Authenticate to get unsigned pointer
autia x0, x8

And use something like

adr x8, :got_auth: symbol // Needs new relocation like R_AARCH64_GOT_ADR_PREL21
ldr x0, [x8]
// Authenticate to get unsigned pointer
autia x0, x

I'd probably use R_AARCH64_AUTH_GOT_ADR_PREL_LO21 to follow the convention set by R_<CLS>_ ADR_PREL_LO21

Will hopefully get to this within a few days.

smithp35 avatar Apr 18 '24 14:04 smithp35

PR for addition of relocation https://github.com/ARM-software/abi-aa/pull/259

smithp35 avatar Apr 22 '24 14:04 smithp35

Closing the issue as resolved in #259

kovdan01 avatar Jul 18 '24 10:07 kovdan01