ARM-software / abi-aa

Application Binary Interface for the Arm® Architecture
Other
938 stars 188 forks source link

[PAUTHABIELF64] Introduce `R_AARCH64_AUTH_GOT_ADR_PREL21` relocation #258

Closed kovdan01 closed 2 months ago

kovdan01 commented 5 months ago

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 commented 5 months ago

Tagging @asl

smithp35 commented 5 months ago

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 commented 5 months ago

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

kovdan01 commented 2 months ago

Closing the issue as resolved in #259