Point the musl link at the bundled rust-lld, not BFD
Browse files at this commit9e90080644b7ed6d201dcb769fe4904952c5e21aParent: c6d6abc- perf
- point the musl link at the bundled rust-lld, not BFD
1 changed file +16 -9
- .github/workflows/main.yml +16 -9
.github/workflows/main.ymlmodified+16 -9
| @@ -63,16 +63,23 @@ jobs: | |||
| 63 | run: | | 63 | run: | |
| 64 | set -euo pipefail | 64 | set -euo pipefail |
| 65 | # `topcoat asset bundle` runs its own `cargo build` and strips every | 65 | # `topcoat asset bundle` runs its own `cargo build` and strips every |
| 66 | - # CARGO_* variable from it, so the target cannot be passed by | 66 | + # CARGO_* variable from it, so neither the target nor its link flags |
| 67 | - # environment; it goes into the cargo config that inner build reads. | 67 | + # can be passed by environment; they go into the cargo config that |
| 68 | - # This file is written in CI only; it is not committed. | 68 | + # inner build reads. This file is written in CI only; it is not |
| 69 | + # committed. | ||
| 69 | mkdir -p .cargo | 70 | mkdir -p .cargo |
| 70 | - printf '[build]\ntarget = "%s"\n' "$TARGET" >> .cargo/config.toml | 71 | + { |
| 71 | - # The linker stays rustc's default (the bundled rust-lld): a warm | 72 | + printf '[build]\ntarget = "%s"\n\n' "$TARGET" |
| 72 | - # relink of this binary measured 142s under musl-gcc's BFD against | 73 | + printf '[target.x86_64-unknown-linux-musl]\n' |
| 73 | - # 23s under rust-lld, and that link was the largest single chunk of | 74 | + # Link with the toolchain's bundled rust-lld, not the BFD that cc |
| 74 | - # the deploy build. musl-gcc remains the C compiler below — ring's | 75 | + # would pick: a warm relink of this binary measured 142s under |
| 75 | - # assembly needs it, and lld links the objects it produces. | 76 | + # BFD against 23s under lld, and that link is the largest single |
| 77 | + # chunk of the deploy build. `link-self-contained=+linker` would | ||
| 78 | + # say this directly, but its values are unstable — so the cc | ||
| 79 | + # driver is pointed at rustc's own gcc-ld/ld.lld wrapper, the | ||
| 80 | + # same mechanism the gnu target's default linker uses. | ||
| 81 | + 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)" | ||
| 82 | + } >> .cargo/config.toml | ||
| 76 | # C dependencies (ring, under lettre's TLS) compile against musl too. | 83 | # C dependencies (ring, under lettre's TLS) compile against musl too. |
| 77 | echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> "$GITHUB_ENV" | 84 | echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> "$GITHUB_ENV" |
| 78 | 85 | ||