AArch64
apps#The toolchain that should be used for AArch64
is aarch64-none-elf
, to be installed from the official Arm development site.
Similar with the command we'll present for cross-compiling with clang
, we build the app using
$ make -j $(nproc) CROSS_COMPILE=~/toolchains/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
Clang
#As clang
becomes more and more used in the industry, we also provide a series of steps in order to compile your application with it.
Besides coming up with cool sanitizers (SafeStack, ShadowStack and more), clang
becomes a very interesting alternative to gcc
when it comes to speed and memory1, so why not give it a try?!
Firstly, we must consider what architecture we are working on, because the steps differ quite a bit.
Clang
on x86
#Configure your application as you would usually do, then build it using:
$ make CC=clang
Clang
on AArch64
#There are two ways of cross-compiling your app based off the toolchain you'll choose;
there's either aarch64-linux-gnu
or aarch64-none-linux-gnu
.
The first one can be installed via your default package manager (the gcc-aarch64-linux-gnu
package on Ubuntu), while the second one should be fetched from the official Arm development site.
To configure your app keep your regular configuartions and dissable all the erratums
from the Architecture Selection
.
aarch64-linux-gnu
, build your application with:$ make -j $(ncpus) CC=clang
aarch64-none-linux-gnu
, build your application with:$ make -j $(ncpus) CROSS_COMPILE=~/toolchains/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- CC=clang
The actual right way of building apps on
AArch64
is by cross-compiling withaarch64-none-elf
, as the other toolchains expectglibc
to be used, while that's not the case for unikraft.However,
aarch64-none-elf
clashes with our expectations regarding theemutls
and becomes unusable together withclang
.
Feel free to ask questions, report issues, and meet new people.