From 10171f37873040c357ec054ef4f65ebc9d2fc805 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Thu, 21 Sep 2023 00:39:07 +0800 Subject: [PATCH] Disable ThinLTO on static builds --- src/build.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/build.sh b/src/build.sh index 06132e47ed..9c7cd5117e 100755 --- a/src/build.sh +++ b/src/build.sh @@ -91,6 +91,18 @@ case "$EXTRA_FLAGS" in ;; esac +# OpenWrt static builds are bad with Clang 18+ and ThinLTO. +# Segfaults in fstack-protector on ARM. +# See https://github.com/llvm/llvm-project/issues/64999 +case "$EXTRA_FLAGS" in +*build_static=true*) + if [ "$target_cpu" = "arm" ]; then + flags="$flags"' + use_thin_lto=false' + fi + ;; +esac + rm -rf "./$out" mkdir -p out