Skip to content

Commit b5ccb17

Browse files
committed
Stop passing -mcpu on x86-64
This is actually not supported, but we did it anyway because Debian accepted it. Instead, we should rely on -march and -mtune
1 parent 8e22d30 commit b5ccb17

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

genbindings.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ rm genbindings_path_map_test_file.c
7474
case "$ENV_TARGET" in
7575
"x86_64"*)
7676
export RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge"
77-
export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -march=sandybridge -mcpu=sandybridge -mtune=sandybridge"
77+
export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -march=sandybridge -mtune=sandybridge"
7878
export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS"
7979
;;
8080
"aarch64_apple_darwin")
@@ -85,7 +85,7 @@ case "$ENV_TARGET" in
8585
*)
8686
# Assume this isn't targeted at another host and build for the host's CPU.
8787
export RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=native"
88-
export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -mcpu=native"
88+
export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -march=native -mtune=native"
8989
export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS"
9090
;;
9191
esac
@@ -588,7 +588,7 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then
588588
MANUAL_LINK_CFLAGS="$MANUAL_LINK_CFLAGS -C link-arg=$ARG"
589589
done
590590
export CFLAGS_x86_64_apple_darwin="$CFLAGS_x86_64_apple_darwin -O3 -fPIC -fembed-bitcode"
591-
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=-mcpu=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
591+
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
592592
fi
593593
fi
594594
# If we're on an M1 don't bother building X86 binaries
@@ -597,7 +597,7 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then
597597
export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -O3 -fPIC -fembed-bitcode"
598598
# Rust doesn't recognize CFLAGS changes, so we need to clean build artifacts
599599
cargo clean --release
600-
CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="$RUSTFLAGS -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS -v --release
600+
CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="$RUSTFLAGS -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS -v --release
601601

602602
if [ "$2" = "true" ]; then
603603
$CLANGPP $LOCAL_CFLAGS -flto -fuse-ld=$LLD -O2 -c demo.cpp -o demo.o

0 commit comments

Comments
 (0)