Repository navigation
[sysvabi64] Code Models. Limit range to GOT to 2GiB - #345
Merged
Merged
Conversation
The R_AARCH64_GOTPCREL32 relocation, currently used in clang when relative vtables are enabled, has a signed offset so is limited to 2 GiB range. This limits the range of GOT from the vtables to 2GiB. Document this restriction in the tables for the small and medium code model. Add a note to explain the reason, so that if code generation does not use the relocation the distance to the GOT can be increased. Fixes ARM-software#343
Wilco1
reviewed
Aug 15, 2025
Comment on lines
+760
to
+761
| 6. The distance to the GOT in the small and medium code model is | ||
| limited to 2GiB by the R_AARCH64_GOTPCREL32 relocations. |
Contributor
There was a problem hiding this comment.
Basically in all cases (including large model) the max distance from text to GOT is 2GB if R_AARCH64_GOTPCREL32 is used. It is 4GB otherwise as the basic range of ADRP.
So I think it doesn't really need to be added to the table since there is no difference between the code models.
Contributor
Author
There was a problem hiding this comment.
Main reason I did that was the large code model (need to expand the text of the diff to see) says
| large | 2GiB | no restriction | max distance from text |
| | | | to GOT < 4 GiB |
If I take the table entries out, I'll need to take that out too. Will update the PR.
As all code-models have the same restriction. Only use the note to describe the 2GiB limit.
Contributor
|
Thank you! Taking out the table entries also addresses #288, right? |
Contributor
Author
|
Yes, it looks like it does. I'll leave a comment and will close #288 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The R_AARCH64_GOTPCREL32 relocation, currently used in clang when relative vtables are enabled, has a signed offset so is limited to 2 GiB range. This limits the range of GOT from the vtables to 2GiB.
Document this restriction in the tables for the small and medium code model. Add a note to explain the reason, so that if code generation does not use the relocation the distance to the GOT can be increased.
Fixes #343