File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Setup Linux mold linker
2+ description : Install mold and make it the default linker for Linux Rust builds.
3+
4+ runs :
5+ using : composite
6+ steps :
7+ # make-default symlinks /usr/bin/ld to mold, which works on any GCC.
8+ # Passing -fuse-ld=mold via RUSTFLAGS instead would break on the
9+ # ubuntu-22.04 release runners: GCC only accepts that value from
10+ # GCC 12 onward. It also leaves RUSTFLAGS (and rust-cache keys)
11+ # untouched.
12+ - name : Install mold
13+ if : runner.os == 'Linux'
14+ uses : rui314/setup-mold@v1
15+ with :
16+ mold-version : 2.41.0
17+ make-default : true
18+
19+ - name : Verify mold is the default linker
20+ if : runner.os == 'Linux'
21+ shell : bash
22+ run : |
23+ set -euo pipefail
24+ mold --version
25+ ld --version | head -n 1 | grep -i mold
Original file line number Diff line number Diff line change 7272
7373 - uses : dtolnay/rust-toolchain@stable
7474
75+ - uses : ./.github/actions/setup-linux-mold
76+
7577 - uses : actions/setup-node@v4
7678 with :
7779 node-version : 22
@@ -303,6 +305,9 @@ jobs:
303305 - uses : dtolnay/rust-toolchain@stable
304306 with :
305307 components : clippy
308+
309+ - uses : ./.github/actions/setup-linux-mold
310+
306311 - name : Cache Rust build outputs
307312 uses : Swatinem/rust-cache@v2
308313 with :
@@ -377,6 +382,8 @@ jobs:
377382
378383 - uses : dtolnay/rust-toolchain@stable
379384
385+ - uses : ./.github/actions/setup-linux-mold
386+
380387 - name : Install ast-grep
381388 run : |
382389 npm install --global "@ast-grep/cli@${AST_GREP_VERSION}"
@@ -456,6 +463,8 @@ jobs:
456463
457464 - uses : dtolnay/rust-toolchain@stable
458465
466+ - uses : ./.github/actions/setup-linux-mold
467+
459468 - name : Install ast-grep
460469 run : |
461470 npm install --global "@ast-grep/cli@${AST_GREP_VERSION}"
Original file line number Diff line number Diff line change 6464 with :
6565 targets : ${{ matrix.target }}
6666
67+ - uses : ./.github/actions/setup-linux-mold
68+
6769 - name : Use lld-link
6870 if : runner.os == 'Windows'
6971 shell : pwsh
Original file line number Diff line number Diff line change 4343
4444 - uses : dtolnay/rust-toolchain@stable
4545
46+ - uses : ./.github/actions/setup-linux-mold
47+
4648 - name : Cache Cargo
4749 uses : actions/cache@v4
4850 with :
8385
8486 - uses : dtolnay/rust-toolchain@stable
8587
88+ - uses : ./.github/actions/setup-linux-mold
89+
8690 - name : Cache Cargo
8791 uses : actions/cache@v4
8892 with :
Original file line number Diff line number Diff line change 7373 with :
7474 targets : ${{ matrix.target }}
7575
76+ # Inline instead of ./.github/actions/setup-linux-mold: this workflow
77+ # can be dispatched with an old release_tag, and the checkout above
78+ # replaces the workspace with that tag, which may predate the local
79+ # action. make-default symlinks ld to mold, which works on this
80+ # runner's GCC 11 (unlike -fuse-ld=mold, which needs GCC 12+).
81+ - name : Install mold
82+ if : runner.os == 'Linux'
83+ uses : rui314/setup-mold@v1
84+ with :
85+ mold-version : 2.41.0
86+ make-default : true
87+
88+ - name : Verify mold is the default linker
89+ if : runner.os == 'Linux'
90+ shell : bash
91+ run : |
92+ set -euo pipefail
93+ mold --version
94+ ld --version | head -n 1 | grep -i mold
95+
7696 - name : Use lld-link
7797 if : runner.os == 'Windows'
7898 shell : pwsh
You can’t perform that action at this time.
0 commit comments