Difference between revisions of "AArch64 ILP32 Toolchain"

From LEAP Wiki
Jump to: navigation, search
(Building ILP32 toolchain manually)
(Building ILP32 toolchain manually)
Line 55: Line 55:
 
=== Overview ===
 
=== Overview ===
  
 +
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
  
 
=== Script ===
 
=== Script ===
Line 68: Line 70:
  
  
1. Firstly we will set up some variables that will be used in the script. Mainly these are paths and flags which can be adjusted to your needs and preferences.
+
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.
 
<source lang=bash>
 
<source lang=bash>
 
# Set up the variables
 
# Set up the variables
 
INSTALL_PATH_LP64=/opt/lp64
 
INSTALL_PATH_LP64=/opt/lp64
 
INSTALL_PATH_ILP32=/opt/ilp32
 
INSTALL_PATH_ILP32=/opt/ilp32
TARGET_LP64=aarch64-leap-linux-gnu
+
TARGET_LP64=aarch64-lp64-linux-gnu
 
TARGET_ILP32=aarch64_ilp32-linux-gnu
 
TARGET_ILP32=aarch64_ilp32-linux-gnu
 
GCC_CONFIG_LP64="--enable-languages=c,c++,fortran"
 
GCC_CONFIG_LP64="--enable-languages=c,c++,fortran"
Line 92: Line 94:
 
</source>
 
</source>
  
 
+
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.
 
<source lang=bash>
 
<source lang=bash>
  
 +
# Build directory prefixes
 +
B_LP64=build-lp64
 +
B_ILP32=build-ilp32
  
 +
# Set up build directories
 +
mkdir ${B_LP64}-{binutils-gdb,gcc,glibc}
 +
mkdir ${B_ILP32}-{binutils-gdb,gcc,glibc}
  
 +
export PATH=${INSTALL_PATH_ILP32}/bin:${INSTALL_PATH_LP64}/bin:$PATH
 +
 +
# Grab the necessary dependencies and tools from the LEAP repo
 +
yum install gcc gcc-c++ bison flex gperf texinfo automake
 
</source>
 
</source>
  
 
+
3. Now we start the build process. We first build our binutils-gdb from the source we obtained.
 
<source lang=bash>
 
<source lang=bash>
 +
#--- 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 ..
 +
</source>
  
 +
4.
 +
<source lang=bash>
  
 
</source>
 
</source>
  
 
== Extra links ==
 
== Extra links ==

Revision as of 23:58, 1 March 2016

Idea.png
This is a draft!
More details are coming soon.

Introduction

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

Requirements

  • 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

GCC

Source: Linaro GCC 4.9.4

Patches:

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.

Binutils

Source: Binutils (commit 9fde51ed303ea3ecbaa7c0084ea417e775a5db29)

Patches:

Licenses: GNU GPLv2, GNU GPLv3

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

GLIBC

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

Patches:

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

Overview

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

Script

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
INSTALL_PATH_LP64=/opt/lp64
INSTALL_PATH_ILP32=/opt/ilp32
TARGET_LP64=aarch64-lp64-linux-gnu
TARGET_ILP32=aarch64_ilp32-linux-gnu
GCC_CONFIG_LP64="--enable-languages=c,c++,fortran"
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_COMMON}"
 
GLIBC_CONFIG_ILP32="--build=$MACHTYPE --host=${TARGET_ILP32} --target=${TARGET_ILP32} \
                    --with-headers=${INSTALL_PATH_ILP32}/${TARGET_ILP32}/include/ \ 
                    ${GLIBC_COMMON}"
PMAKE=-j10

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
B_LP64=build-lp64
B_ILP32=build-ilp32
 
# Set up build directories
mkdir ${B_LP64}-{binutils-gdb,gcc,glibc}
mkdir ${B_ILP32}-{binutils-gdb,gcc,glibc}
 
export PATH=${INSTALL_PATH_ILP32}/bin:${INSTALL_PATH_LP64}/bin:$PATH
 
# 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 ..

4.

 

Extra links