This is an archive of the discontinued LLVM Phabricator instance.

[X32] Add Triple::isX32(), use it.
ClosedPublic

Authored by hvdijk on Jun 6 2021, 3:41 PM.

Details

Summary

So far, support for x86_64-linux-gnux32 has been handled by explicit
comparisons of Triple.getEnvironment() to GNUX32. This worked as long as
x86_64-linux-gnux32 was the only X32 environment to worry about, but we
now have x86_64-linux-muslx32 as well. To support this, this change adds
an isX32() function and uses it. It replaces all checks for GNUX32 or
MuslX32 by isX32(), except for the following:

  • Triple::isGNUEnvironment() and Triple::isMusl() are supposed to treat GNUX32 and MuslX32 differently.
  • computeTargetTriple() needs to be able to transform triples to add or remove X32 from the environment and needs to map GNU to GNUX32, and Musl to MuslX32.
  • getMultiarchTriple() completely lacks any Musl support and retains the explicit check for GNUX32 as it can only return x86_64-linux-gnux32.

Diff Detail

Event Timeline

hvdijk created this revision.Jun 6 2021, 3:41 PM
hvdijk requested review of this revision.Jun 6 2021, 3:41 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 6 2021, 3:41 PM
MaskRay accepted this revision.Jun 7 2021, 12:43 PM

LGTM.

This revision is now accepted and ready to land.Jun 7 2021, 12:43 PM
This revision was landed with ongoing or failed builds.Jun 7 2021, 12:49 PM
This revision was automatically updated to reflect the committed changes.