diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c60d06..2c0a8a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,16 +63,23 @@ jobs: run: | set -euo pipefail # `topcoat asset bundle` runs its own `cargo build` and strips every - # CARGO_* variable from it, so the target cannot be passed by - # environment; it goes into the cargo config that inner build reads. - # This file is written in CI only; it is not committed. + # CARGO_* variable from it, so neither the target nor its link flags + # can be passed by environment; they go into the cargo config that + # inner build reads. This file is written in CI only; it is not + # committed. mkdir -p .cargo - printf '[build]\ntarget = "%s"\n' "$TARGET" >> .cargo/config.toml - # The linker stays rustc's default (the bundled rust-lld): a warm - # relink of this binary measured 142s under musl-gcc's BFD against - # 23s under rust-lld, and that link was the largest single chunk of - # the deploy build. musl-gcc remains the C compiler below — ring's - # assembly needs it, and lld links the objects it produces. + { + printf '[build]\ntarget = "%s"\n\n' "$TARGET" + printf '[target.x86_64-unknown-linux-musl]\n' + # Link with the toolchain's bundled rust-lld, not the BFD that cc + # would pick: a warm relink of this binary measured 142s under + # BFD against 23s under lld, and that link is the largest single + # chunk of the deploy build. `link-self-contained=+linker` would + # say this directly, but its values are unstable — so the cc + # driver is pointed at rustc's own gcc-ld/ld.lld wrapper, the + # same mechanism the gnu target's default linker uses. + printf 'rustflags = ["-C", "link-arg=-B%s/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld", "-C", "link-arg=-fuse-ld=lld"]\n' "$(rustc --print sysroot)" + } >> .cargo/config.toml # C dependencies (ring, under lettre's TLS) compile against musl too. echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> "$GITHUB_ENV"