diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go index ebffcdc8..62375954 100644 --- a/internal/rosa/llvm.go +++ b/internal/rosa/llvm.go @@ -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,8 +190,7 @@ index 9da357a7ebb9..b2931510c1ae 100644 "ROSA_LLVM_RUNTIMES=" + strings.Join(runtimes, ";"), }, attr.env), - Paths: attr.paths, - Flag: TExclusive, + 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(),