Initially reported downstream in Gentoo at https://bugs.gentoo.org/933764. We found that our release media ("stage3" builds - tarballs of a rootfs) couldn't be chrooted into on x86 (32-bit) systems without SSE2. e.g. using https://distfiles.gentoo.org/releases/x86/autobuilds/current-stage3-i686-openrc/stage3-i686-openrc-20240603T164904Z.tar.xz: ``` $ chroot /mnt/gentoo /usr/lib/libc.so.6: CPU ISA level is lower than required ``` Upon further investigation, it looks like this got exposed by 46c999741340ea559784c20a45077955b50aca43 for PR31676, which also got backported for 2.39. I _think_ what's happening here is that libc_cv_have_x86_isa_level gets set to 'baseline' for both 32-bit and 64-bit (even with -march=i686 on a pure, non-multilib i686-* setup) and then the ISA marker gets added.
In sysdeps/x86/isa-level.h, we correctly do: ``` #if defined __SSE__ && defined __SSE2__ /* NB: ISAs, excluding MMX, in x86-64 ISA level baseline are used. */ # define __X86_ISA_V1 1 #else # define __X86_ISA_V1 0 #endif ``` But when we run the configure test, we do... ``` cat > conftest.c <<EOF #include <sysdeps/x86/isa-level.h> #if MINIMUM_X86_ISA_LEVEL >= 4 libc_cv_have_x86_isa_level=4 #elif MINIMUM_X86_ISA_LEVEL == 3 libc_cv_have_x86_isa_level=3 #elif MINIMUM_X86_ISA_LEVEL == 2 libc_cv_have_x86_isa_level=2 #else libc_cv_have_x86_isa_level=baseline #endif EOF ``` On a CPU without SSE2, we will get 'baseline', and then... ``` if test $libc_cv_have_x86_isa_level = baseline; then AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, 1) else AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, $libc_cv_have_x86_isa_level) fi ``` We set MINIMUM_X86_ISA_LEVEL to 1, not 0, which seems wrong.
I still see the v3 marker appearing unexpectedly, so investigating more.
(In reply to Sam James from comment #2) > I still see the v3 marker appearing unexpectedly, so investigating more. (Is there a way to get bfd to print why it's adding a marker? e.g. inherited from X obj)
(In reply to Sam James from comment #2) > I still see the v3 marker appearing unexpectedly, so investigating more. I think ignore the v3 thing. This appears to be a separate issue. (In reply to Sam James from comment #3) > (In reply to Sam James from comment #2) > > I still see the v3 marker appearing unexpectedly, so investigating more. > > (Is there a way to get bfd to print why it's adding a marker? e.g. inherited > from X obj) I'll file a bfd bug for discussion. -- Patch posted by awilfox: https://inbox.sourceware.org/libc-alpha/20240609133933.62366-1-AWilcox@Wilcox-Tech.com/T/#u
Created attachment 15573 [details] A patch Please try this.
(In reply to Sam James from comment #4) > > Patch posted by awilfox: > https://inbox.sourceware.org/libc-alpha/20240609133933.62366-1- > AWilcox@Wilcox-Tech.com/T/#u This is wrong since the minimum ISA level for x86-64 is 1, not 0.
(In reply to H.J. Lu from comment #5) > Created attachment 15573 [details] > A patch > > Please try this. This works. Thanks! Tested-by: Ian Jordan <immoloism@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=09bc68b0ac26331a0109f0578c9368e09176da18 commit 09bc68b0ac26331a0109f0578c9368e09176da18 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Jun 10 13:02:06 2024 -0700 x86: Properly set MINIMUM_X86_ISA_LEVEL for i386 [BZ #31867] On i386, set the default minimum ISA level to 0, not 1 (baseline which includes SSE2). There are no changes in config.h nor in config.make on x86-64. This fixes BZ #31867. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Tested-by: Ian Jordan <immoloism@gmail.com> Reviewed-by: Sam James <sam@gentoo.org> Reviewed-by: Florian Weimer <fweimer@redhat.com>
The release/2.39/master branch has been updated by Sam James <sjames@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b7f5b0a7114e29577daf64e68970673b61e5fcba commit b7f5b0a7114e29577daf64e68970673b61e5fcba Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Jun 10 13:02:06 2024 -0700 x86: Properly set MINIMUM_X86_ISA_LEVEL for i386 [BZ #31867] On i386, set the default minimum ISA level to 0, not 1 (baseline which includes SSE2). There are no changes in config.h nor in config.make on x86-64. This fixes BZ #31867. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Tested-by: Ian Jordan <immoloism@gmail.com> Reviewed-by: Sam James <sam@gentoo.org> Reviewed-by: Florian Weimer <fweimer@redhat.com> (cherry picked from commit 09bc68b0ac26331a0109f0578c9368e09176da18)