This is a clone of https://bugs.gentoo.org/920899 Observed during 32bit s390 stage build (but the code has not really changed, so maybe a gcc-13 update is at fault?): s390-ibm-linux-gnu-gcc -pipe -O2 -Wl,-O1 -Wl,--as-needed ../sysdeps/s390/strchrnul-c.c -c -std=gnu11 -fgnu89-inline -pipe -O2 -Wall -Wwrite-strings -Wundef -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wstrict-prototypes -Wold-style-definition -fmath-errno -mlong-double-128 -fPIC -ftls-model=initial-exec -I../include -I/var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string -I/var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl -I../sysdeps/unix/sysv/linux/s390/s390-32 -I../sysdeps/unix/sysv/linux/s390/fpu -I../sysdeps/s390/fpu -I../sysdeps/unix/sysv/linux/s390 -I../sysdeps/s390/nptl -I../sysdeps/ieee754/ldbl-64-128 -I../sysdeps/ieee754/ldbl-opt -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/s390/s390-32 -I../sysdeps/wordsize-32 -I../sysdeps/s390 -I../sysdeps/ieee754/ldbl-128 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/s390-ibm-linux-gnu/13/include -isystem /usr/lib/gcc/s390-ibm-linux-gnu/13/include-fixed -isystem /usr/include -D_LIBC_REENTRANT -include /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -o /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string/strchrnul-c.os -MD -MP -MF /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string/strchrnul-c.os.dt -MT /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string/strchrnul-c.os s390-ibm-linux-gnu-gcc -pipe -O2 -Wl,-O1 -Wl,--as-needed ../sysdeps/s390/strrchr-vx.S -c -I../include -I/var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string -I/var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl -I../sysdeps/unix/sysv/linux/s390/s390-32 -I../sysdeps/unix/sysv/linux/s390/fpu -I../sysdeps/s390/fpu -I../sysdeps/unix/sysv/linux/s390 -I../sysdeps/s390/nptl -I../sysdeps/ieee754/ldbl-64-128 -I../sysdeps/ieee754/ldbl-opt -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/s390/s390-32 -I../sysdeps/wordsize-32 -I../sysdeps/s390 -I../sysdeps/ieee754/ldbl-128 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/s390-ibm-linux-gnu/13/include -isystem /usr/lib/gcc/s390-ibm-linux-gnu/13/include-fixed -isystem /usr/include -D_LIBC_REENTRANT -include /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -DASSEMBLER -Werror=undef -Wa,--noexecstack -Werror=undef -Wa,--noexecstack -o /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string/strrchr-vx.os -MD -MP -MF /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string/strrchr-vx.os.dt -MT /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string/strrchr-vx.os In file included from <command-line>: ../sysdeps/s390/strchrnul-c.c:28:49: error: ‘__strchrnul_c’ undeclared here (not in a function); did you mean ‘__strchrnul’? 28 | __hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); | ^~~~~~~~~~~~~ ./../include/libc-symbols.h:470:27: note: in definition of macro ‘__hidden_ver2’ 470 | extern thread __typeof (name) __EI_##name \ | ^~~~ ../sysdeps/s390/strchrnul-c.c:28:1: note: in expansion of macro ‘__hidden_ver1’ 28 | __hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); | ^~~~~~~~~~~~~ ./../include/libc-symbols.h:472:33: error: ‘__EI___strchrnul_c’ aliased to undefined symbol ‘__strchrnul_c’ 472 | extern thread __typeof (name) __EI_##name \ | ^~~~~ ./../include/libc-symbols.h:468:3: note: in expansion of macro ‘__hidden_ver2’ 468 | __hidden_ver2 (, local, internal, name) | ^~~~~~~~~~~~~ ../sysdeps/s390/strchrnul-c.c:28:1: note: in expansion of macro ‘__hidden_ver1’ 28 | __hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); | ^~~~~~~~~~~~~ make[2]: *** [/var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/sysd-rules:603: /var/tmp/portage/sys-libs/glibc-2.38-r8/work/build-s390-s390-ibm-linux-gnu-nptl/string/strchrnul-c.os] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory '/var/tmp/portage/sys-libs/glibc-2.38-r8/work/glibc-2.38/string' make[1]: *** [Makefile:485: string/subdir_lib] Error 2 make[1]: Leaving directory '/var/tmp/portage/sys-libs/glibc-2.38-r8/work/glibc-2.38' make: *** [Makefile:9: all] Error 2
I tried with 2.38 release branch (27339a3eb8f987eebae72b854af80256c1588ebd) with gcc 13 (e6ade7fb8a8595d7c5c2520c8ed497dbbe37ab3f) with the options that you seems to be using (--enable-stack-protector=no --enable-fortify-source=3) and I can't reproduce it. Any idea on how to easily reproduce it?
I've also tried with 2.38 release branch (cfe121910013a46e2477562282c56ae8062089aa) with gcc 13 (5d0d592c486c31bd9c26af0d1f0a7b6a3d68c22b) and I don't get a build fail. If you manually run the gcc-compile-command producing strchrnul-c.os in <glibc-src>/string/ with -save-temps, the strchrnul-c.i file should have included <glibc-src>/string/strchrnul.c with __strchrnul_c instead of __strchrnul. Then the internal symbol __GI___strchrnul should be __strchrnul_c (See your error-message from <glibc-src>/sysdeps/s390/strchrnul-c.c). The weak_alias should be the IFUNC __strchrnul (See <glibc-src>/sysdeps/s390/strchrnul.c)
Sorry I am juggling a bit too many balls at the same time right now. Since it's gentoo specific (apparently) it's not so urgent. => later Not forgetting about this though (it makes our s390 stages fail).
So, after a lot of trying I found the culprit: --disable-multi-arch Without that, all builds fine. With that, I get the same failure with current master. gcc version 13.2.1 20231216 (Gentoo 13.2.1_p20231216 p11) GNU assembler version 2.41.0 (s390-ibm-linux-gnu) using BFD version (Gentoo 2.41 p4) 2.41.0 Linux lgentoo3 6.0.9-gentoo #1 SMP Thu Nov 24 15:51:23 EST 2022 s390 8561 IBM GNU/Linux master at ae49a7b29acc184b03c2a6bd6ac01b5e08efd54f ../glibc/configure --prefix=/usr --enable-fortify-source --disable-multi-arch [...] gcc ../sysdeps/s390/strchrnul-vx.S -c -I../include -I/home/dilfridge/Gentoo/misc/glibc-build/string -I/home/dilfridge/Gentoo/misc/glibc-build -I../sysdeps/unix/sysv/linux/s390/s390-32 -I../sysdeps/unix/sysv/linux/s390/fpu -I../sysdeps/s390/fpu -I../sysdeps/unix/sysv/linux/s390 -I../sysdeps/s390/nptl -I../sysdeps/ieee754/ldbl-64-128 -I../sysdeps/ieee754/ldbl-opt -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/s390/s390-32 -I../sysdeps/wordsize-32 -I../sysdeps/s390 -I../sysdeps/ieee754/ldbl-128 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/dilfridge/Gentoo/misc/glibc-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -DASSEMBLER -g -Werror=undef -Wa,--noexecstack -o /home/dilfridge/Gentoo/misc/glibc-build/string/strchrnul-vx.os -MD -MP -MF /home/dilfridge/Gentoo/misc/glibc-build/string/strchrnul-vx.os.dt -MT /home/dilfridge/Gentoo/misc/glibc-build/string/strchrnul-vx.os gcc ../sysdeps/s390/strchrnul-c.c -c -std=gnu11 -fgnu89-inline -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wstrict-prototypes -Wold-style-definition -fmath-errno -mlong-double-128 -fPIC -ftls-model=initial-exec -I../include -I/home/dilfridge/Gentoo/misc/glibc-build/string -I/home/dilfridge/Gentoo/misc/glibc-build -I../sysdeps/unix/sysv/linux/s390/s390-32 -I../sysdeps/unix/sysv/linux/s390/fpu -I../sysdeps/s390/fpu -I../sysdeps/unix/sysv/linux/s390 -I../sysdeps/s390/nptl -I../sysdeps/ieee754/ldbl-64-128 -I../sysdeps/ieee754/ldbl-opt -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/s390/s390-32 -I../sysdeps/wordsize-32 -I../sysdeps/s390 -I../sysdeps/ieee754/ldbl-128 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/dilfridge/Gentoo/misc/glibc-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -o /home/dilfridge/Gentoo/misc/glibc-build/string/strchrnul-c.os -MD -MP -MF /home/dilfridge/Gentoo/misc/glibc-build/string/strchrnul-c.os.dt -MT /home/dilfridge/Gentoo/misc/glibc-build/string/strchrnul-c.os gcc ../sysdeps/s390/strrchr-vx.S -c -I../include -I/home/dilfridge/Gentoo/misc/glibc-build/string -I/home/dilfridge/Gentoo/misc/glibc-build -I../sysdeps/unix/sysv/linux/s390/s390-32 -I../sysdeps/unix/sysv/linux/s390/fpu -I../sysdeps/s390/fpu -I../sysdeps/unix/sysv/linux/s390 -I../sysdeps/s390/nptl -I../sysdeps/ieee754/ldbl-64-128 -I../sysdeps/ieee754/ldbl-opt -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/s390/s390-32 -I../sysdeps/wordsize-32 -I../sysdeps/s390 -I../sysdeps/ieee754/ldbl-128 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/dilfridge/Gentoo/misc/glibc-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -DASSEMBLER -g -Werror=undef -Wa,--noexecstack -o /home/dilfridge/Gentoo/misc/glibc-build/string/strrchr-vx.os -MD -MP -MF /home/dilfridge/Gentoo/misc/glibc-build/string/strrchr-vx.os.dt -MT /home/dilfridge/Gentoo/misc/glibc-build/string/strrchr-vx.os In file included from <command-line>: ../sysdeps/s390/strchrnul-c.c:28:49: error: ‘__strchrnul_c’ undeclared here (not in a function); did you mean ‘__strchrnul’? 28 | __hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); | ^~~~~~~~~~~~~ ./../include/libc-symbols.h:470:27: note: in definition of macro ‘__hidden_ver2’ 470 | extern thread __typeof (name) __EI_##name \ | ^~~~ ../sysdeps/s390/strchrnul-c.c:28:1: note: in expansion of macro ‘__hidden_ver1’ 28 | __hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); | ^~~~~~~~~~~~~ ./../include/libc-symbols.h:472:33: error: ‘__EI___strchrnul_c’ aliased to undefined symbol ‘__strchrnul_c’ 472 | extern thread __typeof (name) __EI_##name \ | ^~~~~ ./../include/libc-symbols.h:468:3: note: in expansion of macro ‘__hidden_ver2’ 468 | __hidden_ver2 (, local, internal, name) | ^~~~~~~~~~~~~ ../sysdeps/s390/strchrnul-c.c:28:1: note: in expansion of macro ‘__hidden_ver1’ 28 | __hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); | ^~~~~~~~~~~~~ make[2]: *** [/home/dilfridge/Gentoo/misc/glibc-build/sysd-rules:603: /home/dilfridge/Gentoo/misc/glibc-build/string/strchrnul-c.os] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory '/home/dilfridge/Gentoo/misc/glibc/string' make[1]: *** [Makefile:484: string/subdir_lib] Error 2 make[1]: Leaving directory '/home/dilfridge/Gentoo/misc/glibc' make: *** [Makefile:9: all] Error 2
The recent s390 string refactor assumed multiarch/ifunc support as default and organized the internal code without placing the ifunc selector/variants only on multiarch folder. This is to allow the avoid ifunc and some string variants depending of the default compiler optimization (so if you target glibc to a z13, there is no need to provide old z900 variants and glibc internally can assume the z13 variants as default). I am not very found of this s390-specific organization, it differs from other ports where there is no need to extra internal checks to see if you are building with multiarch support (USE_MULTIARCH). The following patch should fix s390 and s390x, but I think it would be better to make s390 follow current practice of putting ifunc support only at multiarch folders. diff --git a/sysdeps/s390/memrchr-c.c b/sysdeps/s390/memrchr-c.c index bdf3c7bbe0..3cb27b795d 100644 --- a/sysdeps/s390/memrchr-c.c +++ b/sysdeps/s390/memrchr-c.c @@ -25,7 +25,7 @@ # include <string/memrchr.c> -# if defined SHARED && IS_IN (libc) +# if defined SHARED && IS_IN (libc) && defined USE_MULTIARCH __hidden_ver1 (__memrchr_c, __GI___memrchr, __memrchr_c); # endif #endif diff --git a/sysdeps/s390/strchrnul-c.c b/sysdeps/s390/strchrnul-c.c index f6f5bae311..cee0e1a89e 100644 --- a/sysdeps/s390/strchrnul-c.c +++ b/sysdeps/s390/strchrnul-c.c @@ -24,7 +24,7 @@ # endif # include <string/strchrnul.c> -# if defined SHARED && IS_IN (libc) +# if defined SHARED && IS_IN (libc) && defined USE_MULTIARCH __hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); # endif #endif
STRCHRNUL is defined before including string/strchrnul.c if HAVE_STRCHRNUL_IFUNC is not zero. Thus the hidden symbol should also depend on HAVE_STRCHRNUL_IFUNC instead of USE_MULTIARCH. I will take care of it
We have a few --disable-multi-arch variants in build-many-glibcs.py, I guess some should be added for s390 as well.
I've just posted this patch: [PATCH] S390: Fix building with --disable-mutli-arch [BZ #31196] https://sourceware.org/pipermail/libc-alpha/2024-January/154321.html Sure, I can also add some --disable-mutli-arch tests in build-many-glibcs.py. I will post a separate patch.
Andreas has just committed my patch to be within glibc 2.39 release: "S390: Fix building with --disable-mutli-arch [BZ #31196]" https://sourceware.org/git/?p=glibc.git;a=commit;h=cc1b91eabd806057aa7e3058a84bf129ed36e157 I will cherry-pick it to glibc 2.38 branch. Once done, I close this bug. @Andreas Huettel: Is gentoo following the release-branches or do you pick the commit up by yourself? FYI: I've also posted this patch: [PATCH] build-many-glibcs.py: Add s390 --disable-multi-arch / multi-arch configurations. https://sourceware.org/pipermail/libc-alpha/2024-January/154342.html
(In reply to Stefan Liebler from comment #9) > Andreas has just committed my patch to be within glibc 2.39 release: > "S390: Fix building with --disable-mutli-arch [BZ #31196]" > https://sourceware.org/git/?p=glibc.git;a=commit; > h=cc1b91eabd806057aa7e3058a84bf129ed36e157 > > I will cherry-pick it to glibc 2.38 branch. Once done, I close this bug. > @Andreas Huettel: Is gentoo following the release-branches or do you pick > the commit up by yourself? > > FYI: I've also posted this patch: > [PATCH] build-many-glibcs.py: Add s390 --disable-multi-arch / multi-arch > configurations. > https://sourceware.org/pipermail/libc-alpha/2024-January/154342.html Gentoo is following the release branches, I'll pick the branch up for the next revision. Thank you! (And sorry, I knew somewhere but at the moment completely forgot about the typo...)
Also pushed it to release/2.38/master: "S390: Fix building with --disable-mutli-arch [BZ #31196]" https://sourceware.org/git/?p=glibc.git;a=commit;h=18876c9ff52c3d9aefe2c663b1a287589bebedc0