@@ -619,23 +619,35 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then
619619 LINK_ARG_FLAGS=" -C link-arg=-fuse-ld=$LLD "
620620 export LDK_CLANG_PATH=$( which $CLANG )
621621 if [ " $MACOS_SDK " != " " ]; then
622- REALLY_PIN_CC
622+ # At some point rustc fixed the issue which merits REALLY_PIN_CC. I'm not sure when,
623+ # however, so we just use 1.84 as the cutoff.
624+ RUSTC_MINOR_VERSION=$( rustc --version | awk ' { split($2,a,"."); print a[2] }' )
625+ [ " $RUSTC_MINOR_VERSION " -lt 84 ] && REALLY_PIN_CC
626+ [ " $RUSTC_MINOR_VERSION " -lt 84 ] && OFFLINE_OPT=" --offline"
627+
623628 export CLANG=" $( pwd) /../deterministic-build-wrappers/clang-lto-link-osx"
624629 for ARG in $CFLAGS_aarch64_apple_darwin ; do
625630 MANUAL_LINK_CFLAGS=" $MANUAL_LINK_CFLAGS -C link-arg=$ARG "
626631 done
632+ # rustc appears to always look for rust-objcopy, though this may be fixed by
633+ # https://github.com/rust-lang/rust/pull/134240 in rust 1.85.
634+ if [ " $RUSTC_MINOR_VERSION = 84 ]; then
635+ mkdir -p objcopy-bin
636+ ln -s ` which llvm-objcopy` objcopy-bin/rust-objcopy
637+ PATH=" $PATH :$( pwd) /objcopy-bin"
638+ fi
627639 # While there's no reason LTO should fail here (and it didn't use to), it now fails with errors like
628640 # ld64.lld: error: undefined symbol: core::fmt::Formatter::debug_lower_hex::hf8e8a79f43d62b68
629641 export CFLAGS_aarch64_apple_darwin=" $CFLAGS_aarch64_apple_darwin -O 3 -f PIC -f embed-bitcode"
630- 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
642+ 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_OPT -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort
631643 if [ " $HOST_OSX " != " true" ]; then
632644 # If we're not on OSX but can build OSX binaries, build the x86_64 OSX release now
633645 MANUAL_LINK_CFLAGS=" "
634646 for ARG in $CFLAGS_x86_64_apple_darwin ; do
635647 MANUAL_LINK_CFLAGS=" $MANUAL_LINK_CFLAGS -C link-arg= $ARG "
636648 done
637649 export CFLAGS_x86_64_apple_darwin=" $CFLAGS_x86_64_apple_darwin -O 3 -f PIC -f embed-bitcode"
638- 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
650+ 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_OPT -v --release --target x86_64-apple-darwin -Zbuild-std=std,panic_abort
639651 fi
640652 fi
641653 # If we're on an M1 don't bother building X86 binaries
0 commit comments