The toolchain that should be used for
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 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.
Configure your application as you would usually do, then build it using:
$ make CC=clang
There are two ways of cross-compiling your app based off the toolchain you'll choose;
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
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
AArch64is by cross-compiling with
aarch64-none-elf, as the other toolchains expect
glibcto be used, while that's not the case for unikraft.
aarch64-none-elfclashes with our expectations regarding the
emutlsand becomes unusable together with
Feel free to ask questions, report issues, and meet new people.