[PATCH 4/5] s390: Move files out of s390-64 folders
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed Apr 15 19:39:06 GMT 2026
On 09/04/26 05:47, Stefan Liebler wrote:
> All the files in subfolders s390/s390-64 in sysdeps directory are moved
> up to the s390/ ones. If necessary the files were merged with the existing
> ones.
>
> sysdeps/s390/preconfigure.ac was updated to reflect the removal of s390-64
> subdirectory.
Patch looks good, just some question below if we still need some configure
and build directives.
> ---
> sysdeps/s390/Implies | 1 +
> sysdeps/s390/Makefile | 89 +++++++
> sysdeps/s390/Versions | 3 +
> sysdeps/s390/{s390-64 => }/__longjmp.c | 2 +-
> sysdeps/s390/{s390-64 => }/add_n.S | 0
> sysdeps/s390/{s390-64 => }/bsd-_setjmp.S | 0
> sysdeps/s390/{s390-64 => }/bsd-setjmp.S | 0
> sysdeps/s390/configure | 93 +++++++-
> sysdeps/s390/configure.ac | 56 ++++-
> sysdeps/s390/{s390-64 => }/crti.S | 0
> sysdeps/s390/{s390-64 => }/crtn.S | 0
> sysdeps/s390/{s390-64 => }/dl-hwcap-check.h | 0
> .../s390/{s390-64 => }/dl-hwcaps-subdirs.c | 0
> sysdeps/s390/{s390-64 => }/dl-machine.h | 0
> sysdeps/s390/{s390-64 => }/dl-trampoline.S | 0
> sysdeps/s390/{s390-64 => }/dl-trampoline.h | 0
> sysdeps/s390/preconfigure | 2 +-
> sysdeps/s390/preconfigure.ac | 2 +-
> sysdeps/s390/s390-64/Implies | 1 -
> sysdeps/s390/s390-64/Makefile | 92 --------
> sysdeps/s390/s390-64/Versions | 5 -
> sysdeps/s390/s390-64/configure | 95 --------
> sysdeps/s390/s390-64/configure.ac | 57 -----
> sysdeps/s390/{s390-64 => }/s390x-mcount.S | 0
> sysdeps/s390/{s390-64 => }/s390x-mcount.h | 0
> sysdeps/s390/{s390-64 => }/setjmp.S | 0
> .../s390/{s390-64 => }/stackguard-macros.h | 0
> sysdeps/s390/{s390-64 => }/start.S | 0
> sysdeps/s390/{s390-64 => }/strncpy-z900.S | 0
> sysdeps/s390/{s390-64 => }/sub_n.S | 0
> sysdeps/s390/{s390-64 => }/sysdep.h | 0
> sysdeps/s390/{s390-64 => }/tst-audit.h | 0
> sysdeps/s390/{s390-64 => }/tst-glibc-hwcaps.c | 0
> sysdeps/unix/sysv/linux/s390/Implies | 1 +
> sysdeps/unix/sysv/linux/s390/Makefile | 10 +
> sysdeps/unix/sysv/linux/s390/Versions | 5 +
> .../s390/{s390-64 => }/____longjmp_chk.c | 0
> .../s390/{s390-64 => }/__makecontext_ret.S | 0
> .../linux/s390/{s390-64 => }/arch-syscall.h | 0
> .../linux/s390/{s390-64 => }/c++-types.data | 0
> .../sysv/linux/s390/{s390-64 => }/clone.S | 0
> .../sysv/linux/s390/{s390-64 => }/clone3.S | 0
> sysdeps/unix/sysv/linux/s390/configure | 13 ++
> sysdeps/unix/sysv/linux/s390/configure.ac | 2 +
> sysdeps/unix/sysv/linux/s390/dl-cache.h | 23 ++
> .../linux/s390/{s390-64 => }/getcontext.S | 0
> .../sysv/linux/s390/{s390-64 => }/ld.abilist | 0
> .../{s390-64 => }/libBrokenLocale.abilist | 0
> .../linux/s390/{s390-64 => }/libanl.abilist | 0
> .../linux/s390/{s390-64 => }/libc.abilist | 0
> .../{s390-64 => }/libc_malloc_debug.abilist | 0
> .../linux/s390/{s390-64 => }/libdl.abilist | 0
> .../linux/s390/{s390-64 => }/libm.abilist | 0
> .../linux/s390/{s390-64 => }/libnsl.abilist | 0
> .../s390/{s390-64 => }/libpthread.abilist | 0
> .../s390/{s390-64 => }/libresolv.abilist | 0
> .../linux/s390/{s390-64 => }/librt.abilist | 0
> .../s390/{s390-64 => }/libthread_db.abilist | 0
> .../linux/s390/{s390-64 => }/libutil.abilist | 0
> .../linux/s390/{s390-64 => }/makecontext.c | 0
> .../linux/s390/{s390-64 => }/pointer_guard.h | 0
> sysdeps/unix/sysv/linux/s390/s390-64/Implies | 1 -
> sysdeps/unix/sysv/linux/s390/s390-64/Makefile | 15 --
> sysdeps/unix/sysv/linux/s390/s390-64/Versions | 7 -
> .../unix/sysv/linux/s390/s390-64/configure | 16 --
> .../unix/sysv/linux/s390/s390-64/configure.ac | 4 -
> .../unix/sysv/linux/s390/s390-64/dl-cache.h | 24 --
> sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 178 --------------
> .../linux/s390/{s390-64 => }/setcontext.S | 0
> .../linux/s390/{s390-64 => }/shlib-versions | 0
> .../linux/s390/{s390-64 => }/single-thread.h | 0
> .../linux/s390/{s390-64 => }/swapcontext.S | 0
> .../sysv/linux/s390/{s390-64 => }/syscall.S | 0
> .../linux/s390/{s390-64 => }/syscall_cancel.S | 0
> .../sysv/linux/s390/{s390-64 => }/sysdep.S | 0
> sysdeps/unix/sysv/linux/s390/sysdep.h | 218 +++++++++++++++---
> .../{s390-64 => }/timer_t_was_int_compat.h | 0
> .../sysv/linux/s390/{s390-64 => }/vfork.S | 0
> 78 files changed, 481 insertions(+), 534 deletions(-)
> rename sysdeps/s390/{s390-64 => }/__longjmp.c (97%)
> rename sysdeps/s390/{s390-64 => }/add_n.S (100%)
> rename sysdeps/s390/{s390-64 => }/bsd-_setjmp.S (100%)
> rename sysdeps/s390/{s390-64 => }/bsd-setjmp.S (100%)
> rename sysdeps/s390/{s390-64 => }/crti.S (100%)
> rename sysdeps/s390/{s390-64 => }/crtn.S (100%)
> rename sysdeps/s390/{s390-64 => }/dl-hwcap-check.h (100%)
> rename sysdeps/s390/{s390-64 => }/dl-hwcaps-subdirs.c (100%)
> rename sysdeps/s390/{s390-64 => }/dl-machine.h (100%)
> rename sysdeps/s390/{s390-64 => }/dl-trampoline.S (100%)
> rename sysdeps/s390/{s390-64 => }/dl-trampoline.h (100%)
> delete mode 100644 sysdeps/s390/s390-64/Implies
> delete mode 100644 sysdeps/s390/s390-64/Makefile
> delete mode 100644 sysdeps/s390/s390-64/Versions
> delete mode 100644 sysdeps/s390/s390-64/configure
> delete mode 100644 sysdeps/s390/s390-64/configure.ac
> rename sysdeps/s390/{s390-64 => }/s390x-mcount.S (100%)
> rename sysdeps/s390/{s390-64 => }/s390x-mcount.h (100%)
> rename sysdeps/s390/{s390-64 => }/setjmp.S (100%)
> rename sysdeps/s390/{s390-64 => }/stackguard-macros.h (100%)
> rename sysdeps/s390/{s390-64 => }/start.S (100%)
> rename sysdeps/s390/{s390-64 => }/strncpy-z900.S (100%)
> rename sysdeps/s390/{s390-64 => }/sub_n.S (100%)
> rename sysdeps/s390/{s390-64 => }/sysdep.h (100%)
> rename sysdeps/s390/{s390-64 => }/tst-audit.h (100%)
> rename sysdeps/s390/{s390-64 => }/tst-glibc-hwcaps.c (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/____longjmp_chk.c (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/__makecontext_ret.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/arch-syscall.h (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/c++-types.data (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/clone.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/clone3.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/getcontext.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/ld.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libBrokenLocale.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libanl.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libc.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libc_malloc_debug.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libdl.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libm.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libnsl.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libpthread.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libresolv.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/librt.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libthread_db.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/libutil.abilist (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/makecontext.c (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/pointer_guard.h (100%)
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/Implies
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/Makefile
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/Versions
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/configure
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/configure.ac
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/dl-cache.h
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/setcontext.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/shlib-versions (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/single-thread.h (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/swapcontext.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/syscall.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/syscall_cancel.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/sysdep.S (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/timer_t_was_int_compat.h (100%)
> rename sysdeps/unix/sysv/linux/s390/{s390-64 => }/vfork.S (100%)
>
> diff --git a/sysdeps/s390/Implies b/sysdeps/s390/Implies
> index 1945b1f4bb..30800d54c3 100644
> --- a/sysdeps/s390/Implies
> +++ b/sysdeps/s390/Implies
> @@ -1,3 +1,4 @@
> +wordsize-64
> ieee754/ldbl-128
> ieee754/dbl-64
> ieee754/flt-32
> diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
> index 985b4f25ee..29d11dfdab 100644
> --- a/sysdeps/s390/Makefile
> +++ b/sysdeps/s390/Makefile
> @@ -1,3 +1,7 @@
> +ifeq ($(subdir),gmon)
> +sysdep_routines += s390x-mcount
> +endif
> +
> ifeq ($(subdir),iconvdata)
> ISO-8859-1_CP037_Z900-routines := iso-8859-1_cp037_z900
> ISO-8859-1_CP037_Z900-map := gconv.map
> @@ -43,6 +47,91 @@ $(modpfx)gconv-modules-s390.conf: ../sysdeps/s390/gconv-modules-s390.conf \
> endif
>
> ifeq ($(subdir),elf)
> +CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused
> +CFLAGS-dl-load.c += -Wno-unused
> +CFLAGS-dl-reloc.c += -Wno-unused
Do we still need these?
> +
> +$(objpfx)tst-glibc-hwcaps: \
> + $(objpfx)libmarkermod2-1.so \
> + $(objpfx)libmarkermod3-1.so \
> + $(objpfx)libmarkermod4-1.so \
> + $(objpfx)libmarkermod5-1.so \
> + $(objpfx)libmarkermod6-1.so
> +$(objpfx)tst-glibc-hwcaps.out: \
> + $(objpfx)libmarkermod2.so \
> + $(objpfx)glibc-hwcaps/z13/libmarkermod2.so \
> + $(objpfx)libmarkermod3.so \
> + $(objpfx)glibc-hwcaps/z13/libmarkermod3.so \
> + $(objpfx)glibc-hwcaps/z14/libmarkermod3.so \
> + $(objpfx)libmarkermod4.so \
> + $(objpfx)glibc-hwcaps/z13/libmarkermod4.so \
> + $(objpfx)glibc-hwcaps/z14/libmarkermod4.so \
> + $(objpfx)glibc-hwcaps/z15/libmarkermod4.so \
> + $(objpfx)libmarkermod5.so \
> + $(objpfx)glibc-hwcaps/z13/libmarkermod5.so \
> + $(objpfx)glibc-hwcaps/z14/libmarkermod5.so \
> + $(objpfx)glibc-hwcaps/z15/libmarkermod5.so \
> + $(objpfx)glibc-hwcaps/z16/libmarkermod5.so \
> + $(objpfx)libmarkermod6.so \
> + $(objpfx)glibc-hwcaps/z13/libmarkermod6.so \
> + $(objpfx)glibc-hwcaps/z14/libmarkermod6.so \
> + $(objpfx)glibc-hwcaps/z15/libmarkermod6.so \
> + $(objpfx)glibc-hwcaps/z16/libmarkermod6.so \
> + $(objpfx)glibc-hwcaps/z17/libmarkermod6.so
> +
> +
> +$(objpfx)glibc-hwcaps/z13/libmarkermod2.so: $(objpfx)libmarkermod2-2.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z13/libmarkermod3.so: $(objpfx)libmarkermod3-2.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z14/libmarkermod3.so: $(objpfx)libmarkermod3-3.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z13/libmarkermod4.so: $(objpfx)libmarkermod4-2.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z14/libmarkermod4.so: $(objpfx)libmarkermod4-3.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z15/libmarkermod4.so: $(objpfx)libmarkermod4-4.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z13/libmarkermod5.so: $(objpfx)libmarkermod5-2.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z14/libmarkermod5.so: $(objpfx)libmarkermod5-3.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z15/libmarkermod5.so: $(objpfx)libmarkermod5-4.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z16/libmarkermod5.so: $(objpfx)libmarkermod5-5.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z13/libmarkermod6.so: $(objpfx)libmarkermod6-2.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z14/libmarkermod6.so: $(objpfx)libmarkermod6-3.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z15/libmarkermod6.so: $(objpfx)libmarkermod6-4.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z16/libmarkermod6.so: $(objpfx)libmarkermod6-5.so
> + $(make-target-directory)
> + cp $< $@
> +$(objpfx)glibc-hwcaps/z17/libmarkermod6.so: $(objpfx)libmarkermod6-6.so
> + $(make-target-directory)
> + cp $< $@
> +
> +
> +ifeq (no,$(build-hardcoded-path-in-tests))
> +# This is an ld.so.cache test, and RPATH/RUNPATH in the executable
> +# interferes with its test objectives.
> +tests-container += tst-glibc-hwcaps-cache
> +endif
>
> ifeq ($(build-shared),yes)
> tests += tst-dl-runtime-resolve-noaudit tst-dl-runtime-resolve-audit \
> diff --git a/sysdeps/s390/Versions b/sysdeps/s390/Versions
> index 8417623353..d80d691817 100644
> --- a/sysdeps/s390/Versions
> +++ b/sysdeps/s390/Versions
> @@ -3,6 +3,9 @@ libc {
> setjmp; _setjmp; __sigsetjmp;
> longjmp; _longjmp; siglongjmp;
> }
> + GLIBC_2.29 {
> + __fentry__;
> + }
> }
>
> ld {
> diff --git a/sysdeps/s390/s390-64/__longjmp.c b/sysdeps/s390/__longjmp.c
> similarity index 97%
> rename from sysdeps/s390/s390-64/__longjmp.c
> rename to sysdeps/s390/__longjmp.c
> index fabd5e0a4e..7c207e44c6 100644
> --- a/sysdeps/s390/s390-64/__longjmp.c
> +++ b/sysdeps/s390/__longjmp.c
> @@ -24,7 +24,7 @@
> #include <unistd.h>
> #include <stap-probe.h>
>
> -/* See sysdeps/unix/sysv/linux/s390/s390-64/pointer_guard.h. */
> +/* See sysdeps/unix/sysv/linux/s390/pointer_guard.h. */
> #if IS_IN (rtld)
> # undef PTR_DEMANGLE
> #endif
> diff --git a/sysdeps/s390/s390-64/add_n.S b/sysdeps/s390/add_n.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/add_n.S
> rename to sysdeps/s390/add_n.S
> diff --git a/sysdeps/s390/s390-64/bsd-_setjmp.S b/sysdeps/s390/bsd-_setjmp.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/bsd-_setjmp.S
> rename to sysdeps/s390/bsd-_setjmp.S
> diff --git a/sysdeps/s390/s390-64/bsd-setjmp.S b/sysdeps/s390/bsd-setjmp.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/bsd-setjmp.S
> rename to sysdeps/s390/bsd-setjmp.S
> diff --git a/sysdeps/s390/configure b/sysdeps/s390/configure
> index f4ec662610..e21a5ba3a7 100644
> --- a/sysdeps/s390/configure
> +++ b/sysdeps/s390/configure
> @@ -269,6 +269,95 @@ then
>
> fi
>
> -test -n "$critic_missing" && as_fn_error $? "
> -*** $critic_missing" "$LINENO" 5
> +# Minimal checking for static PIE support in ld.
> +# Compare to ld testcase/bugzilla:
> +# <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
> +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for s390-specific static PIE requirements" >&5
> +printf %s "checking for s390-specific static PIE requirements... " >&6; }
> +if { as_var=\
> +libc_cv_s390x_staticpie_req_runtime; eval test \${$as_var+y}; }
> +then :
> + printf %s "(cached) " >&6
> +else case e in #(
> + e) cat > conftest1.c <<EOF
> +__thread int * foo;
> +
> +void
> +bar (void)
> +{
> + *foo = 1;
> +}
> +
> +void bar2 (void);
> +void* bar2_ifunc (void) __asm__ ("bar2");
> +__asm__ (".type bar2, %gnu_indirect_function");
> +void* bar2_ifunc (void) { return 0; }
> +EOF
> + cat > conftest2.c <<EOF
> +extern __thread int *foo;
> +extern void bar (void);
> +extern void bar2 (void);
> +static int x;
> +
> +int
> +main ()
> +{
> + foo = &x;
> + bar2 ();
> + return 0;
> +}
> +EOF
> + libc_cv_s390x_staticpie_req_runtime=no
> + # Check if the static linker does not generate dynamic TLS relocs in PIE
> + # (binutils PR ld/22263), if it accepts --no-dynamic-linker
> + # (by using -static-pie), and if it adds a DT_JMPREL pointing to .rela.iplt
> + # with static pie.
> + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o'
> + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> + (eval $ac_try) 2>&5
> + ac_status=$?
> + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> + test $ac_status = 0; }; } \
> + && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o'
> + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> + (eval $ac_try) 2>&5
> + ac_status=$?
> + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> + test $ac_status = 0; }; } \
> + && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o'
> + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> + (eval $ac_try) 2>&5
> + ac_status=$?
> + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> + test $ac_status = 0; }; } \
> + && { ac_try='! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF >&5'
> + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> + (eval $ac_try) 2>&5
> + ac_status=$?
> + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> + test $ac_status = 0; }; } \
> + && { ac_try='LC_ALL=C $READELF -Wd conftest | grep JMPREL >&5'
> + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> + (eval $ac_try) 2>&5
> + ac_status=$?
> + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> + test $ac_status = 0; }; }
> + then
> + libc_cv_s390x_staticpie_req_runtime=yes
> + fi
> + rm -rf conftest.* ;;
> +esac
> +fi
> +eval ac_res=\$\
> +libc_cv_s390x_staticpie_req_runtime
> + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
> +printf "%s\n" "$ac_res" >&6; }
> +
> +if test $libc_cv_s390x_staticpie_req_runtime = yes; then
> + # Some kernels might fail with /proc/sys/kernel/randomize_va_space set to 0
> + # due not enough space for a brk call. However, there is no reliable way to
> + # test it.
> + printf "%s\n" "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
> +
> +fi
>
> diff --git a/sysdeps/s390/configure.ac b/sysdeps/s390/configure.ac
> index 82e1a4445f..3c384f9670 100644
> --- a/sysdeps/s390/configure.ac
> +++ b/sysdeps/s390/configure.ac
> @@ -133,5 +133,57 @@ then
> AC_DEFINE(HAVE_S390_MIN_ARCH13_ZARCH_ASM_SUPPORT)
> fi
>
> -test -n "$critic_missing" && AC_MSG_ERROR([
> -*** $critic_missing])
> +# Minimal checking for static PIE support in ld.
> +# Compare to ld testcase/bugzilla:
> +# <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
> +AC_CACHE_CHECK([for s390-specific static PIE requirements], \
> +[libc_cv_s390x_staticpie_req_runtime], [dnl
> + cat > conftest1.c <<EOF
> +__thread int * foo;
> +
> +void
> +bar (void)
> +{
> + *foo = 1;
> +}
> +
> +void bar2 (void);
> +void* bar2_ifunc (void) __asm__ ("bar2");
> +__asm__ (".type bar2, %gnu_indirect_function");
> +void* bar2_ifunc (void) { return 0; }
> +EOF
> + cat > conftest2.c <<EOF
> +extern __thread int *foo;
> +extern void bar (void);
> +extern void bar2 (void);
> +static int x;
> +
> +int
> +main ()
> +{
> + foo = &x;
> + bar2 ();
> + return 0;
> +}
> +EOF
> + libc_cv_s390x_staticpie_req_runtime=no
> + # Check if the static linker does not generate dynamic TLS relocs in PIE
> + # (binutils PR ld/22263), if it accepts --no-dynamic-linker
> + # (by using -static-pie), and if it adds a DT_JMPREL pointing to .rela.iplt
> + # with static pie.
> + if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o]) \
> + && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o]) \
> + && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o]) \
> + && AC_TRY_COMMAND([! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF] >&AS_MESSAGE_LOG_FD) \
> + && AC_TRY_COMMAND([LC_ALL=C $READELF -Wd conftest | grep JMPREL >&AS_MESSAGE_LOG_FD])
> + then
> + libc_cv_s390x_staticpie_req_runtime=yes
> + fi
> + rm -rf conftest.*])
> +
> +if test $libc_cv_s390x_staticpie_req_runtime = yes; then
> + # Some kernels might fail with /proc/sys/kernel/randomize_va_space set to 0
> + # due not enough space for a brk call. However, there is no reliable way to
> + # test it.
> + AC_DEFINE(SUPPORT_STATIC_PIE)
> +fi
Now that we require binutils 2.39, do we still need these check for
static PIE?
> diff --git a/sysdeps/s390/s390-64/crti.S b/sysdeps/s390/crti.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/crti.S
> rename to sysdeps/s390/crti.S
> diff --git a/sysdeps/s390/s390-64/crtn.S b/sysdeps/s390/crtn.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/crtn.S
> rename to sysdeps/s390/crtn.S
> diff --git a/sysdeps/s390/s390-64/dl-hwcap-check.h b/sysdeps/s390/dl-hwcap-check.h
> similarity index 100%
> rename from sysdeps/s390/s390-64/dl-hwcap-check.h
> rename to sysdeps/s390/dl-hwcap-check.h
> diff --git a/sysdeps/s390/s390-64/dl-hwcaps-subdirs.c b/sysdeps/s390/dl-hwcaps-subdirs.c
> similarity index 100%
> rename from sysdeps/s390/s390-64/dl-hwcaps-subdirs.c
> rename to sysdeps/s390/dl-hwcaps-subdirs.c
> diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/dl-machine.h
> similarity index 100%
> rename from sysdeps/s390/s390-64/dl-machine.h
> rename to sysdeps/s390/dl-machine.h
> diff --git a/sysdeps/s390/s390-64/dl-trampoline.S b/sysdeps/s390/dl-trampoline.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/dl-trampoline.S
> rename to sysdeps/s390/dl-trampoline.S
> diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/dl-trampoline.h
> similarity index 100%
> rename from sysdeps/s390/s390-64/dl-trampoline.h
> rename to sysdeps/s390/dl-trampoline.h
> diff --git a/sysdeps/s390/preconfigure b/sysdeps/s390/preconfigure
> index 0536f3eb80..39843cb365 100644
> --- a/sysdeps/s390/preconfigure
> +++ b/sysdeps/s390/preconfigure
> @@ -4,7 +4,7 @@
> case "$machine" in
> s390x)
> base_machine=s390
> - machine=s390/s390-64
> + machine=s390
> ;;
> s390)
> as_fn_error $? "s390-32 is not supported anymore." "$LINENO" 5
> diff --git a/sysdeps/s390/preconfigure.ac b/sysdeps/s390/preconfigure.ac
> index aee9e4e0cc..b75ad3be00 100644
> --- a/sysdeps/s390/preconfigure.ac
> +++ b/sysdeps/s390/preconfigure.ac
> @@ -4,7 +4,7 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
> case "$machine" in
> s390x)
> base_machine=s390
> - machine=s390/s390-64
> + machine=s390
> ;;
> s390)
> AC_MSG_ERROR(s390-32 is not supported anymore.)
> diff --git a/sysdeps/s390/s390-64/Implies b/sysdeps/s390/s390-64/Implies
> deleted file mode 100644
> index a8cae95f9d..0000000000
> --- a/sysdeps/s390/s390-64/Implies
> +++ /dev/null
> @@ -1 +0,0 @@
> -wordsize-64
> diff --git a/sysdeps/s390/s390-64/Makefile b/sysdeps/s390/s390-64/Makefile
> deleted file mode 100644
> index 991025cd2a..0000000000
> --- a/sysdeps/s390/s390-64/Makefile
> +++ /dev/null
> @@ -1,92 +0,0 @@
> -ifeq ($(subdir),gmon)
> -sysdep_routines += s390x-mcount
> -endif
> -
> -ifeq ($(subdir),elf)
> -CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused
> -CFLAGS-dl-load.c += -Wno-unused
> -CFLAGS-dl-reloc.c += -Wno-unused
> -
> -$(objpfx)tst-glibc-hwcaps: \
> - $(objpfx)libmarkermod2-1.so \
> - $(objpfx)libmarkermod3-1.so \
> - $(objpfx)libmarkermod4-1.so \
> - $(objpfx)libmarkermod5-1.so \
> - $(objpfx)libmarkermod6-1.so
> -$(objpfx)tst-glibc-hwcaps.out: \
> - $(objpfx)libmarkermod2.so \
> - $(objpfx)glibc-hwcaps/z13/libmarkermod2.so \
> - $(objpfx)libmarkermod3.so \
> - $(objpfx)glibc-hwcaps/z13/libmarkermod3.so \
> - $(objpfx)glibc-hwcaps/z14/libmarkermod3.so \
> - $(objpfx)libmarkermod4.so \
> - $(objpfx)glibc-hwcaps/z13/libmarkermod4.so \
> - $(objpfx)glibc-hwcaps/z14/libmarkermod4.so \
> - $(objpfx)glibc-hwcaps/z15/libmarkermod4.so \
> - $(objpfx)libmarkermod5.so \
> - $(objpfx)glibc-hwcaps/z13/libmarkermod5.so \
> - $(objpfx)glibc-hwcaps/z14/libmarkermod5.so \
> - $(objpfx)glibc-hwcaps/z15/libmarkermod5.so \
> - $(objpfx)glibc-hwcaps/z16/libmarkermod5.so \
> - $(objpfx)libmarkermod6.so \
> - $(objpfx)glibc-hwcaps/z13/libmarkermod6.so \
> - $(objpfx)glibc-hwcaps/z14/libmarkermod6.so \
> - $(objpfx)glibc-hwcaps/z15/libmarkermod6.so \
> - $(objpfx)glibc-hwcaps/z16/libmarkermod6.so \
> - $(objpfx)glibc-hwcaps/z17/libmarkermod6.so
> -
> -
> -$(objpfx)glibc-hwcaps/z13/libmarkermod2.so: $(objpfx)libmarkermod2-2.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z13/libmarkermod3.so: $(objpfx)libmarkermod3-2.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z14/libmarkermod3.so: $(objpfx)libmarkermod3-3.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z13/libmarkermod4.so: $(objpfx)libmarkermod4-2.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z14/libmarkermod4.so: $(objpfx)libmarkermod4-3.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z15/libmarkermod4.so: $(objpfx)libmarkermod4-4.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z13/libmarkermod5.so: $(objpfx)libmarkermod5-2.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z14/libmarkermod5.so: $(objpfx)libmarkermod5-3.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z15/libmarkermod5.so: $(objpfx)libmarkermod5-4.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z16/libmarkermod5.so: $(objpfx)libmarkermod5-5.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z13/libmarkermod6.so: $(objpfx)libmarkermod6-2.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z14/libmarkermod6.so: $(objpfx)libmarkermod6-3.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z15/libmarkermod6.so: $(objpfx)libmarkermod6-4.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z16/libmarkermod6.so: $(objpfx)libmarkermod6-5.so
> - $(make-target-directory)
> - cp $< $@
> -$(objpfx)glibc-hwcaps/z17/libmarkermod6.so: $(objpfx)libmarkermod6-6.so
> - $(make-target-directory)
> - cp $< $@
> -
> -
> -ifeq (no,$(build-hardcoded-path-in-tests))
> -# This is an ld.so.cache test, and RPATH/RUNPATH in the executable
> -# interferes with its test objectives.
> -tests-container += tst-glibc-hwcaps-cache
> -endif
> -
> -endif # $(subdir) == elf
> diff --git a/sysdeps/s390/s390-64/Versions b/sysdeps/s390/s390-64/Versions
> deleted file mode 100644
> index ec1d68313d..0000000000
> --- a/sysdeps/s390/s390-64/Versions
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -libc {
> - GLIBC_2.29 {
> - __fentry__;
> - }
> -}
> diff --git a/sysdeps/s390/s390-64/configure b/sysdeps/s390/s390-64/configure
> deleted file mode 100644
> index 9ea6940c85..0000000000
> --- a/sysdeps/s390/s390-64/configure
> +++ /dev/null
> @@ -1,95 +0,0 @@
> -# This file is generated from configure.ac by Autoconf. DO NOT EDIT!
> - # Local configure fragment for sysdeps/s390/s390-64.
> -
> -# Minimal checking for static PIE support in ld.
> -# Compare to ld testcase/bugzilla:
> -# <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for s390-specific static PIE requirements" >&5
> -printf %s "checking for s390-specific static PIE requirements... " >&6; }
> -if { as_var=\
> -libc_cv_s390x_staticpie_req_runtime; eval test \${$as_var+y}; }
> -then :
> - printf %s "(cached) " >&6
> -else case e in #(
> - e) cat > conftest1.c <<EOF
> -__thread int * foo;
> -
> -void
> -bar (void)
> -{
> - *foo = 1;
> -}
> -
> -void bar2 (void);
> -void* bar2_ifunc (void) __asm__ ("bar2");
> -__asm__ (".type bar2, %gnu_indirect_function");
> -void* bar2_ifunc (void) { return 0; }
> -EOF
> - cat > conftest2.c <<EOF
> -extern __thread int *foo;
> -extern void bar (void);
> -extern void bar2 (void);
> -static int x;
> -
> -int
> -main ()
> -{
> - foo = &x;
> - bar2 ();
> - return 0;
> -}
> -EOF
> - libc_cv_s390x_staticpie_req_runtime=no
> - # Check if the static linker does not generate dynamic TLS relocs in PIE
> - # (binutils PR ld/22263), if it accepts --no-dynamic-linker
> - # (by using -static-pie), and if it adds a DT_JMPREL pointing to .rela.iplt
> - # with static pie.
> - if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o'
> - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> - (eval $ac_try) 2>&5
> - ac_status=$?
> - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> - test $ac_status = 0; }; } \
> - && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o'
> - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> - (eval $ac_try) 2>&5
> - ac_status=$?
> - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> - test $ac_status = 0; }; } \
> - && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o'
> - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> - (eval $ac_try) 2>&5
> - ac_status=$?
> - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> - test $ac_status = 0; }; } \
> - && { ac_try='! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF >&5'
> - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> - (eval $ac_try) 2>&5
> - ac_status=$?
> - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> - test $ac_status = 0; }; } \
> - && { ac_try='LC_ALL=C $READELF -Wd conftest | grep JMPREL >&5'
> - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> - (eval $ac_try) 2>&5
> - ac_status=$?
> - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> - test $ac_status = 0; }; }
> - then
> - libc_cv_s390x_staticpie_req_runtime=yes
> - fi
> - rm -rf conftest.* ;;
> -esac
> -fi
> -eval ac_res=\$\
> -libc_cv_s390x_staticpie_req_runtime
> - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
> -printf "%s\n" "$ac_res" >&6; }
> -
> -if test $libc_cv_s390x_staticpie_req_runtime = yes; then
> - # Some kernels might fail with /proc/sys/kernel/randomize_va_space set to 0
> - # due not enough space for a brk call. However, there is no reliable way to
> - # test it.
> - printf "%s\n" "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
> -
> -fi
> -
> diff --git a/sysdeps/s390/s390-64/configure.ac b/sysdeps/s390/s390-64/configure.ac
> deleted file mode 100644
> index aaf71eabb1..0000000000
> --- a/sysdeps/s390/s390-64/configure.ac
> +++ /dev/null
> @@ -1,57 +0,0 @@
> -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
> -# Local configure fragment for sysdeps/s390/s390-64.
> -
> -# Minimal checking for static PIE support in ld.
> -# Compare to ld testcase/bugzilla:
> -# <binutils-source>/ld/testsuite/ld-elf/pr22263-1.rd
> -AC_CACHE_CHECK([for s390-specific static PIE requirements], \
> -[libc_cv_s390x_staticpie_req_runtime], [dnl
> - cat > conftest1.c <<EOF
> -__thread int * foo;
> -
> -void
> -bar (void)
> -{
> - *foo = 1;
> -}
> -
> -void bar2 (void);
> -void* bar2_ifunc (void) __asm__ ("bar2");
> -__asm__ (".type bar2, %gnu_indirect_function");
> -void* bar2_ifunc (void) { return 0; }
> -EOF
> - cat > conftest2.c <<EOF
> -extern __thread int *foo;
> -extern void bar (void);
> -extern void bar2 (void);
> -static int x;
> -
> -int
> -main ()
> -{
> - foo = &x;
> - bar2 ();
> - return 0;
> -}
> -EOF
> - libc_cv_s390x_staticpie_req_runtime=no
> - # Check if the static linker does not generate dynamic TLS relocs in PIE
> - # (binutils PR ld/22263), if it accepts --no-dynamic-linker
> - # (by using -static-pie), and if it adds a DT_JMPREL pointing to .rela.iplt
> - # with static pie.
> - if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest1.c -o conftest1.o]) \
> - && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -fPIE -c conftest2.c -o conftest2.o]) \
> - && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostartfiles -nostdlib -fPIE -o conftest conftest1.o conftest2.o]) \
> - && AC_TRY_COMMAND([! LC_ALL=C $READELF -Wr conftest | grep R_390_TLS_TPOFF] >&AS_MESSAGE_LOG_FD) \
> - && AC_TRY_COMMAND([LC_ALL=C $READELF -Wd conftest | grep JMPREL >&AS_MESSAGE_LOG_FD])
> - then
> - libc_cv_s390x_staticpie_req_runtime=yes
> - fi
> - rm -rf conftest.*])
> -
> -if test $libc_cv_s390x_staticpie_req_runtime = yes; then
> - # Some kernels might fail with /proc/sys/kernel/randomize_va_space set to 0
> - # due not enough space for a brk call. However, there is no reliable way to
> - # test it.
> - AC_DEFINE(SUPPORT_STATIC_PIE)
> -fi
> diff --git a/sysdeps/s390/s390-64/s390x-mcount.S b/sysdeps/s390/s390x-mcount.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/s390x-mcount.S
> rename to sysdeps/s390/s390x-mcount.S
> diff --git a/sysdeps/s390/s390-64/s390x-mcount.h b/sysdeps/s390/s390x-mcount.h
> similarity index 100%
> rename from sysdeps/s390/s390-64/s390x-mcount.h
> rename to sysdeps/s390/s390x-mcount.h
> diff --git a/sysdeps/s390/s390-64/setjmp.S b/sysdeps/s390/setjmp.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/setjmp.S
> rename to sysdeps/s390/setjmp.S
> diff --git a/sysdeps/s390/s390-64/stackguard-macros.h b/sysdeps/s390/stackguard-macros.h
> similarity index 100%
> rename from sysdeps/s390/s390-64/stackguard-macros.h
> rename to sysdeps/s390/stackguard-macros.h
> diff --git a/sysdeps/s390/s390-64/start.S b/sysdeps/s390/start.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/start.S
> rename to sysdeps/s390/start.S
> diff --git a/sysdeps/s390/s390-64/strncpy-z900.S b/sysdeps/s390/strncpy-z900.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/strncpy-z900.S
> rename to sysdeps/s390/strncpy-z900.S
> diff --git a/sysdeps/s390/s390-64/sub_n.S b/sysdeps/s390/sub_n.S
> similarity index 100%
> rename from sysdeps/s390/s390-64/sub_n.S
> rename to sysdeps/s390/sub_n.S
> diff --git a/sysdeps/s390/s390-64/sysdep.h b/sysdeps/s390/sysdep.h
> similarity index 100%
> rename from sysdeps/s390/s390-64/sysdep.h
> rename to sysdeps/s390/sysdep.h
> diff --git a/sysdeps/s390/s390-64/tst-audit.h b/sysdeps/s390/tst-audit.h
> similarity index 100%
> rename from sysdeps/s390/s390-64/tst-audit.h
> rename to sysdeps/s390/tst-audit.h
> diff --git a/sysdeps/s390/s390-64/tst-glibc-hwcaps.c b/sysdeps/s390/tst-glibc-hwcaps.c
> similarity index 100%
> rename from sysdeps/s390/s390-64/tst-glibc-hwcaps.c
> rename to sysdeps/s390/tst-glibc-hwcaps.c
> diff --git a/sysdeps/unix/sysv/linux/s390/Implies b/sysdeps/unix/sysv/linux/s390/Implies
> index e6e51fa5a7..615f507831 100644
> --- a/sysdeps/unix/sysv/linux/s390/Implies
> +++ b/sysdeps/unix/sysv/linux/s390/Implies
> @@ -1,4 +1,5 @@
> s390/nptl
> +unix/sysv/linux/wordsize-64
>
> # These supply the ABI compatibility for when long double was double.
> ieee754/ldbl-64-128
> diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile
> index 218aff1aee..e9ef5c51ac 100644
> --- a/sysdeps/unix/sysv/linux/s390/Makefile
> +++ b/sysdeps/unix/sysv/linux/s390/Makefile
> @@ -1,3 +1,11 @@
> +ifeq ($(subdir),elf)
> +ifeq (yes,$(build-shared))
> +# This is needed to support g++ v2 and v3.
> +sysdep_routines += framestate
> +shared-only-routines += framestate
> +endif
> +endif
> +
> ifeq ($(subdir),rt)
> librt-routines += rt-sysdep
> librt-shared-only-routines += rt-sysdep
> @@ -5,8 +13,10 @@ endif
>
> ifeq ($(subdir),stdlib)
> gen-as-const-headers += ucontext_i.sym
> +sysdep_routines += __makecontext_ret
> endif
>
> ifeq ($(subdir),misc)
> tests += tst-ptrace-singleblock
> +sysdep_headers += sys/elf.h
> endif
> diff --git a/sysdeps/unix/sysv/linux/s390/Versions b/sysdeps/unix/sysv/linux/s390/Versions
> index 548397fcff..d4b6a01950 100644
> --- a/sysdeps/unix/sysv/linux/s390/Versions
> +++ b/sysdeps/unix/sysv/linux/s390/Versions
> @@ -1,4 +1,9 @@
> libc {
> + GLIBC_2.2 {
> + # Exception handling support functions from libgcc
> + __register_frame; __register_frame_table; __deregister_frame;
> + __frame_state_for; __register_frame_info_table;
> + }
> GLIBC_2.19 {
> __longjmp_chk;
> getcontext;
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c b/sysdeps/unix/sysv/linux/s390/____longjmp_chk.c
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c
> rename to sysdeps/unix/sysv/linux/s390/____longjmp_chk.c
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S b/sysdeps/unix/sysv/linux/s390/__makecontext_ret.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
> rename to sysdeps/unix/sysv/linux/s390/__makecontext_ret.S
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/arch-syscall.h
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
> rename to sysdeps/unix/sysv/linux/s390/arch-syscall.h
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/c++-types.data b/sysdeps/unix/sysv/linux/s390/c++-types.data
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/c++-types.data
> rename to sysdeps/unix/sysv/linux/s390/c++-types.data
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/sysdeps/unix/sysv/linux/s390/clone.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/clone.S
> rename to sysdeps/unix/sysv/linux/s390/clone.S
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone3.S b/sysdeps/unix/sysv/linux/s390/clone3.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/clone3.S
> rename to sysdeps/unix/sysv/linux/s390/clone3.S
> diff --git a/sysdeps/unix/sysv/linux/s390/configure b/sysdeps/unix/sysv/linux/s390/configure
> index d8a14434c5..9b3a1c01d2 100644
> --- a/sysdeps/unix/sysv/linux/s390/configure
> +++ b/sysdeps/unix/sysv/linux/s390/configure
> @@ -4,3 +4,16 @@
> libc_cv_gcc_unwind_find_fde=yes
> ldd_rewrite_script=sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
>
> +test -n "$libc_cv_slibdir" ||
> +case "$prefix" in
> +/usr | /usr/)
> + libc_cv_slibdir='/lib64'
> + libc_cv_rtlddir='/lib'
> + if test "$libdir" = '${exec_prefix}/lib'; then
> + libdir='${exec_prefix}/lib64';
> + # Locale data can be shared between 32-bit and 64-bit libraries.
> + libc_cv_complocaledir='${exec_prefix}/lib/locale'
> + fi
> + ;;
> +esac
> +
> diff --git a/sysdeps/unix/sysv/linux/s390/configure.ac b/sysdeps/unix/sysv/linux/s390/configure.ac
> index 978450c94b..28e1caff2f 100644
> --- a/sysdeps/unix/sysv/linux/s390/configure.ac
> +++ b/sysdeps/unix/sysv/linux/s390/configure.ac
> @@ -3,3 +3,5 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>
> libc_cv_gcc_unwind_find_fde=yes
> ldd_rewrite_script=sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
> +
> +LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
> diff --git a/sysdeps/unix/sysv/linux/s390/dl-cache.h b/sysdeps/unix/sysv/linux/s390/dl-cache.h
> index 766bba4265..df1ef9155c 100644
> --- a/sysdeps/unix/sysv/linux/s390/dl-cache.h
> +++ b/sysdeps/unix/sysv/linux/s390/dl-cache.h
> @@ -1 +1,24 @@
> +/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
> + Copyright (C) 2001-2026 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <https://www.gnu.org/licenses/>. */
> +
> +#define _DL_CACHE_DEFAULT_ID 0x403
> +
> +#define _dl_cache_check_flags(flags) \
> + ((flags) == _DL_CACHE_DEFAULT_ID)
> +
> #include <sysdeps/unix/sysv/linux/sparc/dl-cache.h>
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/getcontext.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
> rename to sysdeps/unix/sysv/linux/s390/getcontext.S
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist b/sysdeps/unix/sysv/linux/s390/ld.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist
> rename to sysdeps/unix/sysv/linux/s390/ld.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libBrokenLocale.abilist b/sysdeps/unix/sysv/linux/s390/libBrokenLocale.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libBrokenLocale.abilist
> rename to sysdeps/unix/sysv/linux/s390/libBrokenLocale.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libanl.abilist b/sysdeps/unix/sysv/linux/s390/libanl.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libanl.abilist
> rename to sysdeps/unix/sysv/linux/s390/libanl.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/libc.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> rename to sysdeps/unix/sysv/linux/s390/libc.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist b/sysdeps/unix/sysv/linux/s390/libc_malloc_debug.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libc_malloc_debug.abilist
> rename to sysdeps/unix/sysv/linux/s390/libc_malloc_debug.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libdl.abilist b/sysdeps/unix/sysv/linux/s390/libdl.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libdl.abilist
> rename to sysdeps/unix/sysv/linux/s390/libdl.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist b/sysdeps/unix/sysv/linux/s390/libm.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
> rename to sysdeps/unix/sysv/linux/s390/libm.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libnsl.abilist b/sysdeps/unix/sysv/linux/s390/libnsl.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libnsl.abilist
> rename to sysdeps/unix/sysv/linux/s390/libnsl.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/libpthread.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
> rename to sysdeps/unix/sysv/linux/s390/libpthread.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libresolv.abilist b/sysdeps/unix/sysv/linux/s390/libresolv.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libresolv.abilist
> rename to sysdeps/unix/sysv/linux/s390/libresolv.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist b/sysdeps/unix/sysv/linux/s390/librt.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist
> rename to sysdeps/unix/sysv/linux/s390/librt.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libthread_db.abilist b/sysdeps/unix/sysv/linux/s390/libthread_db.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libthread_db.abilist
> rename to sysdeps/unix/sysv/linux/s390/libthread_db.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libutil.abilist b/sysdeps/unix/sysv/linux/s390/libutil.abilist
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/libutil.abilist
> rename to sysdeps/unix/sysv/linux/s390/libutil.abilist
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c b/sysdeps/unix/sysv/linux/s390/makecontext.c
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
> rename to sysdeps/unix/sysv/linux/s390/makecontext.c
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/pointer_guard.h b/sysdeps/unix/sysv/linux/s390/pointer_guard.h
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/pointer_guard.h
> rename to sysdeps/unix/sysv/linux/s390/pointer_guard.h
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Implies b/sysdeps/unix/sysv/linux/s390/s390-64/Implies
> deleted file mode 100644
> index 8d91c80097..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/Implies
> +++ /dev/null
> @@ -1 +0,0 @@
> -unix/sysv/linux/wordsize-64
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Makefile b/sysdeps/unix/sysv/linux/s390/s390-64/Makefile
> deleted file mode 100644
> index 0c338cba36..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/Makefile
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -ifeq ($(subdir),misc)
> -sysdep_headers += sys/elf.h
> -endif
> -
> -ifeq ($(subdir),elf)
> -ifeq (yes,$(build-shared))
> -# This is needed to support g++ v2 and v3.
> -sysdep_routines += framestate
> -shared-only-routines += framestate
> -endif
> -endif
> -
> -ifeq ($(subdir),stdlib)
> -sysdep_routines += __makecontext_ret
> -endif
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Versions b/sysdeps/unix/sysv/linux/s390/s390-64/Versions
> deleted file mode 100644
> index 83092db48e..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/Versions
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -libc {
> - GLIBC_2.2 {
> - # Exception handling support functions from libgcc
> - __register_frame; __register_frame_table; __deregister_frame;
> - __frame_state_for; __register_frame_info_table;
> - }
> -}
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/configure b/sysdeps/unix/sysv/linux/s390/s390-64/configure
> deleted file mode 100644
> index 5490bc669e..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/configure
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -# This file is generated from configure.ac by Autoconf. DO NOT EDIT!
> - # Local configure fragment for sysdeps/unix/sysv/linux/s390/s390-64.
> -
> -test -n "$libc_cv_slibdir" ||
> -case "$prefix" in
> -/usr | /usr/)
> - libc_cv_slibdir='/lib64'
> - libc_cv_rtlddir='/lib'
> - if test "$libdir" = '${exec_prefix}/lib'; then
> - libdir='${exec_prefix}/lib64';
> - # Locale data can be shared between 32-bit and 64-bit libraries.
> - libc_cv_complocaledir='${exec_prefix}/lib/locale'
> - fi
> - ;;
> -esac
> -
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/configure.ac b/sysdeps/unix/sysv/linux/s390/s390-64/configure.ac
> deleted file mode 100644
> index 8c75888b62..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/configure.ac
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
> -# Local configure fragment for sysdeps/unix/sysv/linux/s390/s390-64.
> -
> -LIBC_SLIBDIR_RTLDDIR([lib64], [lib])
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/dl-cache.h b/sysdeps/unix/sysv/linux/s390/s390-64/dl-cache.h
> deleted file mode 100644
> index 0a334a9d9a..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/dl-cache.h
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
> - Copyright (C) 2001-2026 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#define _DL_CACHE_DEFAULT_ID 0x403
> -
> -#define _dl_cache_check_flags(flags) \
> - ((flags) == _DL_CACHE_DEFAULT_ID)
> -
> -#include_next <dl-cache.h>
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
> deleted file mode 100644
> index 9c9e2a271f..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
> +++ /dev/null
> @@ -1,178 +0,0 @@
> -/* Assembler macros for 64 bit S/390.
> - Copyright (C) 2001-2026 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#ifndef _LINUX_S390_SYSDEP_H
> -#define _LINUX_S390_SYSDEP_H
> -
> -#include <sysdeps/s390/s390-64/sysdep.h>
> -#include <sysdeps/unix/sysdep.h>
> -#include <sysdeps/unix/sysv/linux/s390/sysdep.h>
> -#include <sysdeps/unix/sysv/linux/sysdep.h>
> -#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
> -#include <tls.h>
> -
> -/* For Linux we can use the system call table in the header file
> - /usr/include/asm/unistd.h
> - of the kernel. But these symbols do not follow the SYS_* syntax
> - so we have to redefine the `SYS_ify' macro here. */
> -/* In newer 2.1 kernels __NR_syscall is missing so we define it here. */
> -#define __NR_syscall 0
> -
> -#undef SYS_ify
> -#define SYS_ify(syscall_name) __NR_##syscall_name
> -
> -#ifdef __ASSEMBLER__
> -
> -/* Linux uses a negative return value to indicate syscall errors, unlike
> - most Unices, which use the condition codes' carry flag.
> -
> - Since version 2.1 the return value of a system call might be negative
> - even if the call succeeded. E.g., the `lseek' system call might return
> - a large offset. Therefore we must not anymore test for < 0, but test
> - for a real error by making sure the value in gpr2 is a real error
> - number. Linus said he will make sure that no syscall returns a value
> - in -1 .. -4095 as a valid result so we can safely test with -4095. */
> -
> -#undef PSEUDO
> -#define PSEUDO(name, syscall_name, args) \
> - .text; \
> - ENTRY (name) \
> - DO_CALL (syscall_name, args); \
> - lghi %r4,-4095 ; \
> - clgr %r2,%r4 ; \
> - jgnl SYSCALL_ERROR_LABEL
> -
> -#undef PSEUDO_END
> -#define PSEUDO_END(name) \
> - SYSCALL_ERROR_HANDLER; \
> - END (name)
> -
> -#undef PSEUDO_NOERRNO
> -#define PSEUDO_NOERRNO(name, syscall_name, args) \
> - .text; \
> - ENTRY (name) \
> - DO_CALL (syscall_name, args)
> -
> -#undef PSEUDO_END_NOERRNO
> -#define PSEUDO_END_NOERRNO(name) \
> - SYSCALL_ERROR_HANDLER; \
> - END (name)
> -
> -#undef PSEUDO_ERRVAL
> -#define PSEUDO_ERRVAL(name, syscall_name, args) \
> - .text; \
> - ENTRY (name) \
> - DO_CALL (syscall_name, args); \
> - lcgr %r2,%r2
> -
> -#undef PSEUDO_END_ERRVAL
> -#define PSEUDO_END_ERRVAL(name) \
> - SYSCALL_ERROR_HANDLER; \
> - END (name)
> -
> -#undef SYSCALL_ERROR_LABEL
> -#ifndef PIC
> -# undef SYSCALL_ERROR_LABEL
> -# define SYSCALL_ERROR_LABEL syscall_error
> -# define SYSCALL_ERROR_HANDLER
> -#else
> -# if RTLD_PRIVATE_ERRNO
> -# undef SYSCALL_ERROR_LABEL
> -# define SYSCALL_ERROR_LABEL 0f
> -# define SYSCALL_ERROR_HANDLER \
> -0: larl %r1,rtld_errno; \
> - lcr %r2,%r2; \
> - st %r2,0(%r1); \
> - lghi %r2,-1; \
> - br %r14
> -# elif defined _LIBC_REENTRANT
> -# if IS_IN (libc)
> -# define SYSCALL_ERROR_ERRNO __libc_errno
> -# else
> -# define SYSCALL_ERROR_ERRNO errno
> -# endif
> -# undef SYSCALL_ERROR_LABEL
> -# define SYSCALL_ERROR_LABEL 0f
> -# define SYSCALL_ERROR_HANDLER \
> -0: lcr %r0,%r2; \
> - larl %r1,SYSCALL_ERROR_ERRNO@indntpoff; \
> - lg %r1,0(%r1); \
> - ear %r2,%a0; \
> - sllg %r2,%r2,32; \
> - ear %r2,%a1; \
> - st %r0,0(%r1,%r2); \
> - lghi %r2,-1; \
> - br %r14
> -# else
> -# undef SYSCALL_ERROR_LABEL
> -# define SYSCALL_ERROR_LABEL 0f
> -# define SYSCALL_ERROR_HANDLER \
> -0: larl %r1,_GLOBAL_OFFSET_TABLE_; \
> - lg %r1,errno@GOT(%r1); \
> - lcr %r2,%r2; \
> - st %r2,0(%r1); \
> - lghi %r2,-1; \
> - br %r14
> -# endif /* _LIBC_REENTRANT */
> -#endif /* PIC */
> -
> -/* Linux takes system call arguments in registers:
> -
> - syscall number 1 call-clobbered
> - arg 1 2 call-clobbered
> - arg 2 3 call-clobbered
> - arg 3 4 call-clobbered
> - arg 4 5 call-clobbered
> - arg 5 6 call-saved
> - arg 6 7 call-saved
> -
> - (Of course a function with say 3 arguments does not have entries for
> - arguments 4 and 5.)
> - For system calls with 6 parameters a stack operation is required
> - to load the 6th parameter to register 7. Call saved register 7 is
> - moved to register 0 and back to avoid an additional stack frame.
> - */
> -
> -#define DO_CALL(syscall, args) \
> - .if args > 5; \
> - lgr %r0,%r7; \
> - lg %r7,160(%r15); \
> - .endif; \
> - lghi %r1,SYS_ify (syscall); \
> - svc 0; \
> - .if args > 5; \
> - lgr %r7,%r0; \
> - .endif
> -
> -#define ret \
> - br 14
> -
> -#define ret_NOERRNO \
> - br 14
> -
> -#define ret_ERRVAL \
> - br 14
> -
> -#else
> -
> -# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
> -# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
> -
> -#endif /* __ASSEMBLER__ */
> -
> -#endif /* _LINUX_S390_SYSDEP_H */
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/setcontext.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
> rename to sysdeps/unix/sysv/linux/s390/setcontext.S
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions b/sysdeps/unix/sysv/linux/s390/shlib-versions
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions
> rename to sysdeps/unix/sysv/linux/s390/shlib-versions
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/single-thread.h b/sysdeps/unix/sysv/linux/s390/single-thread.h
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/single-thread.h
> rename to sysdeps/unix/sysv/linux/s390/single-thread.h
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/swapcontext.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
> rename to sysdeps/unix/sysv/linux/s390/swapcontext.S
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S b/sysdeps/unix/sysv/linux/s390/syscall.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
> rename to sysdeps/unix/sysv/linux/s390/syscall.S
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall_cancel.S b/sysdeps/unix/sysv/linux/s390/syscall_cancel.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/syscall_cancel.S
> rename to sysdeps/unix/sysv/linux/s390/syscall_cancel.S
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S b/sysdeps/unix/sysv/linux/s390/sysdep.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S
> rename to sysdeps/unix/sysv/linux/s390/sysdep.S
> diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h
> index 593e70dc1e..42fb8aa469 100644
> --- a/sysdeps/unix/sysv/linux/s390/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/s390/sysdep.h
> @@ -1,5 +1,5 @@
> -/* Syscall definitions, Linux s390 version.
> - Copyright (C) 2019-2026 Free Software Foundation, Inc.
> +/* Assembler macros for 64 bit S/390.
> + Copyright (C) 2001-2026 Free Software Foundation, Inc.
> This file is part of the GNU C Library.
>
> The GNU C Library is free software; you can redistribute it and/or
> @@ -14,15 +14,163 @@
>
> You should have received a copy of the GNU Lesser General Public
> License along with the GNU C Library; if not, see
> - <http://www.gnu.org/licenses/>. */
> + <https://www.gnu.org/licenses/>. */
>
> -#ifndef __ASSEMBLY__
> +#ifndef _LINUX_S390_SYSDEP_H
> +#define _LINUX_S390_SYSDEP_H
> +
> +#include <sysdeps/s390/sysdep.h>
> +#include <sysdeps/unix/sysdep.h>
> +#include <sysdeps/unix/sysv/linux/sysdep.h>
> +#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
> +#include <tls.h>
> +
> +/* For Linux we can use the system call table in the header file
> + /usr/include/asm/unistd.h
> + of the kernel. But these symbols do not follow the SYS_* syntax
> + so we have to redefine the `SYS_ify' macro here. */
> +/* In newer 2.1 kernels __NR_syscall is missing so we define it here. */
> +#define __NR_syscall 0
>
> #undef SYS_ify
> #define SYS_ify(syscall_name) __NR_##syscall_name
>
> -#undef INTERNAL_SYSCALL_NCS
> -#define INTERNAL_SYSCALL_NCS(no, nr, args...) \
> +#ifdef __ASSEMBLER__
> +
> +/* Linux uses a negative return value to indicate syscall errors, unlike
> + most Unices, which use the condition codes' carry flag.
> +
> + Since version 2.1 the return value of a system call might be negative
> + even if the call succeeded. E.g., the `lseek' system call might return
> + a large offset. Therefore we must not anymore test for < 0, but test
> + for a real error by making sure the value in gpr2 is a real error
> + number. Linus said he will make sure that no syscall returns a value
> + in -1 .. -4095 as a valid result so we can safely test with -4095. */
> +
> +# undef PSEUDO
> +# define PSEUDO(name, syscall_name, args) \
> + .text; \
> + ENTRY (name) \
> + DO_CALL (syscall_name, args); \
> + lghi %r4,-4095 ; \
> + clgr %r2,%r4 ; \
> + jgnl SYSCALL_ERROR_LABEL
> +
> +# undef PSEUDO_END
> +# define PSEUDO_END(name) \
> + SYSCALL_ERROR_HANDLER; \
> + END (name)
> +
> +# undef PSEUDO_NOERRNO
> +# define PSEUDO_NOERRNO(name, syscall_name, args) \
> + .text; \
> + ENTRY (name) \
> + DO_CALL (syscall_name, args)
> +
> +# undef PSEUDO_END_NOERRNO
> +# define PSEUDO_END_NOERRNO(name) \
> + SYSCALL_ERROR_HANDLER; \
> + END (name)
> +
> +# undef PSEUDO_ERRVAL
> +# define PSEUDO_ERRVAL(name, syscall_name, args) \
> + .text; \
> + ENTRY (name) \
> + DO_CALL (syscall_name, args); \
> + lcgr %r2,%r2
> +
> +# undef PSEUDO_END_ERRVAL
> +# define PSEUDO_END_ERRVAL(name) \
> + SYSCALL_ERROR_HANDLER; \
> + END (name)
> +
> +# undef SYSCALL_ERROR_LABEL
> +# ifndef PIC
> +# undef SYSCALL_ERROR_LABEL
> +# define SYSCALL_ERROR_LABEL syscall_error
> +# define SYSCALL_ERROR_HANDLER
> +# else
> +# if RTLD_PRIVATE_ERRNO
> +# undef SYSCALL_ERROR_LABEL
> +# define SYSCALL_ERROR_LABEL 0f
> +# define SYSCALL_ERROR_HANDLER \
> +0: larl %r1,rtld_errno; \
> + lcr %r2,%r2; \
> + st %r2,0(%r1); \
> + lghi %r2,-1; \
> + br %r14
> +# elif defined _LIBC_REENTRANT
> +# if IS_IN (libc)
> +# define SYSCALL_ERROR_ERRNO __libc_errno
> +# else
> +# define SYSCALL_ERROR_ERRNO errno
> +# endif
> +# undef SYSCALL_ERROR_LABEL
> +# define SYSCALL_ERROR_LABEL 0f
> +# define SYSCALL_ERROR_HANDLER \
> +0: lcr %r0,%r2; \
> + larl %r1,SYSCALL_ERROR_ERRNO@indntpoff; \
> + lg %r1,0(%r1); \
> + ear %r2,%a0; \
> + sllg %r2,%r2,32; \
> + ear %r2,%a1; \
> + st %r0,0(%r1,%r2); \
> + lghi %r2,-1; \
> + br %r14
> +# else
> +# undef SYSCALL_ERROR_LABEL
> +# define SYSCALL_ERROR_LABEL 0f
> +# define SYSCALL_ERROR_HANDLER \
> +0: larl %r1,_GLOBAL_OFFSET_TABLE_; \
> + lg %r1,errno@GOT(%r1); \
> + lcr %r2,%r2; \
> + st %r2,0(%r1); \
> + lghi %r2,-1; \
> + br %r14
> +# endif /* _LIBC_REENTRANT */
> +# endif /* PIC */
> +
> +/* Linux takes system call arguments in registers:
> +
> + syscall number 1 call-clobbered
> + arg 1 2 call-clobbered
> + arg 2 3 call-clobbered
> + arg 3 4 call-clobbered
> + arg 4 5 call-clobbered
> + arg 5 6 call-saved
> + arg 6 7 call-saved
> +
> + (Of course a function with say 3 arguments does not have entries for
> + arguments 4 and 5.)
> + For system calls with 6 parameters a stack operation is required
> + to load the 6th parameter to register 7. Call saved register 7 is
> + moved to register 0 and back to avoid an additional stack frame.
> + */
> +
> +# define DO_CALL(syscall, args) \
> + .if args > 5; \
> + lgr %r0,%r7; \
> + lg %r7,160(%r15); \
> + .endif; \
> + lghi %r1,SYS_ify (syscall); \
> + svc 0; \
> + .if args > 5; \
> + lgr %r7,%r0; \
> + .endif
> +
> +# define ret \
> + br 14
> +
> +# define ret_NOERRNO \
> + br 14
> +
> +# define ret_ERRVAL \
> + br 14
> +
> +#else /* not __ASSEMBLER__ */
> +
> +# undef INTERNAL_SYSCALL_NCS
> +# define INTERNAL_SYSCALL_NCS(no, nr, args...) \
> ({ \
> DECLARGS_##nr(args) \
> register unsigned long int _nr __asm__("1") = (unsigned long int)(no); \
> @@ -34,46 +182,52 @@
> : "memory" ); \
> _ret; })
>
> -#undef INTERNAL_SYSCALL
> -#define INTERNAL_SYSCALL(name, nr, args...) \
> +# undef INTERNAL_SYSCALL
> +# define INTERNAL_SYSCALL(name, nr, args...) \
> INTERNAL_SYSCALL_NCS(__NR_##name, nr, args)
>
> -#define DECLARGS_0()
> -#define DECLARGS_1(arg1) \
> +# define DECLARGS_0()
> +# define DECLARGS_1(arg1) \
> register unsigned long int gpr2 __asm__ ("2") = (unsigned long int)(arg1);
> -#define DECLARGS_2(arg1, arg2) \
> +# define DECLARGS_2(arg1, arg2) \
> DECLARGS_1(arg1) \
> register unsigned long int gpr3 __asm__ ("3") = (unsigned long int)(arg2);
> -#define DECLARGS_3(arg1, arg2, arg3) \
> +# define DECLARGS_3(arg1, arg2, arg3) \
> DECLARGS_2(arg1, arg2) \
> register unsigned long int gpr4 __asm__ ("4") = (unsigned long int)(arg3);
> -#define DECLARGS_4(arg1, arg2, arg3, arg4) \
> +# define DECLARGS_4(arg1, arg2, arg3, arg4) \
> DECLARGS_3(arg1, arg2, arg3) \
> register unsigned long int gpr5 __asm__ ("5") = (unsigned long int)(arg4);
> -#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
> +# define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
> DECLARGS_4(arg1, arg2, arg3, arg4) \
> register unsigned long int gpr6 __asm__ ("6") = (unsigned long int)(arg5);
> -#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
> +# define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
> DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
> register unsigned long int gpr7 __asm__ ("7") = (unsigned long int)(arg6);
>
> -#define ASMFMT_0
> -#define ASMFMT_1 , "0" (gpr2)
> -#define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
> -#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
> -#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
> -#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
> -#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
> +# define ASMFMT_0
> +# define ASMFMT_1 , "0" (gpr2)
> +# define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
> +# define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
> +# define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
> +# define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
> +# define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
>
> -#define VDSO_NAME "LINUX_2.6.29"
> -#define VDSO_HASH 123718585
> +# define VDSO_NAME "LINUX_2.6.29"
> +# define VDSO_HASH 123718585
>
> /* List of system calls which are supported as vsyscalls. */
> -#define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres"
> -#define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
> -#define HAVE_GETRANDOM_VSYSCALL "__kernel_getrandom"
> -#define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
> -#define HAVE_GETCPU_VSYSCALL "__kernel_getcpu"
> -
> -#define HAVE_CLONE3_WRAPPER 1
> -#endif
> +# define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres"
> +# define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
> +# define HAVE_GETRANDOM_VSYSCALL "__kernel_getrandom"
> +# define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
> +# define HAVE_GETCPU_VSYSCALL "__kernel_getcpu"
> +
> +# define HAVE_CLONE3_WRAPPER 1
> +
> +# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
> +# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
> +
> +#endif /* __ASSEMBLER__ */
> +
> +#endif /* _LINUX_S390_SYSDEP_H */
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/timer_t_was_int_compat.h b/sysdeps/unix/sysv/linux/s390/timer_t_was_int_compat.h
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/timer_t_was_int_compat.h
> rename to sysdeps/unix/sysv/linux/s390/timer_t_was_int_compat.h
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S b/sysdeps/unix/sysv/linux/s390/vfork.S
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/s390/s390-64/vfork.S
> rename to sysdeps/unix/sysv/linux/s390/vfork.S
More information about the Libc-alpha
mailing list