Brussels / 3 & 4 February 2018


How to cross-compile with LLVM based tools

In theory the LLVM tools support cross-compilation out of the box, with all tools potentially containing support for all targets. In practice getting it to work is more complicated, configuration options have to be given and the missing parts of the toolchain need to be provided. In this presentation we will go through the steps needed to use an X86 linux host to cross-compile an application to run on an Arm target, using as many of the LLVM tools as possible. We'll cover: - Getting hold of the LLVM tools and libraries. - Providing the missing bits that LLVM doesn't provide. - The configuration options needed to make it work. - Running the application using an emulator.

This talks is primarily aimed at users of LLVM based tools on Linux, with no specific knowledge of LLVM internals required for the majority of the material.

The LLVM based tools and libraries we will be using are: - Clang (including the integrated assembler). - LLD. - Compiler-rt. - Libc++, libc++abi and libunwind.

Some of these components can be provided pre-built, for others such as the libraries we may need to build ourselves.

The main missing part of the toolchain that we have to provide is the C-library such as libc provided by either a multiarch Linux distribution or a standalone Linaro GCC release. For the primary example we'll build and run a Linux application that can be run on the qemu user mode emulator. If there is time we can explore the more complicated scenario of developing a bare-metal application using newlib running on the qemu system emulator.


Peter Smith