-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quantifying the benefits of DT_AARCH64_AUTH_RELR #252
Comments
The 32b limit was chosen on the basis that in the vast majority of cases (small code model, position independent code) the addend is going to be within the 0..2^32 range. So I would say that in a typical userspace, pretty much every relocation is going to use this. |
I agree that in the majority of cases linkers don't need to move a relocation from If we use CREL (while |
Got it, I misread your earlier message and thought you were asking about |
I built AOSP with PAuth ABI disabled and enabled for the Cuttlefish (i.e. emulator) arm64 target and ran the following commands from the
So around 40% of Also, the total size of all |
Is there any need for any specification updates at the moment? My intent behind I can see that if CREL is standardised and accepted then it would make sense to support that too, although I'm reluctant to take out |
Recently, I have proposed a compact relocation format CREL at https://groups.google.com/g/generic-abi/c/yb0rjw56ORw/m/eiBcYxSfAQAJ (previously named RELLEB).
(https://github.com/MaskRay/llvm-project/tree/demo-crel adds CREL support to clang/lld/LLVM binary utilities.
clang -fuse-ld=lld -mcrel a.c
)CREL shines for GLOB_DAT/JUMP_SLOT and absolute relocations, often requiring mere 2 bytes (offset adjustment and symbol index update).
While it might not be as effective for relative relocations compared to RELR, I'm interested in a quantitative evaluation of DT_AARCH64_AUTH_RELR (a RELR variant).
DT_AARCH64_AUTH_RELR requires the addend to be 32-bit and the linker support requires moving addend-out-of-range relocations to
.rela.dyn
, complicating the design.Are there figures on how many regular relative relocations are transformed into R_AARCH64_AUTH_RELATIVE under PAuthABI?
(Open-source rtld/libc might favor a smaller set of supported relocation formats. CREL is tackling with a very difficult problem, but it has the potential to phase out REL/RELA, decreasing complexity for future new architectures.)
I am using a Release build of clang-16 as an example. RELR is much better than CREL in compacting relative relocations.
In a release build of Clang 16, using -z crel resulted in a .crel.dyn section size of only 1.0% of the file size. Notably, enabling implicit addends with -z crel -z rel further reduced the size to just 0.3%. While DT_AARCH64_AUTH_RELR will achieve a noticeable smaller relocation size if most relative relocations are encoded with it, the advantage seems less significant considering CREL's already compact size.
A CREL with addend implementation for relative relocations unnecessarily encode the addend in the relocation.
-z crel -z rel
switches to implicit addends:My blog post provides more description about implicit addends around https://maskray.me/blog/2024-03-09-a-compact-relocation-format-for-elf#:~:text=DT_AARCH64_AUTH_RELR
The text was updated successfully, but these errors were encountered: