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

Class S390KernelBuilder

tc_build/kernel.py:365–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363
364
365class S390KernelBuilder(KernelBuilder):
366 def __init__(self) -> None:
367 super().__init__('s390')
368
369 self.cross_compile = 's390x-linux-gnu-'
370
371 def build(self) -> None:
372 if self.get_toolchain_version() <= (15, 0, 0):
373 # https://git.kernel.org/linus/30d17fac6aaedb40d111bb159f4b35525637ea78
374 tc_build.utils.print_warning(
375 's390 does not build with LLVM < 15.0.0, skipping build...'
376 )
377 return
378
379 # LD: https://github.com/ClangBuiltLinux/linux/issues/1524
380 # OBJCOPY: https://github.com/ClangBuiltLinux/linux/issues/1530
381
382 # https://github.com/llvm/llvm-project/pull/75643
383 lld_res = subprocess.run(
384 [Path(self.toolchain_prefix, 'bin/ld.lld'), '-m', 'elf64_s390'],
385 capture_output=True,
386 check=False,
387 text=True,
388 )
389 if 'error: unknown emulation:' in lld_res.stderr:
390 self.make_variables['LD'] = f"{self.cross_compile}ld"
391
392 # https://github.com/llvm/llvm-project/pull/81841
393 objcopy_res = subprocess.run(
394 [
395 Path(self.toolchain_prefix, 'bin/llvm-objcopy'),
396 '-I',
397 'binary',
398 '-O',
399 'elf64-s390',
400 '-',
401 '/dev/null',
402 ],
403 capture_output=True,
404 check=False,
405 input='',
406 text=True,
407 )
408 if 'error: invalid output format:' in objcopy_res.stderr:
409 self.make_variables['OBJCOPY'] = f"{self.cross_compile}objcopy"
410
411 self.needs_binutils = 'LD' in self.make_variables or 'OBJCOPY' in self.make_variables
412
413 super().build()
414
415
416class X8664KernelBuilder(KernelBuilder):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected