ARM-software / abi-aa

Application Binary Interface for the Arm® Architecture
Other
971 stars 192 forks source link

Insufficient R_MORELLO_JUMP_SLOT documentation #69

Open jrtc27 opened 3 years ago

jrtc27 commented 3 years ago

R_MORELLO_JUMP_SLOT is under-documented; in reality it is the same as R_AARCH64_JUMP_SLOT, with the linker initially filling in the 64-bit VA in the first half of the slot (pointing at the PLT header) just like with R_AARCH64_JUMP_SLOT (though this is awkward for the run-time linker, and would be better if it had the same in-memory format as R_MORELLO_RELATIVE so bounds can be provided by the static linker; this aligns with R_AARCH64_JUMP_SLOT, which for lazy binding is initially resolved identically to R_AARCH64_RELATIVE).

sbaranga-arm commented 3 years ago

R_MORELLO_JUMP_SLOT being under-document - fair point.

Changing the fragment encoding also makes sense to me (although I wonder if we could also change the R_MORELLO_RELATIVE fragment encoding to make use of a build instruction).

jrtc27 commented 3 years ago

You could but it makes adding a non-zero relocbase awkward since there isn't a single instruction in Morello to increment the base without altering the length. You might be able to abuse the fact that Morello tag clears on invalid SCBNDS though to fake it; I think "get offset, add (relocbase - offset), set bounds to current length, add original base, build" works (but for us would trap horribly with "what on earth are you doing, no"), and is no less efficient than the current fragment processing.