Skip to content

Commit 7c58eb8

Browse files
committed
Enable X-lang LTO for Windows x86-64 builds (or any extra build)
1 parent cf97d5f commit 7c58eb8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
clang -target x86_64-pc-windows-gnu -L/usr/lib/gcc/x86_64-w64-mingw32/12-win32/ "$@"
2+
clang -fembed-bitcode -fuse-ld=lld -target x86_64-pc-windows-gnu "$@"

genbindings.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ fi
552552

553553
EXTRA_TARGETS=( $LDK_C_BINDINGS_EXTRA_TARGETS )
554554
EXTRA_CCS=( $LDK_C_BINDINGS_EXTRA_TARGET_CCS )
555+
EXTRA_LINK_LTO=( $LDK_C_BINDINGS_EXTRA_TARGET_LINK_LTO )
555556

556557
if [ ${#EXTRA_TARGETS[@]} != ${#EXTRA_CCS[@]} ]; then
557558
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
569570
EXTRA_RUSTFLAGS="-C target-cpu=sandybridge"
570571
;;
571572
esac
573+
[ "${EXTRA_LINK_LTO[$IDX]}" != "" ] && EXTRA_RUSTFLAGS="-C linker-plugin-lto"
572574
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]}"
573575
done
574576

0 commit comments

Comments
 (0)