-
Notifications
You must be signed in to change notification settings - Fork 211
Description
https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst#code-models explicitly states that for the large code model, the max distance from text to GOT has to be under 4 GiB. #288 clarifies that this should also apply to the medium code model. For the small code model, is it reasonable to assume a distance of 2 GiB or less?
I'm asking because the R_AARCH64_GOTPCREL32 relocation introduced in #223 appears to implicitly make this assumption. I want to use the same assumption to encode Clang's indirect references to the personality function and typeinfo objects inside eh_frame sections as sdata4 instead of sdata8 (see my LLVM Discourse post for more details if interested), and I'm wondering how safe that is. Note 2 of https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst#code-models states:
The definition of the text segment includes the shareable PLT, code and read-only data sections.
The GOT isn't technically read-only since relocations need to be applied to it, but if you're using RELRO (which I imagine is the case more often than not) then it's functionally read-only, so it seems useful to make the max text segment size of 2 GiB apply to the GOT as well, at least for the small code model. Are there problems I'm not foreseeing with this?