This is an archive of the discontinued LLVM Phabricator instance.

[LLVM][AIX] Prefer a 32-bit default target triple on AIX
ClosedPublic

Authored by daltenty on Jan 27 2022, 8:19 AM.

Details

Summary

If the user doesn't specify a default target triple, the LLVM CMake usually defaults us into the host triple. This is a problem when building Clang/LLVM on 64-bit AIX (i.e. powerpc64-ibm-aix), as the host toolchain (e.g. ar, ld, nm, dump) all expect the compiler to generate 32-bit objects by default (which both GCC and XL on the platform do) and will hard error if passed a 64-bit object without an explicit option or environment setting. This breaks downstream consumers, such as builds generated with build tools like CMake, which when they invoke clang, etc. without explicit bitmode flags also expect 32-bit mode.

This patch changes the default target selection when the host is powerpc64-ibm-aix to prefer powerpc-ibm-aix to avoid these issues. We don't update the runtimes/CMakeList.txt since the default is less meaningful as we assume runtimes will need to build for both targets anyways.

Diff Detail

Event Timeline

daltenty created this revision.Jan 27 2022, 8:19 AM
daltenty requested review of this revision.Jan 27 2022, 8:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2022, 8:19 AM

LGTM with an observation.

llvm/CMakeLists.txt
706–708

This relies on the user not explicitly configuring the host triple to include the AIX version.

This revision is now accepted and ready to land.Jan 27 2022, 4:47 PM
daltenty updated this revision to Diff 403888.Jan 27 2022, 10:25 PM

Slightly tweak the match and replace to preserve any custom OS versioned triple the user may have passed in.

This revision was landed with ongoing or failed builds.Jan 27 2022, 10:34 PM
This revision was automatically updated to reflect the committed changes.