This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Wire up ILP32 ABI support in Clang
Needs ReviewPublic

Authored by Amanieu on Jun 25 2021, 10:50 AM.

Details

Summary

This is a follow-up to D94143 which added the necessary support in LLVM.

ILP32 mode is enabled by specifying an ILP32 target (aarch64[_be]-*-gnu_ilp32) with -target.

Diff Detail

Event Timeline

Amanieu created this revision.Jun 25 2021, 10:50 AM
Amanieu requested review of this revision.Jun 25 2021, 10:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 25 2021, 10:50 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

The linux kernel uses a build time invocation of the compiler for feature detection of the -mabi=lp64 command line flag, which clang-16 currently doesn't support.

Looking at https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html, it looks like an alternate value of -mabi=ilp32. Should this patch wire that up in clang?

Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2022, 12:06 PM

The situation around -mabi for AArch64 is a bit awkward: Clang uses it to select the ARM64 calling convention (-mabi=aapcs vs -mabi=darwinpcs) while GCC uses it to select between LP64 and ILP32. I'm not sure how we should be handling this.

We need some tests. https://maskray.me/blog/2021-08-08-toolchain-testing#i-dont-know-whether-a-test-is-needed

Adding some to clang/test/Preprocessor/init-aarch64.c should cover many changes, but we also need one to cover setDataLayout.