internal/rosa/llvm: migrate compiler-rt
All checks were successful
Test / Create distribution (push) Successful in 1m24s
Test / Sandbox (push) Successful in 3m33s
Test / Hakurei (push) Successful in 6m17s
Test / ShareFS (push) Successful in 6m14s
Test / Hakurei (race detector) (push) Successful in 8m34s
Test / Sandbox (race detector) (push) Successful in 5m39s
Test / Flake checks (push) Successful in 1m40s
All checks were successful
Test / Create distribution (push) Successful in 1m24s
Test / Sandbox (push) Successful in 3m33s
Test / Hakurei (push) Successful in 6m17s
Test / ShareFS (push) Successful in 6m14s
Test / Hakurei (race detector) (push) Successful in 8m34s
Test / Sandbox (race detector) (push) Successful in 5m39s
Test / Flake checks (push) Successful in 1m40s
The newLLVM family of functions predate the package system. This change migrates compiler-rt without changing any resulting artifacts. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -396,9 +396,9 @@ func main() {
|
|||||||
rosa.SetGentooStage3(flagGentoo, checksum)
|
rosa.SetGentooStage3(flagGentoo, checksum)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, _, stage1 := (t - 2).NewLLVM()
|
_, _, stage1 := (t - 2).NewLLVM()
|
||||||
_, _, _, stage2 := (t - 1).NewLLVM()
|
_, _, stage2 := (t - 1).NewLLVM()
|
||||||
_, _, _, stage3 := t.NewLLVM()
|
_, _, stage3 := t.NewLLVM()
|
||||||
var (
|
var (
|
||||||
pathname *check.Absolute
|
pathname *check.Absolute
|
||||||
checksum [2]unique.Handle[pkg.Checksum]
|
checksum [2]unique.Handle[pkg.Checksum]
|
||||||
@@ -577,8 +577,9 @@ func main() {
|
|||||||
root = rosa.Std.AppendPresets(root, presets...)
|
root = rosa.Std.AppendPresets(root, presets...)
|
||||||
|
|
||||||
if flagWithToolchain {
|
if flagWithToolchain {
|
||||||
musl, compilerRT, runtimes, clang := (rosa.Std - 1).NewLLVM()
|
boot := rosa.Std - 1
|
||||||
root = append(root, musl, compilerRT, runtimes, clang)
|
musl, runtimes, clang := boot.NewLLVM()
|
||||||
|
root = append(root, musl, boot.Load(rosa.LLVMCompilerRT), runtimes, clang)
|
||||||
} else {
|
} else {
|
||||||
root = append(root, rosa.Std.Load(rosa.Musl))
|
root = append(root, rosa.Std.Load(rosa.Musl))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,34 +68,12 @@ func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// newLLVM returns LLVM toolchain across multiple [pkg.Artifact].
|
func (t Toolchain) newCompilerRT() (pkg.Artifact, string) {
|
||||||
func (t Toolchain) newLLVM() (musl, compilerRT, runtimes, clang pkg.Artifact) {
|
|
||||||
target := "'AArch64;RISCV;X86'"
|
|
||||||
if t.isStage0() {
|
|
||||||
switch runtime.GOARCH {
|
|
||||||
case "386", "amd64":
|
|
||||||
target = "X86"
|
|
||||||
case "arm64":
|
|
||||||
target = "AArch64"
|
|
||||||
case "riscv64":
|
|
||||||
target = "RISCV"
|
|
||||||
|
|
||||||
default:
|
|
||||||
panic("unsupported target " + runtime.GOARCH)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
minimalDeps := []KV{
|
|
||||||
{"LLVM_ENABLE_ZLIB", "OFF"},
|
|
||||||
{"LLVM_ENABLE_ZSTD", "OFF"},
|
|
||||||
{"LLVM_ENABLE_LIBXML2", "OFF"},
|
|
||||||
}
|
|
||||||
|
|
||||||
muslHeaders, _ := t.newMusl(true, []string{
|
muslHeaders, _ := t.newMusl(true, []string{
|
||||||
"CC=clang",
|
"CC=clang",
|
||||||
})
|
})
|
||||||
|
|
||||||
compilerRT = t.newLLVMVariant("compiler-rt", &llvmAttr{
|
return t.newLLVMVariant("compiler-rt", &llvmAttr{
|
||||||
env: stage0ExclConcat(t, []string{},
|
env: stage0ExclConcat(t, []string{},
|
||||||
"LDFLAGS="+earlyLDFLAGS(false),
|
"LDFLAGS="+earlyLDFLAGS(false),
|
||||||
),
|
),
|
||||||
@@ -137,7 +115,42 @@ ln -s \
|
|||||||
"clang_rt.crtend-` + linuxArch() + `.o" \
|
"clang_rt.crtend-` + linuxArch() + `.o" \
|
||||||
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
|
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
|
||||||
`,
|
`,
|
||||||
})
|
}), llvmVersion
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
artifactsM[LLVMCompilerRT] = Metadata{
|
||||||
|
f: Toolchain.newCompilerRT,
|
||||||
|
|
||||||
|
Name: "llvm-compiler-rt",
|
||||||
|
Description: "LLVM runtime: compiler-rt",
|
||||||
|
Website: "https://llvm.org/",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// newLLVM returns LLVM toolchain across multiple [pkg.Artifact].
|
||||||
|
func (t Toolchain) newLLVM() (musl, runtimes, clang pkg.Artifact) {
|
||||||
|
target := "'AArch64;RISCV;X86'"
|
||||||
|
if t.isStage0() {
|
||||||
|
switch runtime.GOARCH {
|
||||||
|
case "386", "amd64":
|
||||||
|
target = "X86"
|
||||||
|
case "arm64":
|
||||||
|
target = "AArch64"
|
||||||
|
case "riscv64":
|
||||||
|
target = "RISCV"
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic("unsupported target " + runtime.GOARCH)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
minimalDeps := []KV{
|
||||||
|
{"LLVM_ENABLE_ZLIB", "OFF"},
|
||||||
|
{"LLVM_ENABLE_ZSTD", "OFF"},
|
||||||
|
{"LLVM_ENABLE_LIBXML2", "OFF"},
|
||||||
|
}
|
||||||
|
|
||||||
|
compilerRT := t.Load(LLVMCompilerRT)
|
||||||
|
|
||||||
musl, _ = t.newMusl(false, stage0ExclConcat(t, []string{
|
musl, _ = t.newMusl(false, stage0ExclConcat(t, []string{
|
||||||
"CC=clang",
|
"CC=clang",
|
||||||
@@ -227,20 +240,9 @@ ninja check-all
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
func init() {
|
func init() {
|
||||||
artifactsM[LLVMCompilerRT] = Metadata{
|
|
||||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
|
||||||
_, compilerRT, _, _ := t.newLLVM()
|
|
||||||
return compilerRT, llvmVersion
|
|
||||||
},
|
|
||||||
|
|
||||||
Name: "llvm-compiler-rt",
|
|
||||||
Description: "LLVM runtime: compiler-rt",
|
|
||||||
Website: "https://llvm.org/",
|
|
||||||
}
|
|
||||||
|
|
||||||
artifactsM[LLVMRuntimes] = Metadata{
|
artifactsM[LLVMRuntimes] = Metadata{
|
||||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||||
_, _, runtimes, _ := t.newLLVM()
|
_, runtimes, _ := t.newLLVM()
|
||||||
return runtimes, llvmVersion
|
return runtimes, llvmVersion
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -251,7 +253,7 @@ func init() {
|
|||||||
|
|
||||||
artifactsM[LLVMClang] = Metadata{
|
artifactsM[LLVMClang] = Metadata{
|
||||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||||
_, _, _, clang := t.newLLVM()
|
_, _, clang := t.newLLVM()
|
||||||
return clang, llvmVersion
|
return clang, llvmVersion
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -286,15 +288,15 @@ func init() {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// llvm stores the result of Toolchain.newLLVM.
|
// llvm stores the result of Toolchain.newLLVM.
|
||||||
llvm [_toolchainEnd][4]pkg.Artifact
|
llvm [_toolchainEnd][3]pkg.Artifact
|
||||||
// llvmOnce is for lazy initialisation of llvm.
|
// llvmOnce is for lazy initialisation of llvm.
|
||||||
llvmOnce [_toolchainEnd]sync.Once
|
llvmOnce [_toolchainEnd]sync.Once
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewLLVM returns LLVM toolchain across multiple [pkg.Artifact].
|
// NewLLVM returns LLVM toolchain across multiple [pkg.Artifact].
|
||||||
func (t Toolchain) NewLLVM() (musl, compilerRT, runtimes, clang pkg.Artifact) {
|
func (t Toolchain) NewLLVM() (musl, runtimes, clang pkg.Artifact) {
|
||||||
llvmOnce[t].Do(func() {
|
llvmOnce[t].Do(func() {
|
||||||
llvm[t][0], llvm[t][1], llvm[t][2], llvm[t][3] = t.newLLVM()
|
llvm[t][0], llvm[t][1], llvm[t][2] = t.newLLVM()
|
||||||
})
|
})
|
||||||
return llvm[t][0], llvm[t][1], llvm[t][2], llvm[t][3]
|
return llvm[t][0], llvm[t][1], llvm[t][2]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -329,13 +329,13 @@ mkdir -vp /work/system/bin
|
|||||||
}
|
}
|
||||||
|
|
||||||
boot := t - 1
|
boot := t - 1
|
||||||
musl, compilerRT, runtimes, clang := boot.NewLLVM()
|
musl, runtimes, clang := boot.NewLLVM()
|
||||||
toybox := Toybox
|
toybox := Toybox
|
||||||
if flag&TEarly != 0 {
|
if flag&TEarly != 0 {
|
||||||
toybox = toyboxEarly
|
toybox = toyboxEarly
|
||||||
}
|
}
|
||||||
std := []pkg.Artifact{cureEtc{newIANAEtc()}, musl}
|
std := []pkg.Artifact{cureEtc{newIANAEtc()}, musl}
|
||||||
toolchain := []pkg.Artifact{compilerRT, runtimes, clang}
|
toolchain := []pkg.Artifact{boot.Load(LLVMCompilerRT), runtimes, clang}
|
||||||
utils := []pkg.Artifact{
|
utils := []pkg.Artifact{
|
||||||
boot.Load(Mksh),
|
boot.Load(Mksh),
|
||||||
boot.Load(toybox),
|
boot.Load(toybox),
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (t Toolchain) newStage0() (pkg.Artifact, string) {
|
func (t Toolchain) newStage0() (pkg.Artifact, string) {
|
||||||
musl, compilerRT, runtimes, clang := t.NewLLVM()
|
musl, runtimes, clang := t.NewLLVM()
|
||||||
return t.New("rosa-stage0", 0, []pkg.Artifact{
|
return t.New("rosa-stage0", 0, []pkg.Artifact{
|
||||||
musl,
|
musl,
|
||||||
compilerRT,
|
t.Load(LLVMCompilerRT),
|
||||||
runtimes,
|
runtimes,
|
||||||
clang,
|
clang,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user