We (Intel) would like to revive this thread on X32 ABI support
upstreaming. X32 ABI homepage is here:
Currently x32 support is available in kernel/glibc/gcc/binutils and
one can install for example Ubuntu 14 with extra x32 lib packages
(apt-get install libc6-dev-x32) to evaluate x32-target code generated
by GCC (gcc supports x32 on Ubuntu 14 out of box).
We are planning to contribute enabling patches in LLVM/Clang trees and
going to provide continuous support for this ABI in the future. Most
of the changes obviously will be submitted to backend.
Our current work is based on:
* what’s currently done in trunk (some changes required for x32 are
* Michael Liao work done ~2 years ago and available here:
What’s currently in trunk:
* Triplet x86_64-*-linux-gnux32 (command line support, EnvironmentType
enum to differentiate x32 from x86_64 by getTriple().getEnvironment()
* ILP32/LP64 differentiation for TargetMachine
* LEA tuning:
* Bunch of tests (grep for gnux32):
What’s been done by Michael
but not released in trunk:
* Clang Driver support (linker/libraries paths lookup, x32 specific
flags, etc.). This change is rebased, modified and submitted here:
http://reviews.llvm.org/D4180 . Welcome to review.
* ELF support for x32. This change is rebased, modified and submitted
here: http://reviews.llvm.org/D4181 . Welcome to review.
* Use EBP/ESP as frame/stack pointer. This patch will be rebased
modified and submitted soon.
* Other cases which require introduction X32 specific instruction
definitions such as JMPX32r/CALLX32r/CALLX32m.
* X32 JIT support
* I hope Michael correct me if I missed anything important
What’s still missing or experiencing issues (just something from the top):
* New tests required and several existing tests fail when extending to x32.
* Pointer and struct return;
* Cast int to pointer;
* Function indirect calls;
We don’t plan to introduce new backend from scratch. Major part of the
changes are incremental to X86 backend and extend cases such as
(64bits) ? do-64 : do-32
(64bits) ? ((LP64) ? do-64 : do-x32) : do-32
or some shorter form if x32 mimic x86 or x86_64. X32 ABI is very close
to x86-64 ABI.
Our plan is to start from basic stuff, focus on more tests adding and
on stability issues, then continue with performance tuning. So the
first 2 patches I submitted enable “Hello, world!” sample on Ubuntu
14. Patches are here:
Next steps are to rebase and split Michael patch, cover with tests and
submit by chunks convenient for review. Then move to other discovered
Any suggestions and patches review are welcome!