Skip to content

Commit 8e6e942

Browse files
bgwmischnic
authored andcommitted
Switch from ld (the default linker) to using lld for GNU Linux targets
Copies changes from vercel/turborepo#8166
1 parent 37df9ab commit 8e6e942

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

.cargo/config.toml

+10-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ rustflags = ["-C", "target-feature=+crt-static"]
2222
[target.aarch64-pc-windows-msvc]
2323
linker = "rust-lld"
2424

25-
[target.aarch64-apple-darwin]
25+
[target.'cfg(target_os = "macos")']
2626
linker = "rust-lld"
2727

28-
[target.aarch64-unknown-linux-gnu]
29-
linker = "aarch64-linux-gnu-gcc"
28+
[target.'cfg(all(target_os = "linux", target_env = "gnu"))']
29+
rustflags = [
30+
"--cfg",
31+
"tokio_unstable",
32+
"-Zshare-generics=y",
33+
"-Zthreads=8",
34+
"-Csymbol-mangling-version=v0",
35+
"-Clink-arg=-fuse-ld=lld",
36+
]
3037

3138
[target.aarch64-unknown-linux-musl]
3239
linker = "aarch64-linux-musl-gcc"

.github/actions/setup-rust/action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ runs:
1616
rustflags: ''
1717
cache: false
1818

19+
- name: 'Install LLD (LLVM Linker) for Linux'
20+
if: runner.os == 'Linux'
21+
shell: bash
22+
run: sudo apt-get -y update && sudo apt-get install -y lld
23+
1924
- name: 'Add cargo problem matchers'
2025
shell: bash
2126
run: echo "::add-matcher::${{ github.action_path }}/matchers.json"

contributing/core/developing.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,21 @@
44
- All pull requests should be opened against `canary`.
55
- The changes on the `canary` branch are published to the `@canary` tag on npm regularly.
66

7-
To develop locally:
7+
## Dependencies
8+
9+
- Install Rust and Cargo via [rustup](https://rustup.rs).
10+
- Install the [GitHub CLI](https://github.com/cli/cli#installation).
11+
- Enable pnpm:
12+
```
13+
corepack enable pnpm
14+
```
15+
- (Linux) Install LLD, the LLVM linker:
16+
```
17+
sudo apt install lld
18+
```
19+
20+
## Local Development
821

9-
1. Install Rust and Cargo via [rustup](https://rustup.rs).
10-
1. Install the [GitHub CLI](https://github.com/cli/cli#installation).
1122
1. Clone the Next.js repository (download only recent commits for faster clone):
1223
```
1324
gh repo clone vercel/next.js -- --filter=blob:none --branch canary --single-branch
@@ -16,10 +27,6 @@ To develop locally:
1627
```
1728
git checkout -b MY_BRANCH_NAME origin/canary
1829
```
19-
1. Enable pnpm:
20-
```
21-
corepack enable pnpm
22-
```
2330
1. Install the dependencies with:
2431
```
2532
pnpm install

0 commit comments

Comments
 (0)