Compiled on RPI4B-8G with 6.6.47-piCore-v8 on portable SSD Compile Flags: ## test build ## CC='clang' CXX='clang++' CFLAGS='-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe' CXXFLAGS='-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe' EXTRA_C=' -L/usr/local/lib -flto -fuse-ld=gold -fuse-linker-plugin -fno-exceptions' EXTRA_CXX=' -L/usr/local/lib -flto -fuse-ld=gold -fuse-linker-plugin -fno-exceptions -fno-rtti' CFLAGS="${CFLAGS}${EXTRA_C}" CXXFLAGS="${CXXFLAGS}${EXTRA_CXX}" LDFLAGS='-Wl,-L/usr/local/lib -Wl,-O1' export CFLAGS CXXFLAGS LDFLAGS ## actual package ## CC='clang --gcc-install-dir=/usr/local/lib/gcc/armv7l-unknown-linux-gnueabihf/13.2.0' CXX='clang++ --gcc-install-dir=/usr/local/lib/gcc/armv7l-unknown-linux-gnueabihf/13.2.0' CFLAGS='-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe' CXXFLAGS='-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe' EXTRA_C=' -L/usr/local/lib -flto=full -fuse-ld=lld -fno-exceptions' EXTRA_CXX=' -L/usr/local/lib -flto=full -fuse-ld=lld -fno-exceptions -fno-rtti' CFLAGS="${CFLAGS}${EXTRA_C}" CXXFLAGS="${CXXFLAGS}${EXTRA_CXX}" LDFLAGS='-L/usr/local/lib -Wl,-O1 -Wl,-rpath=/usr/local/lib' export CC CXX CFLAGS CXXFLAGS LDFLAGS Dependencies: compiletc llvm19-dev cmake python3.12 ninja clang Commands: sudo busybox cp $(realpath /usr/local/bin/llvm-config) /usr/local/bin/llvm-config cd /mnt/sda1/compile-temp VER=19.1.0 wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VER}/lld-${VER}.src.tar.xz wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VER}/libunwind-${VER}.src.tar.xz wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${VER}/cmake-${VER}.src.tar.xz tar -xf lld-${VER}.src.tar.xz tar -xf libunwind-${VER}.src.tar.xz tar -xf cmake-${VER}.src.tar.xz mv libunwind-${VER}.src/include/mach-o/ lld-${VER}.src/MachO/ mv cmake-${VER}.src/ cmake/ cd lld-${VER}.src/ && mkdir build && cd build ## test builds ## # export test flags ### GCC + GOLD ### time cmake -DCMAKE_C_FLAGS_MINSIZEREL="$CFLAGS" -DCMAKE_CXX_FLAGS_MINSIZEREL="$CXXFLAGS" \ -DCMAKE_BUILD_TYPE=MINSIZEREL -DLLVM_ENABLE_PROJECTS=lld -DCMAKE_INSTALL_PREFIX=/usr/local -G Ninja .. real 0m 5.02s user 0m 3.80s sys 0m 1.43s time ninja -j4 real 14m 5.70s user 40m 44.54s sys 1m 27.27s DESTDIR=/mnt/sda1/compile-temp/gcc-outcome ninja install sudo ninja install ### CLANG + LLD ### #### LTO: -flto time ninja -j4 real 35m 56.11s user 1h 59m 51s sys 1m 19.98s #### LTO: -flto=thin time ninja -j4 real 32m 0.75s user 2h 2m 34s sys 1m 20.34s #### LTO: -flto=full time ninja -j4 real 35m 58.42s user 1h 59m 44s sys 1m 21.56s ### Size comparison tc@pi4-1:/mnt/sda1/unstripped-copies$ du -hd0 * 117.6M gcc-outcome 62.0M lld 61.7M lld-full 63.7M lld-thin tc@pi4-1:/tmp/stripped$ du -hd0 * 102.6M gcc-outcome 54.9M lld 54.6M lld-full 55.2M lld-thin ## final package ## #### LTO: -flto=full