@@ -16,7 +16,7 @@ class KernelBuilder(Builder):
16
16
# If the user supplies their own kernel source, it must be at least this
17
17
# version to ensure that all the build commands work, as the build commands
18
18
# were written to target at least this version.
19
- MINIMUM_SUPPORTED_VERSION = (6 , 5 , 0 )
19
+ MINIMUM_SUPPORTED_VERSION = (6 , 9 , 0 )
20
20
21
21
def __init__ (self , arch ):
22
22
super ().__init__ ()
@@ -258,12 +258,6 @@ def __init__(self):
258
258
259
259
self .cross_compile = 's390x-linux-gnu-'
260
260
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
-
267
261
def build (self ):
268
262
self .toolchain_version = self .get_toolchain_version ()
269
263
if self .toolchain_version <= (15 , 0 , 0 ):
@@ -272,13 +266,40 @@ def build(self):
272
266
's390 does not build with LLVM < 15.0.0, skipping build...' )
273
267
return
274
268
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
+
275
296
super ().build ()
276
297
277
298
def can_use_ias (self ):
278
299
return True
279
300
280
301
def needs_binutils (self ):
281
- return True
302
+ return 'LD' in self . make_variables or 'OBJCOPY' in self . make_variables
282
303
283
304
284
305
class X8664KernelBuilder (KernelBuilder ):
0 commit comments