Skip to content

Commit a0ee35b

Browse files
authored
Merge pull request #270 from nathanchance/6.9.0-kgr-uprev
Update default PGO kernel to 6.9.0 and update known good revision
2 parents 86f1fed + 44cf72a commit a0ee35b

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

build-llvm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from tc_build.tools import HostTools, StageTools
1515

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

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

2222
parser = ArgumentParser(formatter_class=RawTextHelpFormatter)
2323
clone_options = parser.add_mutually_exclusive_group()

tc_build/kernel.py

+29-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class KernelBuilder(Builder):
1616
# If the user supplies their own kernel source, it must be at least this
1717
# version to ensure that all the build commands work, as the build commands
1818
# were written to target at least this version.
19-
MINIMUM_SUPPORTED_VERSION = (6, 5, 0)
19+
MINIMUM_SUPPORTED_VERSION = (6, 9, 0)
2020

2121
def __init__(self, arch):
2222
super().__init__()
@@ -258,12 +258,6 @@ def __init__(self):
258258

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

261-
# LD: https://github.com/ClangBuiltLinux/linux/issues/1524
262-
# OBJCOPY: https://github.com/ClangBuiltLinux/linux/issues/1530
263-
# OBJDUMP: https://github.com/ClangBuiltLinux/linux/issues/859
264-
for key in ['LD', 'OBJCOPY', 'OBJDUMP']:
265-
self.make_variables[key] = self.cross_compile + key.lower()
266-
267261
def build(self):
268262
self.toolchain_version = self.get_toolchain_version()
269263
if self.toolchain_version <= (15, 0, 0):
@@ -272,13 +266,40 @@ def build(self):
272266
's390 does not build with LLVM < 15.0.0, skipping build...')
273267
return
274268

269+
# LD: https://github.com/ClangBuiltLinux/linux/issues/1524
270+
# OBJCOPY: https://github.com/ClangBuiltLinux/linux/issues/1530
271+
gnu_vars = []
272+
273+
# https://github.com/llvm/llvm-project/pull/75643
274+
lld_res = subprocess.run([Path(self.toolchain_prefix, 'bin/ld.lld'), '-m', 'elf64_s390'],
275+
capture_output=True,
276+
check=False,
277+
text=True)
278+
if 'error: unknown emulation:' in lld_res.stderr:
279+
gnu_vars.append('LD')
280+
281+
# https://github.com/llvm/llvm-project/pull/81841
282+
objcopy_res = subprocess.run([
283+
Path(self.toolchain_prefix, 'bin/llvm-objcopy'), '-I', 'binary', '-O', 'elf64-s390',
284+
'-', '/dev/null'
285+
],
286+
capture_output=True,
287+
check=False,
288+
input='',
289+
text=True)
290+
if 'error: invalid output format:' in objcopy_res.stderr:
291+
gnu_vars.append('OBJCOPY')
292+
293+
for key in gnu_vars:
294+
self.make_variables[key] = self.cross_compile + key.lower()
295+
275296
super().build()
276297

277298
def can_use_ias(self):
278299
return True
279300

280301
def needs_binutils(self):
281-
return True
302+
return 'LD' in self.make_variables or 'OBJCOPY' in self.make_variables
282303

283304

284305
class X8664KernelBuilder(KernelBuilder):

0 commit comments

Comments
 (0)