Commit e583763
committed
feat: opt a target triple's stdlib out of the bundled libc
rustc puts the prebuilt stdlib's `self-contained` directory on the linker
search path ahead of the CC toolchain's `-L`, so `-lc` always resolves to
the libc rustc ships. A workspace that builds its own sysroot -- a distro,
an OS image, an embedded target -- silently links the wrong libc, and any
patch it carries in that libc never reaches a Rust binary.
`-C link-self-contained=no` does not help: it leaves the search path in
place (verified on 1.95.0, byte-identical output). The files have to leave
the sandbox instead, so the stdlib repo grows a second filegroup without
the archives, and `declare_rustc_toolchains` grows a triple list that
selects it.
The CRT objects stay in the filtered filegroup. Remove the directory
altogether and rustc stops using self-contained CRT, emitting bare
`rcrt1.o` / `crti.o` names that the clang driver cannot resolve.1 parent 8133604 commit e583763
2 files changed
Lines changed: 27 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
23 | 43 | | |
24 | 44 | | |
25 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
| 106 | + | |
| 107 | + | |
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
| |||
0 commit comments