upgrade llvm@22

This commit is contained in:
agra
2026-06-17 09:58:43 +03:00
parent 08b0a35758
commit 2b43af4f8a
42 changed files with 440 additions and 428 deletions

View File

@@ -290,7 +290,7 @@ Rules:
| Alternative | Why not (now) |
|-------------|---------------|
| **In-process lld + bundled musl sysroot** (sx owns the pipeline; no zig) | Requires a custom LLVM build *with* lld — the Homebrew `llvm@19` here ships none (`liblld*.a`, headers, `ld.lld` all absent) — plus a C++ lld shim and per-arch prebuilt musl. Strictly more work for the same user-visible result. The right *eventual* target if we want zero foreign binaries; tracked as a follow-up. |
| **In-process lld + bundled musl sysroot** (sx owns the pipeline; no zig) | Requires a custom LLVM build *with* lld — the Homebrew `llvm@22` here ships none (`liblld*.a`, headers, `ld.lld` all absent) — plus a C++ lld shim and per-arch prebuilt musl. Strictly more work for the same user-visible result. The right *eventual* target if we want zero foreign binaries; tracked as a follow-up. |
| **Full Zig-style: build libc from source on demand** | Most flexible (any arch/libc version, no prebuilt blobs) but the most work; only worth it after the in-process-lld path exists. |
| **Document a hard dependency on system `cc`** | Zero engineering, but defeats the goal — the box still needs `build-essential`. Acceptable only as the current fallback, not the distribution story. |
| **Bundle just `ld.lld` + a musl sysroot (no full zig)** | Smaller than a whole zig, but we'd hand-manage crt object selection, dynamic-linker paths, and import libs — i.e. re-derive what `zig cc` already encapsulates. Bundle-size saving doesn't justify the fragility. |

View File

@@ -14,10 +14,10 @@
## 0. TL;DR + feasibility
* **Feasible today, no new infrastructure.** sx already links LLVM (`build.zig:10`
`/opt/homebrew/opt/llvm@19`) and `@cImport`s `llvm-c/Core.h`
`/opt/homebrew/opt/llvm@22`) and `@cImport`s `llvm-c/Core.h`
(`src/llvm_api.zig:1-17`). That header exposes everything inline asm needs,
reachable right now through `llvm_api.c.*`:
* `LLVMGetInlineAsm(Ty, AsmString, AsmStringSize, Constraints, ConstraintsSize, HasSideEffects, IsAlignStack, Dialect, CanThrow)` — builds the asm callee (LLVM 19/21 share this 9-arg signature).
* `LLVMGetInlineAsm(Ty, AsmString, AsmStringSize, Constraints, ConstraintsSize, HasSideEffects, IsAlignStack, Dialect, CanThrow)` — builds the asm callee (LLVM 1922 share this 9-arg signature).
* `LLVMInlineAsmDialectATT` / `LLVMInlineAsmDialectIntel`.
* `LLVMBuildCall2(...)` — already used pervasively in `src/ir/emit_llvm.zig` (e.g. the Obj-C msgSend path) — calls the asm value like a function.
* `LLVMAppendModuleInlineAsm(M, Asm, Len)` — module-level (global) asm.