diff --git a/.github/workflows/build-release-binaries.yml b/.github/workflows/build-release-binaries.yml index 7ebc949fa77..de868f8ab61 100644 --- a/.github/workflows/build-release-binaries.yml +++ b/.github/workflows/build-release-binaries.yml @@ -112,6 +112,9 @@ jobs: args: --release --locked --out dist --features self-update --compatibility pypi env: CARGO: ${{ github.workspace }}/scripts/cargo.sh + # Use Rust's bundled Mach-O LLD, which supports ICF. + # ICF reduces the macOS x86_64 uv binary size by ~2%. + RUSTFLAGS: "-C linker=rust-lld -C linker-flavor=ld64.lld -C link-arg=--icf=safe" - name: "Upload wheels" uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: @@ -145,6 +148,9 @@ jobs: args: --profile minimal-size --locked --out crates/uv-build/dist -m crates/uv-build/Cargo.toml --compatibility pypi env: CARGO: ${{ github.workspace }}/scripts/cargo.sh + # Use Rust's bundled Mach-O LLD, which supports ICF. + # ICF reduces the macOS x86_64 uv-build binary size by ~0.7%. + RUSTFLAGS: "-C linker=rust-lld -C linker-flavor=ld64.lld -C link-arg=--icf=safe" - name: "Upload wheels uv-build" uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: @@ -179,6 +185,9 @@ jobs: args: --release --locked --out dist --features self-update --compatibility pypi env: CARGO: ${{ github.workspace }}/scripts/cargo.sh + # Use Rust's bundled Mach-O LLD, which supports ICF. + # ICF reduces the macOS aarch64 uv binary size by ~1.4%. + RUSTFLAGS: "-C linker=rust-lld -C linker-flavor=ld64.lld -C link-arg=--icf=safe" - name: "Test wheel - aarch64" run: | pip install ${PACKAGE_NAME} --no-index --find-links dist/ --force-reinstall @@ -218,6 +227,9 @@ jobs: args: --profile minimal-size --locked --out crates/uv-build/dist -m crates/uv-build/Cargo.toml --compatibility pypi env: CARGO: ${{ github.workspace }}/scripts/cargo.sh + # Use Rust's bundled Mach-O LLD, which supports ICF. + # ICF reduces the macOS aarch64 uv-build binary size by ~0.7%. + RUSTFLAGS: "-C linker=rust-lld -C linker-flavor=ld64.lld -C link-arg=--icf=safe" - name: "Test wheel - aarch64" run: | pip install ${PACKAGE_NAME}_build --no-index --find-links crates/uv-build/dist --force-reinstall