Skip to content

Instantly share code, notes, and snippets.

@Trass3r
Created June 19, 2021 13:22
Show Gist options
  • Save Trass3r/270d014a9f34a6be9b9d3bd7c9196eb2 to your computer and use it in GitHub Desktop.
Save Trass3r/270d014a9f34a6be9b9d3bd7c9196eb2 to your computer and use it in GitHub Desktop.
build QEMU with LTO
sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
apt update && apt build-dep -y qemu
apt install -y git clang lld
mkdir build && cd build
CC=clang CXX=clang++ CFLAGS="-O3 -march=skylake -flto=thin" CXXFLAGS="-O3 -march=skylake -flto=thin" LDFLAGS="-fuse-ld=lld -O3 -march=skylake -flto=thin" \
../configure --prefix=$(pwd)/install --target-list=aarch64-linux-user --static --disable-system --enable-linux-user --enable-lto --disable-stack-protector --disable-pie
-gsplit-dwarf
--disable-strip
ninja qemu-aarch64 && chown -R 1000:1000 .
objcopy --only-keep-debug qemu-aarch64 qemu-aarch64.debug && strip -s qemu-aarch64 && objcopy --add-gnu-debuglink=qemu-aarch64.debug qemu-aarch64
--extra-ldflags=-fuse-ld=lld
--extra-cflags="-O3 -march=skylake" --extra-cxxflags="-O3 -march=skylake"
--enable-avx2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment