This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Support 128-bit bitmask in oneof(RelExpr)
ClosedPublic

Authored by MaskRay on Oct 24 2021, 12:04 PM.

Details

Summary

Taken from Chih-Mao Chen's D100835.

RelExpr has 64 bits now and needs the extension to support new members
(R_PLT_GOTPLT for R_X86_64_PLTOFF64 support).

Note: RelExpr needs to have at least a member >=64 to prevent
-Wtautological-constant-out-of-range-compare for if (expr >= 64).

Diff Detail

Event Timeline

MaskRay created this revision.Oct 24 2021, 12:04 PM
MaskRay requested review of this revision.Oct 24 2021, 12:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2021, 12:04 PM
peter.smith accepted this revision.Oct 25 2021, 9:55 AM

LGTM. One possible alternative would be to order the RelExpr so that all the code we wanted to compare were 0 - 63, but this is more fragile. It may be possible for someone to come up with something better, but I guess that always can come in a follow up patch.

This revision is now accepted and ready to land.Oct 25 2021, 9:55 AM
arichardson accepted this revision.Oct 25 2021, 10:25 AM
arichardson added a subscriber: theraven.

LGTM - This generates very similar code to @theraven's version in CHERI LLVM (https://www.godbolt.org/z/vW7zsKobj) and is slightly simpler to understand.

MaskRay updated this revision to Diff 382091.Oct 25 2021, 1:00 PM
MaskRay edited the summary of this revision. (Show Details)

Prefer static to anonymous namespace for functions.

Add a note that we need a RelExpr member to suppress -Wtautological-constant-compare

This revision was landed with ongoing or failed builds.Oct 25 2021, 1:05 PM
This revision was automatically updated to reflect the committed changes.

This looks cleaner and simpler than mine, which was a quick hack to get it compiling. Thanks!