tools/lkl: fix s390x and big endian detection

s390x detection is broken in that filters for "elf64-s390" using the '-'
trimmed EXEC_FMT variable.
Additionally, set_kernel_config_h is called with LKL_CONFIG_ENDIAN,
which doesn't match LKL_CONFIG_BIG_ENDIAN checked for in byteorder.h.
Change this to LKL_CONFIG_CPU_BIG_ENDIAN in preparation for removing
the redundant CONFIG_BIG_ENDIAN setting.

Fixes: 0d680a3d58 ("lkl: remove CONFIG_ leaks in uapi headers")
Signed-off-by: David Disseldorp <ddiss@suse.de>
This commit is contained in:
David Disseldorp
2025-04-23 08:07:43 +02:00
parent 06837c8cde
commit 12f0a9f718
2 changed files with 4 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
#include <asm/config.h>
#if defined(LKL_CONFIG_BIG_ENDIAN)
#if defined(LKL_CONFIG_CPU_BIG_ENDIAN)
#include <linux/byteorder/big_endian.h>
#else
#include <linux/byteorder/little_endian.h>

View File

@@ -119,8 +119,9 @@ define nt_host
endef
define s390_host
$(call set_kernel_config_h,LKL_CONFIG_ENDIAN,1)
$(call set_kernel_config_h,LKL_CONFIG_CPU_BIG_ENDIAN,1)
$(call set_kernel_config,BIG_ENDIAN,y)
$(call set_kernel_config,CPU_BIG_ENDIAN,y)
endef
define 64bit_host
@@ -296,7 +297,7 @@ define do_autoconf
$(eval EXEC_FMT := $(shell echo $(LD_FMT) | cut -d "-" -f1))
$(call set_kernel_config,OUTPUT_FORMAT,\"$(LD_FMT)\")
$(if $(or $(filter $(EXEC_FMT),elf64),$(filter $(LD_FMT),pe-x86-64)),$(call 64bit_host))
$(if $(filter $(EXEC_FMT),elf64-s390),$(call s390_host))
$(if $(filter $(LD_FMT),elf64-s390),$(call s390_host))
$(if $(filter $(EXEC_FMT),$(POSIX_HOSTS)),$(call posix_host,$(LD_FMT)))
$(if $(filter $(EXEC_FMT),$(NT_HOSTS)),$(call nt_host,$(LD_FMT)))
$(if $(and $(filter yes,$(kasan)),$(filter $(LD_FMT),$(KASAN_HOSTS))),$(call kasan_enable,$(LD_FMT)))