You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Medium code model PIC restrictions seem misleading #288
The entry for the large model in this column mentions that the max distance between the GOT and text must be <4GiB.
From what I could see in the text there doesn't seem to be any mention of the medium code model having some special handling of a GOT being further than 4GiB away from the code access to it.
Is there a reason that I'm missing that this limitation needed for the large model is not needed for the medium model?
Or is the "no additional GOT restrictions" mention overlooking that 4GiB limit on distance between text and GOT?
This looks like an oversight to me. My understanding is that the restriction "max distance from text to GOT < 4 GiB" is that the linker generated PLT entries use ADRP so the .got.plt needs to be within 4 GiB of the .got. This will remain true for the medium code-model. I'd also expect the .text sections to access the .got via ADRP too, further strengthening the case for putting the same restriction on the medium code model.
Yes this restriction applies to all models. However the maximum .text size of 2GB means that the GOT is always within 4GB as long as you don't create a gap between code and data that is larger than 2GB. Note both medium and large code models assume you place data after code and got sections before .data and .bss.
Activity
smithp35 commentedon Sep 30, 2024
This looks like an oversight to me. My understanding is that the restriction "max distance from text to GOT < 4 GiB" is that the linker generated PLT entries use ADRP so the
.got.pltneeds to be within 4 GiB of the.got. This will remain true for the medium code-model. I'd also expect the .text sections to access the.gotvia ADRP too, further strengthening the case for putting the same restriction on the medium code model.Wilco1 commentedon Sep 30, 2024
Yes this restriction applies to all models. However the maximum .text size of 2GB means that the GOT is always within 4GB as long as you don't create a gap between code and data that is larger than 2GB. Note both medium and large code models assume you place data after code and got sections before .data and .bss.
smithp35 commentedon Aug 21, 2025
We've removed the GOT distance from the tables in #345 this addresses this ticket too, so we can close it out.