Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline

[asan] Add support for AArch64 ILP32

Authored by zatrazz on Nov 16 2017, 8:47 AM.



This patch adds asan support for AArch64 ILP32 abi. ILP32 [1] is a new abi
for AArch64 similar to x32 where AArch64 instruction set are coupled with a
data model where int, long and pointer are 32-bit.

Unfortunately current support is not upstream for all projects. Binutils
and GCC are already covered, but GLIBC [2] and Linux [3] are maintained in
out of tree branches.

Also current LLVM also does not have support for ILP32, so current idea
of this patch is to eventually sync with gcc libsanitizer. In fact runtime
testing were done on gcc.

Main changes for compiler-rt is support the kernel ABI for internal
syscalls. Different than x32, ILP32 tries to leverage 32-bits syscalls
so kernel ABI for 64 bit argument passing (for ftruncate for instance)
are passed using the new Linux generic way for 32 bits (by splitting
high and low in two registers).

So instead of adding more adhoc defines to ILP32 I extende the
argument syscalls (value of 1) and 32 bits (value of 2).

It also fixes an AArch64 issue with upcoming GLIBC 2.27 (the one which
also ILP32 is currently based) with mcontext_t definition (GLIBC now does
not based it on kernel sigcontext_t anymore, but rather redefines it with
slight different members name).

I did a sanity check against AArch64 ILP64 and x86_64 on Linux without
any regressions.

[3] git://

Diff Detail

Event Timeline

zatrazz created this revision.Nov 16 2017, 8:47 AM
kubamracek edited edge metadata.Nov 29 2017, 8:18 AM

Is there a bot that builds for this architecture?


The value of "2" is really weird here. Can we use a separate constant?

Is there a bot that builds for this architecture?

As I described in the message there is some issue with current ABI approach:

  1. LLVM does not have support for AArch64 ILP32
  2. GLIBC and Linux are maintained in out of tree branches.

So no current buildbot enabled.


I don't see why not, maybe 32 and 64 to represent the underlying wordsize expected?

nsz added a subscriber: nsz.Jan 26 2018, 8:05 AM
nsz added inline comments.

this will be fixed in glibc, so the old code works.

zatrazz abandoned this revision.May 4 2018, 7:39 AM