]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Optimize for sandy when building extra x86-64 builds
authorMatt Corallo <git@bluematt.me>
Thu, 1 Feb 2024 19:28:11 +0000 (19:28 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 1 Feb 2024 19:28:11 +0000 (19:28 +0000)
genbindings.sh

index fd797d7978e08e3702f98fb1a70d5d44de9463b9..dd76e3040304b16a1218904a27c520172b5dde17 100755 (executable)
@@ -562,7 +562,14 @@ for IDX in ${!EXTRA_TARGETS[@]}; do
        EXTRA_ENV_TARGET=$(echo "${EXTRA_TARGETS[$IDX]}" | sed 's/-/_/g')
        export CFLAGS_$EXTRA_ENV_TARGET="$BASE_CFLAGS"
        export CC_$EXTRA_ENV_TARGET=${EXTRA_CCS[$IDX]}
-       RUSTFLAGS="$BASE_RUSTFLAGS -C embed-bitcode=yes -C lto -C linker=${EXTRA_CCS[$IDX]}" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS -v --release --target "${EXTRA_TARGETS[$IDX]}"
+       EXTRA_RUSTFLAGS=""
+       case "$EXTRA_ENV_TARGET" in
+               "x86_64"*)
+                       export CFLAGS_$EXTRA_ENV_TARGET="$BASE_CFLAGS -march=sandybridge -mtune=sandybridge"
+                       EXTRA_RUSTFLAGS="-C target-cpu=sandybridge"
+                       ;;
+       esac
+       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
 
 if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then