Skip to content

Commit 67ebefe

Browse files
committed
feat(packaging/quirks): add the lld quirk for loongson3
1 parent 0e14c67 commit 67ebefe

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

content/developer/packaging/quirks.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,13 @@ Rust uses `LLVM` as its backend. So it may encounter some issue when linking to
2727
```bash
2828
USECLANG=1
2929
```
30+
31+
# `ld.lld` errors mentioning `R_MIPS_64`
32+
33+
While `USECLANG=1` can fix ld errors when building Rust software, the fix doesn't work on `loongson3`, and will cause `ld.lld: error: relocation R_MIPS_64 cannot be used against local symbol` instead. To solve this, disable `USECLANG` and enable `NOLTO` for this architecture only.
34+
35+
```bash
36+
# FIXME: ld.lld: error: relocation R_MIPS_64 cannot be used against local symbol
37+
USECLANG__LOONGSON3=0
38+
NOLTO__LOONGSON3=1
39+
```

content/developer/packaging/quirks.zh.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,13 @@ Rust 使用 `LLVM` 作为后端。因此,在将其链接到使用 `gcc` 编译
2020
```bash
2121
USECLANG=1
2222
```
23+
24+
# `ld.lld` 汇报有关 `R_MIPS_64` 的错误
25+
26+
虽然 `USECLANG=1` 可以修复 Rust 程序的 `ld` 错误,但是在 `loongson3` 上它会带来另一种报错:`ld.lld: error: relocation R_MIPS_64 cannot be used against local symbol`。此时需要单独为此架构禁用 `USECLANG` 和 LTO。
27+
28+
```bash
29+
# FIXME: ld.lld: error: relocation R_MIPS_64 cannot be used against local symbol
30+
USECLANG__LOONGSON3=0
31+
NOLTO__LOONGSON3=1
32+
```

0 commit comments

Comments
 (0)