[PATCH 4/5] s390: Move files out of s390-64 folders

Stefan Liebler stli@linux.ibm.com
Fri Apr 17 12:12:03 GMT 2026


On 4/16/26 17:02, Adhemerval Zanella Netto wrote:
> 
> 
> On 16/04/26 11:52, Stefan Liebler wrote:
>> On 4/15/26 21:39, Adhemerval Zanella Netto wrote:
>>>
>>>
>>> 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.
>>>
>> SNIP...
>>>> 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?
>> Good question. It seems it originally comes from sysdeps/i386/Makefile
>> where it is still available.I've also found:
>> sysdeps/m68k/Makefile:44:CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused
>>
>> At least with a single build of gcc 15, I don't need it (also not on
>> 31bit). I have to dig deeper in the history why it was added in the past
>> and do some more tests.
>>
>> As this is a change to s390-64, I would prefer to investigate first and
>> create a patch independent of the s390-32 removal.
>>
>> SNIP...
>>>> 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?
>>>
>> For binutils-bfd all required patches are included in binutils 2.39.
>>
>> From my tests in the past:
>> lld had also generated TPOFF relocations, which was fixed with llvm 19
>> and I think it was backported to llvm 18 release branch:
>> "[lld/ELF] Avoid unnecessary TPOFF relocations in GOT for -pie (#81739)"
>> https://github.com/llvm/llvm-project/commit/6f907733e65d24edad65f763fb14402464bd578b
>>
>> But I have to dig deeper in recent lld versions. It seems as static-pie
>> is disabled. At least when building with llvm 21, config.h claims:
>> /* Define if static PIE is supported.  */
>> /* #undef SUPPORT_STATIC_PIE */
>>
>> For gold, there is the bug:
>> "Bug 22221 - add --no-dynamic-linker option"
>> https://sourceware.org/bugzilla/show_bug.cgi?id=22221
>>
>> Thus I would leave the test as is for now.
>>
>>
>>
>>
>>
>> Thanks for the two points. I have to check further. But as mentioned I
>> would prefer to leave it as is for the s390-32 removal and do some
>> follow-up work.
>> Is this okay for you?
> 
> Sound good, thanks.
> 
Then I will commit the series next week. Do you also want to add a
"reviewed by" line for this patch as done by the other ones?
For me your "Patch looks good" is also fine.

Thanks,
Stefan


More information about the Libc-alpha mailing list