MCPcopy Create free account
hub / github.com/ClangBuiltLinux/tc-build / LLVMKernelBuilder

Class LLVMKernelBuilder

tc_build/kernel.py:435–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433
434
435class LLVMKernelBuilder(Builder):
436 def __init__(self) -> None:
437 super().__init__()
438
439 self.bolt_instrumentation = False
440 self.bolt_sampling_output: Path = tc_build.utils.UNINIT_PATH
441 self.matrix = {}
442 self.silent: bool = True
443 self.toolchain_prefix: Path = tc_build.utils.UNINIT_PATH
444
445 def build(self) -> None:
446 lsm = LinuxSourceManager()
447 lsm.location = self.folders.source
448
449 builders = []
450
451 allconfig_capable_builders: dict[str, type] = {
452 'AArch64': Arm64KernelBuilder,
453 'ARM': ArmKernelBuilder,
454 'Hexagon': HexagonKernelBuilder,
455 'PowerPC': PowerPC64KernelBuilder,
456 'RISCV': RISCVKernelBuilder,
457 'SystemZ': S390KernelBuilder,
458 'X86': X8664KernelBuilder,
459 }
460
461 # https://git.kernel.org/stable/c/ab3f300524697919f64ae920e904d0836b4057b0
462 # is needed to build ARCH=loongarch without disabling any
463 # configurations (in addition to a copy of clang > 18.0.0 but that is
464 # check when the build is invoked because it depends on the build of
465 # the compiler).
466 if lsm.get_version() >= (6, 6, 8):
467 allconfig_capable_builders['LoongArch'] = LoongArchKernelBuilder
468
469 # This is a little convoluted :/
470 # The overall idea here is to avoid duplicating builds, so the
471 # matrix consists of a series of configuration targets ("defconfig",
472 # "allmodconfig", etc) and a list of LLVM targets to build for each
473 # configuration target. From there, this block filters out the
474 # architectures that cannot build their "all*configs" with clang, so
475 # they are duplicated if both "defconfig" and "allmodconfig" are
476 # requested.
477 for config_target, llvm_targets in self.matrix.items():
478 for llvm_target in llvm_targets:
479 if config_target == 'defconfig' and llvm_target == 'AArch64':
480 builder = allconfig_capable_builders[llvm_target]()
481 # For arm64, defconfig is quite large. To be quicker and
482 # not use as much space for profiling data, use
483 # 'virtconfig'.
484 builder.config_targets = ['virtconfig']
485 builders.append(builder)
486 elif config_target == 'defconfig' and llvm_target == 'ARM':
487 builders += [
488 ArmV5KernelBuilder(),
489 ArmV6KernelBuilder(),
490 ArmV7KernelBuilder(),
491 ]
492 elif config_target == 'defconfig' and llvm_target == 'Mips':

Callers 2

build-llvm.pyFile · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected