Skip to content

Commit

Permalink
Merge pull request #270 from nathanchance/6.9.0-kgr-uprev
Browse files Browse the repository at this point in the history
Update default PGO kernel to 6.9.0 and update known good revision
  • Loading branch information
nathanchance authored May 22, 2024
2 parents 86f1fed + 44cf72a commit a0ee35b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build-llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
from tc_build.tools import HostTools, StageTools

# This is a known good revision of LLVM for building the kernel
GOOD_REVISION = '2e39b57837aa1790b3ee078fa532bb1748a609c7'
GOOD_REVISION = '15397583e3d85eb1f1a051de26eb409aaedd3b54'

# The version of the Linux kernel that the script downloads if necessary
DEFAULT_KERNEL_FOR_PGO = (6, 8, 0)
DEFAULT_KERNEL_FOR_PGO = (6, 9, 0)

parser = ArgumentParser(formatter_class=RawTextHelpFormatter)
clone_options = parser.add_mutually_exclusive_group()
Expand Down
37 changes: 29 additions & 8 deletions tc_build/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class KernelBuilder(Builder):
# If the user supplies their own kernel source, it must be at least this
# version to ensure that all the build commands work, as the build commands
# were written to target at least this version.
MINIMUM_SUPPORTED_VERSION = (6, 5, 0)
MINIMUM_SUPPORTED_VERSION = (6, 9, 0)

def __init__(self, arch):
super().__init__()
Expand Down Expand Up @@ -258,12 +258,6 @@ def __init__(self):

self.cross_compile = 's390x-linux-gnu-'

# LD: https://github.com/ClangBuiltLinux/linux/issues/1524
# OBJCOPY: https://github.com/ClangBuiltLinux/linux/issues/1530
# OBJDUMP: https://github.com/ClangBuiltLinux/linux/issues/859
for key in ['LD', 'OBJCOPY', 'OBJDUMP']:
self.make_variables[key] = self.cross_compile + key.lower()

def build(self):
self.toolchain_version = self.get_toolchain_version()
if self.toolchain_version <= (15, 0, 0):
Expand All @@ -272,13 +266,40 @@ def build(self):
's390 does not build with LLVM < 15.0.0, skipping build...')
return

# LD: https://github.com/ClangBuiltLinux/linux/issues/1524
# OBJCOPY: https://github.com/ClangBuiltLinux/linux/issues/1530
gnu_vars = []

# https://github.com/llvm/llvm-project/pull/75643
lld_res = subprocess.run([Path(self.toolchain_prefix, 'bin/ld.lld'), '-m', 'elf64_s390'],
capture_output=True,
check=False,
text=True)
if 'error: unknown emulation:' in lld_res.stderr:
gnu_vars.append('LD')

# https://github.com/llvm/llvm-project/pull/81841
objcopy_res = subprocess.run([
Path(self.toolchain_prefix, 'bin/llvm-objcopy'), '-I', 'binary', '-O', 'elf64-s390',
'-', '/dev/null'
],
capture_output=True,
check=False,
input='',
text=True)
if 'error: invalid output format:' in objcopy_res.stderr:
gnu_vars.append('OBJCOPY')

for key in gnu_vars:
self.make_variables[key] = self.cross_compile + key.lower()

super().build()

def can_use_ias(self):
return True

def needs_binutils(self):
return True
return 'LD' in self.make_variables or 'OBJCOPY' in self.make_variables


class X8664KernelBuilder(KernelBuilder):
Expand Down

0 comments on commit a0ee35b

Please sign in to comment.