Cross compilation with clang and LLVM tools.
summary
Clang and LLVM aim to be drop‑in for GCC but require explicit plumbing: use clang with --gcc-toolchain and --sysroot to point at a GCC cross toolchain, rebuild libunwind, libc++abi and compiler‑rt for ARM/AArch64, and pass explicit include/lib paths for libc++/compiler-rt usage. Integrated assembler and lld differ from GNU tools (assembly syntax and linker‑script/OMAGIC edge cases), so several fiddly flags are necessary; an example with sanitizer + exception handling is shown working after rebuilding the runtime libs. No single downloadable multi‑lib clang cross‑toolchain exists yet.
AI-written summary · about
chapters (21)
- 0:00Intro
- 1:55Definitions
- 2:17Motivation for cross compilation
- 2:33A cross compiled application
- 6:06Using Clang as a Cross Compiler
- 10:55Arm Target Triple examples
- 13:48Anatomy of a Clang installation
- 16:36Using a Clang installation for cross compiling
- 17:14Finding the location of a GCC cross compiler A bunch of heuristics guided by two relevant command-line options
- 19:25Example multiarch on Ubuntu 16.04
- 20:41Limitations of Clang's Driver
- 22:20Additional cross compilation options
- 25:05A C++ example using libc++ and sanitizers
- 25:48Cross compiling for embedded systems
- 28:45Cross compilation with CMake
- 31:21Differences between GCC and Clang
- 31:34GCC/Clang assembler differences
- 34:27GCC/Clang general differences
- 35:50LLD Limitations and differences
- 38:49Supporting Clang in your open source project • Rely on the cross-compilation options of the build system
- 41:13How could we assemble a Clang toolchain today?
related talks
59mAnatomy of Cross-Compilation Toolchains
46mClinging to Clang
37mToolchain Options in 2023: What's New in Compilers and Libcs?
01h 05mTutorial: Toolchains
49mLLVMLinux: The Linux Kernel with Dragon Wings
43mLLVMLinux: Compiling the Linux Kernel with LLVM
53mLLVM
31mToolchains for People in a Hurry: Latest Features of GCC/GLIBC
