Skip to content

fix: build mimalloc after llvm stage 1 - #3

Merged
Sam Gammon (sgammon) merged 1 commit into
mainfrom
fix/mimalloc-after-llvm-stage1
May 13, 2026
Merged

Sam Gammon (sgammon) merged 1 commit into
mainfrom
fix/mimalloc-after-llvm-stage1

Conversation

@wisper-dev

Copy link
Copy Markdown
Member

Moves the Build mimalloc block (and mimalloc-musl-glue) from before
LLVM stage 1 to after the post-LLVM compiler swap.

Why

On hosts whose system clang is newer than the toolchain's (e.g. Ubuntu
noble's clang 23 building a toolchain with LLVM 22), musl phase 2 failed
to link with:

ld.lld: Invalid summary version 13

Mimalloc was built before LLVM stage 1, still by the system clang, so
the ThinLTO summary of its objects came out in the clang 23 format —
incompatible with lld from LLVM 22, which later links the library.

How

After the move, mimalloc is built with the freshly-built LLVM 22
toolchain; the summary is a matching version and the link succeeds.

build.sh: 92 lines added, 78 removed (step ordering).

Moves the `## Build mimalloc` block (and `mimalloc-musl-glue`) from
before LLVM stage 1 to after the post-LLVM compiler swap. Fixes the
musl phase 2 link failure with `ld.lld: Invalid summary version 13`
on hosts whose system clang is newer than the toolchain's (e.g.
Ubuntu noble's clang 23 building a toolchain with LLVM 22).
@sgammon
Sam Gammon (sgammon) merged commit 12fbe0b into main May 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants