From f56f42a3e8adee1d21286509094a0661b5e96c64 Mon Sep 17 00:00:00 2001 From: Hermes CI Date: Tue, 25 Aug 2026 21:52:44 -0500 Subject: [PATCH] ci(build): restore -C target-cpu=x86-64-v3 on published x86_64 builds Issue #20: !17 (#16) made the x86-64-v3 baseline opt-in via RUSTFLAGS but nothing set it, so release binaries silently fell back to the plain x86-64 baseline. Set RUSTFLAGS per matrix row on the two x86_64 entries only: - linux x86_64-unknown-linux-gnu: -C target-cpu=x86-64-v3 - windows x86_64-pc-windows-msvc: -C target-cpu=x86-64-v3 -C link-arg=/STACK:8388608 (carries the 8 MB stack link-arg that the repo config supplies for Windows, because RUSTFLAGS REPLACES config rustflags rather than appending) The aarch64 rows keep the config's link-args untouched (no RUSTFLAGS at all), and macOS / android jobs plus .cargo/config.toml are unchanged. Closes #20 --- .github/workflows/build.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index feb5869..8dfa930 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,6 +67,15 @@ jobs: https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.LLVM_VERSION }}/LLVM-${{ env.LLVM_VERSION }}-Linux-${{ matrix.llvm }}.tar.xz + # The published x86_64 release artifact is the only Linux build that may + # use the AVX2/BMI2 baseline (.cargo/config.toml deliberately keeps the + # default build portable after !17; see issue #20). RUSTFLAGS REPLACES + # config rustflags, so set it here — per matrix row — never in the + # config. The aarch64 row must not receive any RUSTFLAGS (an empty + # RUSTFLAGS would also drop its -fuse-ld=lld link-arg). + - name: Set RUSTFLAGS for x86_64 (x86-64-v3) + if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + run: echo "RUSTFLAGS=-C target-cpu=x86-64-v3" >> $GITHUB_ENV - name: Build run: | cargo build --profile ${{ env.BUILD_PROFILE }} -v --target=${{ matrix.target }} @@ -115,6 +124,14 @@ jobs: https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.LLVM_VERSION }}/LLVM-${{ env.LLVM_VERSION }}-${{ matrix.llvm }}.exe + # The published x86_64 Windows artifact must keep the optimised baseline + # (issue #20). RUSTFLAGS REPLACES config rustflags, so carry the 8 MB + # stack link-arg the config supplies for Windows alongside the CPU flag; + # the aarch64 row must not receive any RUSTFLAGS (an empty RUSTFLAGS + # would also drop its /STACK:8388608 link-arg). + - name: Set RUSTFLAGS for x86_64 (x86-64-v3 + 8 MB stack) + if: ${{ matrix.target == 'x86_64-pc-windows-msvc' }} + run: echo "RUSTFLAGS=-C target-cpu=x86-64-v3 -C link-arg=/STACK:8388608" >> $env:GITHUB_ENV - name: Build run: | cargo build --profile ${{ env.BUILD_PROFILE }} -v --target=${{ matrix.target }}