internal/rosa/llvm: remove unused field
All checks were successful
Test / Create distribution (push) Successful in 1m20s
Test / Sandbox (push) Successful in 4m18s
Test / Sandbox (race detector) (push) Successful in 6m53s
Test / ShareFS (push) Successful in 7m0s
Test / Hakurei (race detector) (push) Successful in 10m52s
Test / Hakurei (push) Successful in 6m57s
Test / Flake checks (push) Successful in 1m34s
All checks were successful
Test / Create distribution (push) Successful in 1m20s
Test / Sandbox (push) Successful in 4m18s
Test / Sandbox (race detector) (push) Successful in 6m53s
Test / ShareFS (push) Successful in 7m0s
Test / Hakurei (race detector) (push) Successful in 10m52s
Test / Hakurei (push) Successful in 6m57s
Test / Flake checks (push) Successful in 1m34s
This change also renames confusingly named flags field and corrects its doc comment. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -13,8 +13,8 @@ import (
|
||||
// llvmAttr holds the attributes that will be applied to a new [pkg.Artifact]
|
||||
// containing a LLVM variant.
|
||||
type llvmAttr struct {
|
||||
// Passed through to PackageAttr.Flag.
|
||||
flags int
|
||||
// Enabled projects and runtimes.
|
||||
pr int
|
||||
|
||||
// Concatenated with default environment for PackageAttr.Env.
|
||||
env []string
|
||||
@@ -24,8 +24,6 @@ type llvmAttr struct {
|
||||
append []string
|
||||
// Passed through to PackageAttr.NonStage0.
|
||||
nonStage0 []pkg.Artifact
|
||||
// Passed through to PackageAttr.Paths.
|
||||
paths []pkg.ExecPath
|
||||
// Concatenated with default fixup for CMakeHelper.Script.
|
||||
script string
|
||||
|
||||
@@ -75,19 +73,18 @@ func llvmFlagName(flag int) string {
|
||||
|
||||
// newLLVMVariant returns a [pkg.Artifact] containing a LLVM variant.
|
||||
func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact {
|
||||
|
||||
if attr == nil {
|
||||
panic("LLVM attr must be non-nil")
|
||||
}
|
||||
|
||||
var projects, runtimes []string
|
||||
for i := 1; i < llvmProjectAll; i <<= 1 {
|
||||
if attr.flags&i != 0 {
|
||||
if attr.pr&i != 0 {
|
||||
projects = append(projects, llvmFlagName(i))
|
||||
}
|
||||
}
|
||||
for i := (llvmProjectAll + 1) << 1; i < llvmRuntimeAll; i <<= 1 {
|
||||
if attr.flags&i != 0 {
|
||||
if attr.pr&i != 0 {
|
||||
runtimes = append(runtimes, llvmFlagName(i))
|
||||
}
|
||||
}
|
||||
@@ -126,7 +123,7 @@ func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact {
|
||||
}...)
|
||||
}
|
||||
|
||||
if attr.flags&llvmProjectClang != 0 {
|
||||
if attr.pr&llvmProjectClang != 0 {
|
||||
cache = append(cache, []KV{
|
||||
{"CLANG_DEFAULT_LINKER", "lld"},
|
||||
{"CLANG_DEFAULT_CXX_STDLIB", "libc++"},
|
||||
@@ -134,30 +131,30 @@ func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact {
|
||||
{"CLANG_DEFAULT_UNWINDLIB", "libunwind"},
|
||||
}...)
|
||||
}
|
||||
if attr.flags&llvmProjectLld != 0 {
|
||||
if attr.pr&llvmProjectLld != 0 {
|
||||
script += `
|
||||
ln -s ld.lld /work/system/bin/ld
|
||||
`
|
||||
}
|
||||
if attr.flags&llvmRuntimeCompilerRT != 0 {
|
||||
if attr.pr&llvmRuntimeCompilerRT != 0 {
|
||||
if attr.append == nil {
|
||||
cache = append(cache, []KV{
|
||||
{"COMPILER_RT_USE_LLVM_UNWINDER", "ON"},
|
||||
}...)
|
||||
}
|
||||
}
|
||||
if attr.flags&llvmRuntimeLibunwind != 0 {
|
||||
if attr.pr&llvmRuntimeLibunwind != 0 {
|
||||
cache = append(cache, []KV{
|
||||
{"LIBUNWIND_USE_COMPILER_RT", "ON"},
|
||||
}...)
|
||||
}
|
||||
if attr.flags&llvmRuntimeLibcxx != 0 {
|
||||
if attr.pr&llvmRuntimeLibcxx != 0 {
|
||||
cache = append(cache, []KV{
|
||||
{"LIBCXX_HAS_MUSL_LIBC", "ON"},
|
||||
{"LIBCXX_USE_COMPILER_RT", "ON"},
|
||||
}...)
|
||||
}
|
||||
if attr.flags&llvmRuntimeLibcxxABI != 0 {
|
||||
if attr.pr&llvmRuntimeLibcxxABI != 0 {
|
||||
cache = append(cache, []KV{
|
||||
{"LIBCXXABI_USE_COMPILER_RT", "ON"},
|
||||
{"LIBCXXABI_USE_LLVM_UNWINDER", "ON"},
|
||||
@@ -193,7 +190,6 @@ index 9da357a7ebb9..b2931510c1ae 100644
|
||||
"ROSA_LLVM_RUNTIMES=" + strings.Join(runtimes, ";"),
|
||||
}, attr.env),
|
||||
|
||||
Paths: attr.paths,
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Variant: variant,
|
||||
@@ -294,7 +290,7 @@ ln -s \
|
||||
env: stage0ExclConcat(t, []string{},
|
||||
"LDFLAGS="+earlyLDFLAGS(false),
|
||||
),
|
||||
flags: llvmRuntimeLibunwind | llvmRuntimeLibcxx | llvmRuntimeLibcxxABI,
|
||||
pr: llvmRuntimeLibunwind | llvmRuntimeLibcxx | llvmRuntimeLibcxxABI,
|
||||
cmake: slices.Concat([]KV{
|
||||
// libc++ not yet available
|
||||
{"CMAKE_CXX_COMPILER_WORKS", "ON"},
|
||||
@@ -310,7 +306,7 @@ ln -s \
|
||||
})
|
||||
|
||||
clang = t.newLLVMVariant("clang", &llvmAttr{
|
||||
flags: llvmProjectClang | llvmProjectLld,
|
||||
pr: llvmProjectClang | llvmProjectLld,
|
||||
env: stage0ExclConcat(t, []string{},
|
||||
"CFLAGS="+earlyCFLAGS,
|
||||
"CXXFLAGS="+earlyCXXFLAGS(),
|
||||
|
||||
Reference in New Issue
Block a user