This is an archive of the discontinued LLVM Phabricator instance.

[X86] Use 64-bit jump table entries for large code model PIC
ClosedPublic

Authored by aeubanks on Aug 31 2023, 10:36 AM.

Details

Summary

With the large code model, the label difference may not fit into 32 bits.
Even if we assume that any individual function is no larger than 2^32
and use a difference from the function entry to the target destination,
things like BOLT can rearrange blocks (even if BOLT doesn't necessarily
work with the large code model right now).

set directives avoid static relocations in some 32-bit entry cases, but
don't worry about set directives for 64-bit jump table entries (we can
do that later if somebody really cares about it).

check-llvm in a bootstrapped clang with the large code model passes.

Fixes #62894

Diff Detail

Event Timeline

aeubanks created this revision.Aug 31 2023, 10:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 10:36 AM
aeubanks requested review of this revision.Aug 31 2023, 10:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 10:36 AM
rnk accepted this revision.Aug 31 2023, 11:38 AM

lgtm

This revision is now accepted and ready to land.Aug 31 2023, 11:38 AM

If offsets within a function are larger than 2GB, we have other issues (e.g. branch relaxation for branches with a +-2GB offset encoding).

But this seems okay as a minima fix just to get things working.

This revision was landed with ongoing or failed builds.Aug 31 2023, 2:13 PM
This revision was automatically updated to reflect the committed changes.