internal/rosa/llvm: migrate musl
All checks were successful
Test / Create distribution (push) Successful in 2m48s
Test / Sandbox (push) Successful in 6m4s
Test / Hakurei (push) Successful in 7m14s
Test / ShareFS (push) Successful in 7m23s
Test / Sandbox (race detector) (push) Successful in 9m34s
Test / Hakurei (race detector) (push) Successful in 4m2s
Test / Flake checks (push) Successful in 1m33s

This removes the pointless special treatment given to musl.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-14 00:35:06 +09:00
parent a7f7ce1795
commit ac825640ab
5 changed files with 32 additions and 33 deletions

View File

@@ -396,9 +396,9 @@ func main() {
rosa.SetGentooStage3(flagGentoo, checksum)
}
_, _, stage1 := (t - 2).NewLLVM()
_, _, stage2 := (t - 1).NewLLVM()
_, _, stage3 := t.NewLLVM()
_, stage1 := (t - 2).NewLLVM()
_, stage2 := (t - 1).NewLLVM()
_, stage3 := t.NewLLVM()
var (
pathname *check.Absolute
checksum [2]unique.Handle[pkg.Checksum]
@@ -578,8 +578,12 @@ func main() {
if flagWithToolchain {
boot := rosa.Std - 1
musl, runtimes, clang := boot.NewLLVM()
root = append(root, musl, boot.Load(rosa.LLVMCompilerRT), runtimes, clang)
runtimes, clang := boot.NewLLVM()
root = append(root,
boot.Load(rosa.Musl),
boot.Load(rosa.LLVMCompilerRT),
runtimes, clang,
)
} else {
root = append(root, rosa.Std.Load(rosa.Musl))
}

View File

@@ -69,10 +69,7 @@ func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact {
}
func (t Toolchain) newCompilerRT() (pkg.Artifact, string) {
muslHeaders, _ := t.newMusl(true, []string{
"CC=clang",
})
muslHeaders, _ := t.newMusl(true)
return t.newLLVMVariant("compiler-rt", &llvmAttr{
env: stage0ExclConcat(t, []string{},
"LDFLAGS="+earlyLDFLAGS(false),
@@ -128,7 +125,7 @@ func init() {
}
// newLLVM returns LLVM toolchain across multiple [pkg.Artifact].
func (t Toolchain) newLLVM() (musl, runtimes, clang pkg.Artifact) {
func (t Toolchain) newLLVM() (runtimes, clang pkg.Artifact) {
target := "'AArch64;RISCV;X86'"
if t.isStage0() {
switch runtime.GOARCH {
@@ -151,16 +148,7 @@ func (t Toolchain) newLLVM() (musl, runtimes, clang pkg.Artifact) {
}
compilerRT := t.Load(LLVMCompilerRT)
musl, _ = t.newMusl(false, stage0ExclConcat(t, []string{
"CC=clang",
"LIBCC=/system/lib/clang/" + llvmVersionMajor + "/lib/" +
triplet() + "/libclang_rt.builtins.a",
"AR=ar",
"RANLIB=ranlib",
},
"LDFLAGS="+earlyLDFLAGS(false),
), compilerRT)
musl := t.Load(Musl)
runtimes = t.newLLVMVariant("runtimes", &llvmAttr{
env: stage0ExclConcat(t, []string{},
@@ -242,7 +230,7 @@ ninja check-all
func init() {
artifactsM[LLVMRuntimes] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
_, runtimes, _ := t.newLLVM()
runtimes, _ := t.newLLVM()
return runtimes, llvmVersion
},
@@ -253,7 +241,7 @@ func init() {
artifactsM[LLVMClang] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
_, _, clang := t.newLLVM()
_, clang := t.newLLVM()
return clang, llvmVersion
},
@@ -288,15 +276,15 @@ func init() {
var (
// llvm stores the result of Toolchain.newLLVM.
llvm [_toolchainEnd][3]pkg.Artifact
llvm [_toolchainEnd][2]pkg.Artifact
// llvmOnce is for lazy initialisation of llvm.
llvmOnce [_toolchainEnd]sync.Once
)
// NewLLVM returns LLVM toolchain across multiple [pkg.Artifact].
func (t Toolchain) NewLLVM() (musl, runtimes, clang pkg.Artifact) {
func (t Toolchain) NewLLVM() (runtimes, clang pkg.Artifact) {
llvmOnce[t].Do(func() {
llvm[t][0], llvm[t][1], llvm[t][2] = t.newLLVM()
llvm[t][0], llvm[t][1] = t.newLLVM()
})
return llvm[t][0], llvm[t][1], llvm[t][2]
return llvm[t][0], llvm[t][1]
}

View File

@@ -4,7 +4,6 @@ import "hakurei.app/internal/pkg"
func (t Toolchain) newMusl(
headers bool,
env []string,
extra ...pkg.Artifact,
) (pkg.Artifact, string) {
const (
@@ -47,7 +46,15 @@ rmdir -v /work/lib
// expected to be writable in copies
Chmod: true,
Env: env,
Env: stage0ExclConcat(t, []string{
"CC=clang",
"LIBCC=/system/lib/clang/" + llvmVersionMajor + "/lib/" +
triplet() + "/libclang_rt.builtins.a",
"AR=ar",
"RANLIB=ranlib",
},
"LDFLAGS="+earlyLDFLAGS(false),
),
}, &helper,
Coreutils,
), version
@@ -55,7 +62,7 @@ rmdir -v /work/lib
func init() {
artifactsM[Musl] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.newMusl(false, nil)
return t.newMusl(false, t.Load(LLVMCompilerRT))
},
Name: "musl",

View File

@@ -329,12 +329,12 @@ mkdir -vp /work/system/bin
}
boot := t - 1
musl, runtimes, clang := boot.NewLLVM()
runtimes, clang := boot.NewLLVM()
toybox := Toybox
if flag&TEarly != 0 {
toybox = toyboxEarly
}
std := []pkg.Artifact{cureEtc{newIANAEtc()}, musl}
std := []pkg.Artifact{cureEtc{newIANAEtc()}, boot.Load(Musl)}
toolchain := []pkg.Artifact{boot.Load(LLVMCompilerRT), runtimes, clang}
utils := []pkg.Artifact{
boot.Load(Mksh),

View File

@@ -7,9 +7,9 @@ import (
)
func (t Toolchain) newStage0() (pkg.Artifact, string) {
musl, runtimes, clang := t.NewLLVM()
runtimes, clang := t.NewLLVM()
return t.New("rosa-stage0", 0, []pkg.Artifact{
musl,
t.Load(Musl),
t.Load(LLVMCompilerRT),
runtimes,
clang,