From 7c58eb84a8606660998a63e98c279f4e92512cf0 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 1 Feb 2024 19:28:31 +0000 Subject: [PATCH] Enable X-lang LTO for Windows x86-64 builds (or any extra build) --- deterministic-build-wrappers/clang-x86_64-windows | 2 +- genbindings.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/deterministic-build-wrappers/clang-x86_64-windows b/deterministic-build-wrappers/clang-x86_64-windows index 31bb028..6c925dd 100755 --- a/deterministic-build-wrappers/clang-x86_64-windows +++ b/deterministic-build-wrappers/clang-x86_64-windows @@ -1,2 +1,2 @@ #!/bin/bash -clang -target x86_64-pc-windows-gnu -L/usr/lib/gcc/x86_64-w64-mingw32/12-win32/ "$@" +clang -fembed-bitcode -fuse-ld=lld -target x86_64-pc-windows-gnu "$@" diff --git a/genbindings.sh b/genbindings.sh index dd76e30..6007f72 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -552,6 +552,7 @@ fi EXTRA_TARGETS=( $LDK_C_BINDINGS_EXTRA_TARGETS ) EXTRA_CCS=( $LDK_C_BINDINGS_EXTRA_TARGET_CCS ) +EXTRA_LINK_LTO=( $LDK_C_BINDINGS_EXTRA_TARGET_LINK_LTO ) if [ ${#EXTRA_TARGETS[@]} != ${#EXTRA_CCS[@]} ]; then echo "LDK_C_BINDINGS_EXTRA_TARGETS and LDK_C_BINDINGS_EXTRA_TARGET_CCS didn't have the same number of elements!" @@ -569,6 +570,7 @@ for IDX in ${!EXTRA_TARGETS[@]}; do EXTRA_RUSTFLAGS="-C target-cpu=sandybridge" ;; esac + [ "${EXTRA_LINK_LTO[$IDX]}" != "" ] && EXTRA_RUSTFLAGS="-C linker-plugin-lto" RUSTFLAGS="$BASE_RUSTFLAGS -C embed-bitcode=yes -C lto -C linker=${EXTRA_CCS[$IDX]} $EXTRA_RUSTFLAGS" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS -v --release --target "${EXTRA_TARGETS[$IDX]}" done -- 2.39.5