Martin Storsjö <mar...@martin.st> writes: > On Thu, 12 Sep 2024, Evgeny Karpov wrote: > >> The current binutils implementation does not support offset up to 4GB in >> IMAGE_REL_ARM64_PAGEBASE_REL21 relocation and is limited to 1MB. >> This is related to differences in ELF and COFF relocation records. > > Yes, I agree. > > But I would not consider this a limitation of the binutils implementation, > this is a limitation of the object file format. It can't be worked around > by inventing your own custom relocations, but should instead worked around > on the code generation side, to avoid needing such large offsets. > > This approach is one such, quite valid. Another one is to generate extra > symbols to allow addressing anything with a smaller offset.
Maybe this is my ELF bias showing, but: generating extra X=Y+OFF symbols isn't generally valid for ELF when Y is a global symbol, since interposition rules, comdat, weak symbols, and various other reasons, could mean that the local definition of Y isn't the one that gets used. Does COFF cope with that in some other way? If not, I would have expected that there would need to be a fallback path that didn't involve defining extra symbols. Thanks, Richard