This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] [COFF] Move jump tables back to the readonly section
ClosedPublic

Authored by mstorsjo on Nov 10 2021, 9:19 AM.

Details

Summary

This essentially reverts f5884d255e78305d41c28c6e001a460ff83981d8
(D57277).

That commit was made as a workaround since LLVM back then didn't
support cross-section relative relocations (IMAGE_REL_ARM64_REL32)
in COFF for ARM64. Support for this was implemented later,
in d5c5cf5ce8d921fc8c5e1b608c298a1ffa688d37 (D99572) and
382c505d9cfca8adaec47aea2da7bbcbc00fc05c (D102217).

The commit that moved jump tables to the function section noted
that it woud be ideal to utilize IMAGE_REL_ARM64_REL32.

This fixes https://bugs.llvm.org/show_bug.cgi?id=52378 by
avoiding large offsets in the ADRP relocation when referencing
the jump table, as the immediate offset is relative to the start of
the possibly large text section (as the jump table label isn't
made a proper object file level symbol).

Diff Detail

Event Timeline

mstorsjo created this revision.Nov 10 2021, 9:19 AM
mstorsjo requested review of this revision.Nov 10 2021, 9:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2021, 9:19 AM
rnk accepted this revision.Nov 10 2021, 10:26 AM

lgtm

This revision is now accepted and ready to land.Nov 10 2021, 10:26 AM
This revision was landed with ongoing or failed builds.Nov 23 2021, 12:39 AM
This revision was automatically updated to reflect the committed changes.