Commit 728c2c5
committed
fix(build,toolchain): make the llvm-musl path actually reach the target
Four defects the first end-to-end run surfaced, all found by building a
module TU against the llvm-musl-libcxx payload:
- pin override: the target vocabulary pin silently replaced --toolchain
(it arrives via the env side channel, which the pin guard never read),
so `--toolchain llvm --target x86_64-linux-musl` resolved gcc. The
flag now blocks the pin on its own, regardless of target origin.
- triple propagation: the target-triple correction was scoped to
freestanding only, but llvm-on-musl is the same one-binary case — the
clang frontend's -dumpmachine answers with the host while the build
targets musl, leaving the output dir, cache key and flags on the host
triple (E1 for a hosted target). Freestanding-only side effects
(hasImportStd off, the picolibc sysroot lookup) stay scoped.
- std module over the wrong libc: the std precompile used the shared
host-flags producer (host libc++ headers + glibc), which fails on the
payload's std.cppm with __config_site / bits/alltypes.h not found.
llvm-musl now builds the std BMI from the payload headers over the
musl-gcc sysroot (both payload naming shapes, with the xim- prefix).
- payload C runtime leak: the clangWithCfg PayloadFirst link flags name
the HOST's glibc, whose loader became a static binary's PT_INTERP.
Excluded for llvm-musl; its branch already assembles the target C
runtime (musl sysroot, crt via --gcc-toolchain).
Verified end to end: mcpp build --toolchain llvm@22.1.8 --target
x86_64-linux-musl on a hello-module project produces a fully static
x86_64 musl ELF (no PT_INTERP, not a dynamic executable) that runs.
Unit suite 91 passed; the 1 test_elf_runtime failure is the known
environmental one (host /lib64/libtinfo.so.6 symlink chain), unchanged.
Refs #4911 parent 42d2b6d commit 728c2c5
3 files changed
Lines changed: 76 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1183 | 1183 | | |
1184 | 1184 | | |
1185 | 1185 | | |
1186 | | - | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1187 | 1192 | | |
1188 | 1193 | | |
1189 | 1194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1253 | 1253 | | |
1254 | 1254 | | |
1255 | 1255 | | |
| 1256 | + | |
1256 | 1257 | | |
1257 | 1258 | | |
1258 | 1259 | | |
| 1260 | + | |
1259 | 1261 | | |
1260 | 1262 | | |
1261 | 1263 | | |
| |||
1436 | 1438 | | |
1437 | 1439 | | |
1438 | 1440 | | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1439 | 1448 | | |
1440 | | - | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
1441 | 1452 | | |
1442 | 1453 | | |
1443 | 1454 | | |
| |||
1823 | 1834 | | |
1824 | 1835 | | |
1825 | 1836 | | |
1826 | | - | |
1827 | | - | |
1828 | | - | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
1829 | 1844 | | |
1830 | | - | |
1831 | | - | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
1832 | 1849 | | |
1833 | 1850 | | |
1834 | 1851 | | |
| 1852 | + | |
1835 | 1853 | | |
1836 | 1854 | | |
1837 | 1855 | | |
| |||
1852 | 1870 | | |
1853 | 1871 | | |
1854 | 1872 | | |
| 1873 | + | |
1855 | 1874 | | |
1856 | 1875 | | |
1857 | 1876 | | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
1858 | 1881 | | |
1859 | 1882 | | |
1860 | 1883 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
249 | 251 | | |
250 | 252 | | |
251 | 253 | | |
252 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
253 | 292 | | |
| 293 | + | |
254 | 294 | | |
255 | 295 | | |
256 | 296 | | |
| |||
0 commit comments