-
Notifications
You must be signed in to change notification settings - Fork 193
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
[aaelf64] Define GOT-Relative data relocation #223
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change text looks good to me, the CI is complaining about the table formatting. I've made a suggestion for how to correct that.
This introduces a new relocation `R\_<CLS>\_GOTPCREL32` which follows the existing wording to “R\_<CLS>\_GOTREL32”, but instead evaluates to the 32-bit offset between a GOT entry for a given symbol and the current location where the relocation is applied, so its equation would be “G(GDAT(S+A))- P”.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update, it passes CI now.
I've marked this as approved as we have got spare relocation codes and it does help make relative vtables be more efficient on AArch64.
Will wait for a colleague to double check and merge.
LGTM as well -- merging as I'm the second to look at it. |
Thanks for the addition. I think another advantage introducing the data relocation is that: |
This is the follopw implementation to ARM-software/abi-aa#223 that supports this relocation in llvm and lld.
This is the follopw implementation to ARM-software/abi-aa#223 that supports this relocation in llvm and lld.
This is the follopw implementation to ARM-software/abi-aa#223 that supports this relocation in llvm and lld.
I don't understand the equation for this relocation
Based on the LLD implementation of this relocation though (llvm/llvm-project#72584), it seems the addend is applied to the place of the relocation, not the GOT entry. See the added test case for what I mean. The relocations in the object file are:
The relocations in the output SO are:
So the addend isn't propagated to the dynamic relocations, which
This also better matches |
No you're correct. The addend should be applied to where the relocation is located, not to symbol we're taking the GOT entry for. The relocation is intended to be similar to |
Thanks for the confirmation and follow-up! |
Apologies for the delayed response, just come back from vacation. It is worth mentioning that there is a generic ABI issue with how GOT relative addends are represented in the AArch64 ABI #217 it looks like this instance may fall into that category. To summarise it looks like neither LLD, Mold, Gold or GNU ld implement So far there hasn't been a satisfactory resolution as it's not clear what all the linker's can support. Probably best leave any further comments on #217 I'll leave a comment in #247 too |
This introduces a new relocation
R\_<CLS>\_GOTPCREL32
which follows the existing wording to “R__GOTREL32”, but instead evaluates to the 32-bit offset between a GOT entry for a given symbol and the current location where the relocation is applied, so its equation would be “G(GDAT(S+A))- P”.