AArch64 ILP32 Toolchain

From LEAP Wiki
Revision as of 23:58, 1 March 2016 by Michael Huang (Talk | contribs)

Jump to: navigation, search
This is a draft!
More details are coming soon.


This page describes the details about using ILP32 AArch64 toolchain on LEAP.


  • Latest LEAP kernel (4.3+)
  • Docker
  • Docker image with AArch64 ILP32 Toolchain

Using ILP32 toolchain

1. You need LEAP running on ARM64 platform: Installation instructions

2. Install the latest LEAP kernel (4.3+) and Docker

yum install kernel docker

3. Since docker is not able to start using systemctl start docker for some reasons, we can still start docker manually

systemctl start docker-storage-setup && screen -dm docker daemon

4. Fetch our AArch64 ILP32 docker image from DockerHub

Sources and Patches


Source: Linaro GCC 4.9.4


Licenses: GNU GPLv2, GNU GPLv3

Description: This is Linaro's 4.9.4 GCC release from June 2015. The above two patches are there to allow building for the aarch64_ilp32 target.


Source: Binutils (commit 9fde51ed303ea3ecbaa7c0084ea417e775a5db29)


Licenses: GNU GPLv2, GNU GPLv3

Description: This is Binutils from the master branch. The above patch allows building for the aarch64_ilp32 target.


Source: GLIBC thunderx-ilp32-32timetoff_t branch (commit 574af3313a602be1197bbc3b5ea9b88b58063244)


Licenses: GNU GPLv2

Description: This is a WIP GLIBC with the ilp32 patches applied. The above patch allows building for the aarch64_ilp32 target.

Building ILP32 toolchain manually


The overall process to build the ILP32 toolchain is a two part process. The toolchain is that is found normally on LEAP isn't capable of emitting ILP32. Thus we will have to build one that does. Using the above sources that have the ILP32 support, we will build a intermediary which is capable of then building what we really want, an ILP32 capable toolchain. The methodology used will resemble building a cross compiler but instead of building for a different platform/architecture, we are building starting with LP64 and going towards ILP32.

To summarize what we'll be doing: LEAP LP64 toolchain -> LP64 toolchain capable of emitting ILP32 -> ILP32 capable toolchain


The following is a guideline showing snippets of a script which will build the ILP32 toolchain natively on LEAP. The script in full can be found here.

The script will assume that:

  • You have obtained the sources above and have applied their respective patches.
  • You are running LEAP with a 4.3 or higher kernel.
  • You have sudo access.
  • The source directories are all in the current directory and have the names gcc, glibc and binutils-gdb respectively.

1. Firstly we will set up some variables that will be used to build both the middleman LP64 and ILP32 toolchains. Mainly these are paths and flags which can be adjusted to your needs and preferences.

# Set up the variables
GCC_CONFIG_ILP32="${GCC_CONFIG_LP64} --with-multilib-list=ilp32"
GLIBC_COMMON="--disable-multilib --disable-profile --disable-debug \
              --disable-werror --without-gd --enable-shared \
              --enable-static-nss --enable-obsolete-rpc libc_cv_forced_unwind=yes"
GLIBC_CONFIG_LP64="--build=$MACHTYPE --host=${TARGET_LP64} --target=${TARGET_LP64} \
                   --with-headers=${INSTALL_PATH_LP64}/${TARGET_LP64}/include/ \
GLIBC_CONFIG_ILP32="--build=$MACHTYPE --host=${TARGET_ILP32} --target=${TARGET_ILP32} \
                    --with-headers=${INSTALL_PATH_ILP32}/${TARGET_ILP32}/include/ \ 

2. Here we'll set up the directory structure we'll be building in as well as setting up the necessary PATH for the build and grabbing some build dependencies. There are two sets of build directories as we'll be building two toolchains during this process.

# Build directory prefixes
# Set up build directories
mkdir ${B_LP64}-{binutils-gdb,gcc,glibc}
mkdir ${B_ILP32}-{binutils-gdb,gcc,glibc}
# Grab the necessary dependencies and tools from the LEAP repo
yum install gcc gcc-c++ bison flex gperf texinfo automake

3. Now we start the build process. We first build our binutils-gdb from the source we obtained.

#--- Start building the LP64 middleman toolchain ---#
# Step 1. Build binutils-gdb and install them
cd ${B_LP64}-binutils-gdb
../binutils-gdb/configure --prefix=$INSTALL_PATH_LP64 --target=$TARGET_LP64
make $PMAKE
make install
cd ..



Extra links