Skip to content

Commit b0f49d1

Browse files
committed
Disable lto in release macOS builds as they no longer work
Not really sure why, but LTO seems to now remove used implementations of `std` causing link failures in downstream languages.
1 parent 42aa74f commit b0f49d1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

genbindings.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,16 +622,18 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then
622622
for ARG in $CFLAGS_aarch64_apple_darwin; do
623623
MANUAL_LINK_CFLAGS="$MANUAL_LINK_CFLAGS -C link-arg=$ARG"
624624
done
625+
# While there's no reason LTO should fail here (and it didn't use to), it now fails with errors like
626+
# ld64.lld: error: undefined symbol: core::fmt::Formatter::debug_lower_hex::hf8e8a79f43d62b68
625627
export CFLAGS_aarch64_apple_darwin="$CFLAGS_aarch64_apple_darwin -O3 -fPIC -fembed-bitcode"
626-
RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14 -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=apple-a14" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS --offline -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort
628+
RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14 -C embed-bitcode=yes -C linker-plugin-lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-mcpu=apple-a14" cargo build $CARGO_BUILD_ARGS --offline -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort
627629
if [ "$HOST_OSX" != "true" ]; then
628630
# If we're not on OSX but can build OSX binaries, build the x86_64 OSX release now
629631
MANUAL_LINK_CFLAGS=""
630632
for ARG in $CFLAGS_x86_64_apple_darwin; do
631633
MANUAL_LINK_CFLAGS="$MANUAL_LINK_CFLAGS -C link-arg=$ARG"
632634
done
633635
export CFLAGS_x86_64_apple_darwin="$CFLAGS_x86_64_apple_darwin -O3 -fPIC -fembed-bitcode"
634-
RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mtune=sandybridge" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS --offline -v --release --target x86_64-apple-darwin -Zbuild-std=std,panic_abort
636+
RUSTC_BOOTSTRAP=1 RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge -C embed-bitcode=yes -C linker-plugin-lto -C linker=$CLANG $MANUAL_LINK_CFLAGS $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS --offline -v --release --target x86_64-apple-darwin -Zbuild-std=std,panic_abort
635637
fi
636638
fi
637639
# If we're on an M1 don't bother building X86 binaries

0 commit comments

Comments
 (0)