Re: [PATCH 4/8] tools: Remove s390 compat support

Alexei Starovoitov
2025-11-13T20:53:03Z

On Thu, Nov 13, 2025 at 7:08 AM Heiko Carstens <hca@linux.ibm.com> wrote:
>
> Remove s390 compat support from everything within tools, since s390 compat
> support will be removed from the kernel.
>
> While removing s390 compat code replace __s390__ ifdef guards with
> __s390x__ everywhere. Even though this is not strictly required this
> makes it easier to spot s390 compat code support leftovers.
>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
> .../arch/s390/include/uapi/asm/bitsperlong.h | 4 --
> tools/include/nolibc/arch-s390.h | 5 ---
> tools/include/nolibc/arch.h | 2 +-
> tools/lib/bpf/libbpf.c | 4 --
> tools/lib/bpf/usdt.c | 2 -
> .../testing/selftests/nolibc/Makefile.nolibc | 5 ---
> tools/testing/selftests/nolibc/run-tests.sh | 6 +--
> tools/testing/selftests/rseq/rseq-s390.h | 39 -------------------
> tools/testing/selftests/vDSO/vdso_config.h | 4 --
> 9 files changed, 2 insertions(+), 69 deletions(-)
>
> diff --git a/tools/arch/s390/include/uapi/asm/bitsperlong.h b/tools/arch/s390/include/uapi/asm/bitsperlong.h
> index d2bb620119bf..a226a1686a53 100644
> --- a/tools/arch/s390/include/uapi/asm/bitsperlong.h
> +++ b/tools/arch/s390/include/uapi/asm/bitsperlong.h
> @@ -2,11 +2,7 @@
> #ifndef __ASM_S390_BITSPERLONG_H
> #define __ASM_S390_BITSPERLONG_H
>
> -#ifndef __s390x__
> -#define __BITS_PER_LONG 32
> -#else
> #define __BITS_PER_LONG 64
> -#endif
>
> #include <asm-generic/bitsperlong.h>
>
> diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s390.h
> index df4c3cc713ac..0a39bee261b9 100644
> --- a/tools/include/nolibc/arch-s390.h
> +++ b/tools/include/nolibc/arch-s390.h
> @@ -143,13 +143,8 @@
> void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
> {
> __asm__ volatile (
> -#ifdef __s390x__
> "lgr %r2, %r15\n" /* save stack pointer to %r2, as arg1 of _start_c */
> "aghi %r15, -160\n" /* allocate new stackframe */
> -#else
> - "lr %r2, %r15\n"
> - "ahi %r15, -96\n"
> -#endif
> "xc 0(8,%r15), 0(%r15)\n" /* clear backchain */
> "brasl %r14, _start_c\n" /* transfer to c runtime */
> );
> diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h
> index 426c89198135..ef4743aad188 100644
> --- a/tools/include/nolibc/arch.h
> +++ b/tools/include/nolibc/arch.h
> @@ -27,7 +27,7 @@
> #include "arch-powerpc.h"
> #elif defined(__riscv)
> #include "arch-riscv.h"
> -#elif defined(__s390x__) || defined(__s390__)
> +#elif defined(__s390x__)
> #include "arch-s390.h"
> #elif defined(__loongarch__)
> #include "arch-loongarch.h"
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index dd3b2f57082d..85abc357da31 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -11325,8 +11325,6 @@ static const char *arch_specific_syscall_pfx(void)
> return "ia32";
> #elif defined(__s390x__)
> return "s390x";
> -#elif defined(__s390__)
> - return "s390";
> #elif defined(__arm__)
> return "arm";
> #elif defined(__aarch64__)
> @@ -12113,8 +12111,6 @@ static const char *arch_specific_lib_paths(void)
> return "/lib/i386-linux-gnu";
> #elif defined(__s390x__)
> return "/lib/s390x-linux-gnu";
> -#elif defined(__s390__)
> - return "/lib/s390-linux-gnu";
> #elif defined(__arm__) && defined(__SOFTFP__)
> return "/lib/arm-linux-gnueabi";
> #elif defined(__arm__) && !defined(__SOFTFP__)
> diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
> index c174b4086673..d1524f6f54ae 100644
> --- a/tools/lib/bpf/usdt.c
> +++ b/tools/lib/bpf/usdt.c
> @@ -1376,8 +1376,6 @@ static int parse_usdt_arg(const char *arg_str, int arg_num, struct usdt_arg_spec
>
> #elif defined(__s390x__)
>
> -/* Do not support __s390__ for now, since user_pt_regs is broken with -m31. */
> -
> static int parse_usdt_arg(const char *arg_str, int arg_num, struct usdt_arg_spec *arg, int *arg_sz)
> {
> unsigned int reg;

for bpf bits
Acked-by: Alexei Starovoitov <ast@kernel.org>