Skip to content

Commit 3fa5533

Browse files
committed
docs: the toolchain page states that a stated linker is clang's, and its gcc example no longer states one
The cross example named `tools = { ld = ... }` on a gcc tree, which the engine now refuses, and nothing said which trees read that role.
1 parent cb91861 commit 3fa5533

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎docs/20-toolchains.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ prefix = "aarch64-none-linux-gnu-"
386386
sysroot = "/opt/acme-sysroot"
387387
family = "gcc" # checked against the drivers
388388
launcher = "ccache" # prefixes every compile
389-
tools = { ld = "/opt/lld-dev/bin/ld.lld" } # cc, cxx, ld, ar, ranlib, nm, objcopy, strip, as
389+
tools = { ar = "/opt/acme-gcc/bin/gcc-ar" } # cc, cxx, ar, ranlib, nm, objcopy, strip, as
390390
```
391391

392392
Or for one build, without editing the manifest:
@@ -402,6 +402,12 @@ whether `import std` is available are read from the driver itself. The tools
402402
beside them are found as `<prefix><tool>`, then `llvm-<tool>`, then `<tool>`;
403403
`tools` names any the tree does not have.
404404

405+
`tools = { ld = … }` is read by a clang tree, where the linker reaches the link
406+
as `--ld-path`. A gcc tree that states `ld` is refused: gcc chooses its linker by
407+
the name `ld` inside a directory it is given with `-B`, so a program under any
408+
other name could not be selected, and a stated tool that took no part in the
409+
build is what this mechanism exists to prevent.
410+
405411
**What mcpp does with it.** The same as with a payload it installed: its own
406412
link line, its own hermetic check, its own `import std` decision. It writes
407413
nothing into the tree — the generated `clang++.cfg` of a managed payload is

‎docs/zh/20-toolchains.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ prefix = "aarch64-none-linux-gnu-"
364364
sysroot = "/opt/acme-sysroot"
365365
family = "gcc" # 与驱动核对
366366
launcher = "ccache" # 前置于每次编译
367-
tools = { ld = "/opt/lld-dev/bin/ld.lld" } # cc、cxx、ld、ar、ranlib、nm、objcopy、strip、as
367+
tools = { ar = "/opt/acme-gcc/bin/gcc-ar" } # cc、cxx、ar、ranlib、nm、objcopy、strip、as
368368
```
369369

370370
或者只对一次构建生效,不改清单:
@@ -378,6 +378,10 @@ MCPP_TOOLCHAIN=path:/opt/llvm-trunk mcpp build
378378
得到。旁边的工具按 `<prefix><tool>`、`llvm-<tool>`、`<tool>` 查找;`tools` 点名树里没有的
379379
那些。
380380

381+
`tools = { ld = … }` 只对 clang 的树成立——被陈述的链接器以 `--ld-path` 进入链接。gcc 的树
382+
陈述 `ld` 会被拒绝:gcc 按 `-B` 给出的目录里的名字 `ld` 选链接器,叫别的名字的程序无法那样
383+
被选中,而一个进了声明却不参与构建的工具,正是这套机制要防的事。
384+
381385
**mcpp 如何驱动它。** 与它自己安装的载荷相同:自己的链接行、自己的 hermetic 检查、自己
382386
对 `import std` 的判定。它不向该目录树写入任何东西 —— 托管载荷里生成的 `clang++.cfg` 是
383387
mcpp 自己的文件,而一棵不属于 mcpp 的树不会得到一份。

0 commit comments

Comments
 (0)