This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [COFF] Interpret the immediate in ARM64 adr/adrp relocations as signed 21 bit
ClosedPublic

Authored by mstorsjo on Nov 21 2021, 10:51 PM.

Details

Summary

This matches how MS link.exe interprets this relocation.

Diff Detail

Event Timeline

mstorsjo created this revision.Nov 21 2021, 10:51 PM
mstorsjo requested review of this revision.Nov 21 2021, 10:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2021, 10:51 PM
efriedma accepted this revision.Nov 22 2021, 12:02 PM

LGTM. Happy you caught this. (I think this is consistent with my assembler for adrp.)

This revision is now accepted and ready to land.Nov 22 2021, 12:02 PM

LGTM. Happy you caught this. (I think this is consistent with my assembler for adrp.)

Yup, it is consistent with that. In practice, this was harmless at least when linking code generated by LLVM, as I think it never generated any negative offsets here - but it makes it clear that we can only use a range of up to +1 MB, not 2.