Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 939551 - app-misc/resolve-march-native: generates wrong string for missing SSE4 variants (was: dev-lang/perl-5.38.2-r{3,5} failing to build with an illegal instruction error)
Summary: app-misc/resolve-march-native: generates wrong string for missing SSE4 varian...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sebastian Pipping
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-12 23:48 UTC by Alex Orange
Modified: 2024-09-20 19:45 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,74.08 KB, text/x-log)
2024-09-12 23:52 UTC, Alex Orange
Details
File that demonstrates gcc bug. (pp.i.bz2,253.83 KB, application/x-bzip2)
2024-09-13 16:22 UTC, Alex Orange
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Orange 2024-09-12 23:48:12 UTC
I have two machines with identical hardware (and therefore identical march, etc) that are failing to build both dev-lang/perl-5.38.2-r3 and dev-lang/perl-5.38.2-r5. The issue is an illegal instruction. As far as I can tell this looks like it's probably a memory corruption of some sort leading to bad ip type of bug as (if I can decode the trap messages correctly) they're pointing to locations that aren't referenced by any jmp/call instructions.

Reproducible: Always

Steps to Reproduce:
1. emerge -1av --changed-deps n =dev-lang/perl-5.38.2-r3
2.
3.
Actual Results:  
x86_64-pc-linux-gnu-gcc -c -DPERL_CORE -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -DNO_PERL_RAND_SEED -fwrapv -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -fPIC dquote.c
x86_64-pc-linux-gnu-gcc -c -DPERL_CORE -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -DNO_PERL_RAND_SEED -fwrapv -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -fPIC time64.c
x86_64-pc-linux-gnu-gcc -c -DPERL_CORE -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -DNO_PERL_RAND_SEED -fwrapv -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -fPIC miniperlmain.c
rm -f pod/perl5382delta.pod
/bin/ln -s perldelta.pod pod/perl5382delta.pod
x86_64-pc-linux-gnu-gcc -c -DPERL_CORE -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -DNO_PERL_RAND_SEED -fwrapv -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -fPIC op.c
x86_64-pc-linux-gnu-gcc -c -DPERL_CORE -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -DNO_PERL_RAND_SEED -fwrapv -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -fPIC universal.c
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o miniperl \
    opmini.o perlmini.o universalmini.o  gv.o toke.o perly.o pad.o regcomp.o regcomp_debug.o regcomp_invlist.o regcomp_study.o regcomp_trie.o regexec.o dump.o util.o mg.o reentr.o mro_core.o keywords.o builtin.o class.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o peep.o doop.o doio.o utf8.o taint.o deb.o globals.o perlio.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o caretx.o dquote.o time64.o  miniperlmain.o  -ldl -lm -lcrypt -lutil -lc 
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib -f write_buildcustomize.pl
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib autodoc.pl
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib pod/perlmodlib.PL -q
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib make_patchnum.pl
Updating 'git_version.h' and 'lib/Config_git.pl'
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib configpm
x86_64-pc-linux-gnu-gcc -c -DPERL_CORE -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -DNO_PERL_RAND_SEED -fwrapv -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -fPIC perl.c
written lib/Config.pod
updated lib/Config.pm
updated lib/Config_heavy.pl
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib make_ext.pl cpan/Archive-Tar/pm_to_blib  MAKE="make" LIBPERL_A=libperl.so.5.38.2
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib make_ext.pl dist/Attribute-Handlers/pm_to_blib  MAKE="make" LIBPERL_A=libperl.so.5.38.2
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib make_ext.pl cpan/AutoLoader/pm_to_blib  MAKE="make" LIBPERL_A=libperl.so.5.38.2
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib make_ext.pl cpan/CPAN/pm_to_blib  MAKE="make" LIBPERL_A=libperl.so.5.38.2
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib make_ext.pl cpan/CPAN-Meta/pm_to_blib  MAKE="make" LIBPERL_A=libperl.so.5.38.2
Running pm_to_blib for cpan/AutoLoader directly
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib make_ext.pl cpan/CPAN-Meta-Requirements/pm_to_blib  MAKE="make" LIBPERL_A=libperl.so.5.38.2
LD_LIBRARY_PATH=/var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2 /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/preload /var/tmp/portage/dev-lang/perl-5.38.2-r3/work/perl-5.38.2/libperl.so.5.38.2 ./miniperl -Ilib make_ext.pl cpan/CPAN-Meta-YAML/pm_to_blib  MAKE="make" LIBPERL_A=libperl.so.5.38.2
Running pm_to_blib for cpan/CPAN-Meta-Requirements directly
Unsuccessful Makefile.PL(dist/Attribute-Handlers): code=4 at make_ext.pl line 532.
make: *** [makefile:602: dist/Attribute-Handlers/pm_to_blib] Error 2
Unsuccessful Makefile.PL(cpan/Archive-Tar): code=4 at make_ext.pl line 532.
Running pm_to_blib for cpan/CPAN-Meta-YAML directly
make: *** Waiting for unfinished jobs....
make: *** [makefile:602: cpan/Archive-Tar/pm_to_blib] Error 2
Unsuccessful Makefile.PL(cpan/CPAN-Meta): code=4 at make_ext.pl line 532.
make: *** [makefile:602: cpan/CPAN-Meta/pm_to_blib] Error 2
Unsuccessful Makefile.PL(cpan/CPAN): code=4 at make_ext.pl line 532.
make: *** [makefile:602: cpan/CPAN/pm_to_blib] Error 2
make: *** [makefile:431: pod/perlintern.pod] Illegal instruction


Expected Results:  
It builds.

COMMON_FLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"

EMERGE_DEFAULT_OPTS="--autounmask=y --autounmask-backtrack=y --autounmask-keep-masks=y --backtrack=100 --changed-deps y"

Will post build.log and emerge --info, etc below.
Comment 1 Alex Orange 2024-09-12 23:49:06 UTC
emerge --info:

Portage 3.0.65 (python 3.12.3-final-0, default/linux/amd64/17.1, gcc-11, glibc-2.39-r6, 6.6.13-gentoo-x86_64 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.6.13-gentoo-x86_64-x86_64-Intel-R-_Xeon-R-_CPU_E5420_@_2.50GHz-with-glibc2.39
KiB Mem:    16386992 total,   2341316 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Thu, 12 Sep 2024 14:15:00 +0000
Head commit of repository gentoo: 492b39fac0b0c9c2ffe38bce63f20c6a9cff168d
sh bash 5.2_p26-r6
ld GNU ld (Gentoo 2.38 p4) 2.38
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26-r6::gentoo
dev-build/autoconf:        2.71-r7::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.28.5::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.4.1::gentoo
dev-lang/perl:             5.38.2-r3::gentoo
dev-lang/python:           3.10.9::gentoo, 3.11.1::gentoo, 3.12.3-r1::gentoo
dev-lang/rust:             1.79.0::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54.2::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.38-r2::gentoo, 2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             11.3.1_p20221209::gentoo, 13.3.1_p20240614::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-kernel/linux-headers:  6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.39-r6::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://192.168.80.1/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-metamanifest: no
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=y --autounmask-backtrack=y --autounmask-keep-masks=y --backtrack=100 --changed-deps y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"
GENTOO_MIRRORS="http://192.168.80.1/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j9"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl amd64 bzip2 cli crypt dri fortran gdbm iconv ipv6 libtirpc multilib ncurses nls openmp pam pcre readline seccomp split-usr ssl test-rust unicode xattr zlib" ABI_X86="64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-US" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

dev-lang/perl-5.38.2-r3::gentoo was built with the following:
USE="gdbm -berkdb -doc -minimal" ABI_X86="(64)" PERL_FEATURES="(-debug) -ithreads -quadmath"
CFLAGS="-O3 -pipe -mtune=native -march=native -fno-strict-aliasing"
CXXFLAGS="-O3 -pipe -mtune=native -march=native"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
Comment 2 Alex Orange 2024-09-12 23:50:00 UTC
# emerge -pqv --changed-deps=n '=dev-lang/perl-5.38.2-r3::gentoo'
[ebuild   R   ] dev-lang/perl-5.38.2-r3  USE="gdbm -berkdb -doc -minimal" PERL_FEATURES="(-debug) -ithreads -quadmath" 

 * IMPORTANT: 35 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
Comment 3 Alex Orange 2024-09-12 23:52:35 UTC
Created attachment 902810 [details]
build.log
Comment 4 Alex Orange 2024-09-12 23:54:34 UTC
dmesg from computer "d"

[  958.084693] traps: miniperl[13940] trap invalid opcode ip:5603e6e1c29a sp:7fffa4628e60 error:0 in miniperl[5603e6cf1000+1b2000]
[  958.088614] traps: miniperl[13950] trap invalid opcode ip:55bb9d80229a sp:7ffca170dd40 error:0 in miniperl[55bb9d6d7000+1b2000]
[  958.095944] traps: miniperl[13952] trap invalid opcode ip:563e37a9d29a sp:7ffdd38fa3a0 error:0 in miniperl[563e37972000+1b2000]
[  958.104334] traps: miniperl[13949] trap invalid opcode ip:557fd875b29a sp:7ffc2a2a9160 error:0 in miniperl[557fd8630000+1b2000]
[  958.113210] traps: miniperl[13822] trap invalid opcode ip:55f435b6a5b5 sp:7fffb7eb3150 error:0 in miniperl[55f435a3e000+1b2000]


dmesg from computer "a"

[2697869.017292] traps: miniperl[7702] trap invalid opcode ip:56447ef6bf9b sp:7ffc1c0e61a0 error:0 in miniperl[56447ee42000+1ab000]
[2697869.021804] traps: miniperl[7689] trap invalid opcode ip:562064082f9b sp:7ffcec3f0050 error:0 in miniperl[562063f59000+1ab000]
[2697869.043146] traps: miniperl[7704] trap invalid opcode ip:55a27a648f9b sp:7fff3e311e30 error:0 in miniperl[55a27a51f000+1ab000]
[2697869.048754] traps: miniperl[7696] trap invalid opcode ip:55de0e717f9b sp:7fffb2fae1a0 error:0 in miniperl[55de0e5ee000+1ab000]
[2697869.062792] traps: miniperl[7562] trap invalid opcode ip:55c02847850a sp:7ffd4acd3eb0 error:0 in miniperl[55c02834d000+1ab000]


disass of miniperl from computer "d" around 12b29a

  12b293:       0f 84 0a 07 00 00       je     12b9a3 <Perl_pp_multiconcat+0x14b3>
  12b299:       48 8b 13                mov    (%rbx),%rdx
  12b29c:       48 89 10                mov    %rdx,(%rax)
  12b29f:       48 8d 05 0a 72 28 00    lea    0x28720a(%rip),%rax        # 3b24

Furthermore, a search of the entire disassembly does not show a reference to 12b29a.

Note: these two machines use gcc-13 for "d" and gcc-11 for "a". Hence the difference in produced binaries.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-12 23:59:06 UTC
I'm away for a few days so can't look properly myself (others are encouraged to!) but please try latest 11, not one from ages ago (11 is EOL now anyway but I'm interested nonetheless if you can reproduce with even a newer version of it).

Please also select newer binutils.
Comment 6 Alex Orange 2024-09-13 00:07:53 UTC
Nevermind those disassemblies, I forgot to add in the base address. The failing area is here:

  15d29a:       66 45 0f 38 37 dc       pcmpgtq %xmm12,%xmm11

Guessing either compiler bug, or resolve-march-native bug. I'll do some more digging and see.
Comment 7 Alex Orange 2024-09-13 00:13:47 UTC
Note, I'm also having this on gcc-13.2.1_p20240113-r1 (machine "d"), I was just lazy with not pasting the second emerge --info. Pasting below in case there's any useful info from that machine.

I've traced this to the `pcmpgtq` instruction it's generating which is from SSE4.2 which my machine does not have and as far as I can tell wasn't asked for (from what I can tell core2 ends at sse3, and then I only asked for sse4 and sse4.1 beyond that).

Can a second set of eyes on my COMMON_FLAGS and/or the flags on the gcc lines just to double check I'm not missing something obvious before I go file this as a compiler bug?


Portage 3.0.65 (python 3.12.1-final-0, default/linux/amd64/17.1, gcc-13, glibc-2.38-r10, 6.6.13-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-6.6.13-gentoo-x86_64-x86_64-Intel-R-_Xeon-R-_CPU_E5420_@_2.50GHz-with-glibc2.38
KiB Mem:    16386968 total,  15446832 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Thu, 12 Sep 2024 14:15:00 +0000
Head commit of repository gentoo: 492b39fac0b0c9c2ffe38bce63f20c6a9cff168d
sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.41 p4) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-build/autoconf:        2.71-r7::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.27.9::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.5.1::gentoo
dev-lang/perl:             5.38.2-r1::gentoo
dev-lang/python:           3.11.7::gentoo, 3.12.1_p1::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.53::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.41-r3::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             13.2.1_p20240113-r1::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-kernel/linux-headers:  6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r10::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://192.168.80.1/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-max-age: 3
    sync-rsync-verify-jobs: 1

Binary Repositories:

flux-binhost
    priority: 1
    sync-uri: https://gentoo-binpkg.k8s.flux.utah.edu/dell-pe2950/ceph-osd

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=y --autounmask-backtrack=y --autounmask-keep-masks=y --backtrack=100 --changed-deps y -k"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144"
GENTOO_MIRRORS="http://192.168.80.1/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j9"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl amd64 bzip2 cli crypt dri fortran gdbm iconv ipv6 libtirpc multilib ncurses nls openmp pam pcre readline seccomp split-usr ssl test-rust unicode xattr zlib" ABI_X86="64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-US" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 9 Alex Orange 2024-09-13 00:28:02 UTC
I tracked it down to line 4277 in pp.c and this is the build command for that:

x86_64-pc-linux-gnu-gcc -c -DPERL_CORE -ggdb3 -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -DNO_PERL_RAND_SEED -fwrapv -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -ggdb3 -O3 -pipe -march=core2 -msse4 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -fno-strict-aliasing -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -Wno-use-after-free -fPIC pp.c

Again, I see no reason why gcc should think it's valid to produce SSE4.2 opcodes.
Comment 10 Alex Orange 2024-09-13 00:32:31 UTC
Ok, I'll take a crack at that tomorrow. If I understand at a high level I'll:

1. Create the .i file so I can share it more easily.
2. Try to minimize flags that generate the invalid opcode
3. Test it against the vanilla gcc master
4. If it's still an issue on vanilla gcc master, file a bug with them

For now I think I'll just use a package.env or somesuch to reduce my common flags to something more restrictive in terms of arch (like dropping the SSE4 flags) to get something to work.
Comment 11 Alex Orange 2024-09-13 16:21:19 UTC
Okay, I've minimized the bug. I'll be attaching pp.i which fails, and here's my results:

6: No sse4.1
Fail 0, pass 1: 0
7: No sse4
Fail 0, pass 1: 1



echo 6: No sse4.1
rm pp.o
x86_64-pc-linux-gnu-gcc -c -O3 -march=core2 -msse4 -std=c99 pp.i 2> /dev/null
objdump -d pp.o | grep pcmpgtq > /dev/null
echo Fail 0, pass 1: $?

echo 7: No sse4
rm pp.o
x86_64-pc-linux-gnu-gcc -c -O3 -march=core2 -std=c99 pp.i 2> /dev/null
objdump -d pp.o | grep pcmpgtq > /dev/null
echo Fail 0, pass 1: $?



So it appears that -msse4 is adding in some SSE4.2 instructions. Also worth noting, going to -O2 instead of -O3 also makes the bug go away. The GCC_ICE_reporting_guide asks that a create a bug against toolchain@gentoo.org. Should I create a new bug, or just keep on with this one?



$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/13/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-13.3.1_p20240614/work/gcc-13-20240614/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/13 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/13/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/13 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/13/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/13/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/13/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 13.3.1_p20240614 p17' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --with-isl --disable-isl-version-check --enable-default-pie --enable-default-ssp --disable-fixincludes --with-build-config=bootstrap-O3
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.3.1 20240614 (Gentoo 13.3.1_p20240614 p17)
Comment 12 Alex Orange 2024-09-13 16:22:09 UTC
Created attachment 902913 [details]
File that demonstrates gcc bug.
Comment 13 Alex Orange 2024-09-13 16:27:53 UTC
And finding the exact flag that causes an issue.

8: O2 add some flags
Fail 0, pass 1: 0
9: O2 clean
Fail 0, pass 1: 1



echo 8: O2 add some flags
rm pp.o
x86_64-pc-linux-gnu-gcc -c -O2 -march=core2 -msse4 -std=c99 -fvect-cost-model=dynamic pp.i 2> /dev/null
objdump -d pp.o | grep pcmpgtq > /dev/null
echo Fail 0, pass 1: $?

echo 9: O2 clean
rm pp.o
x86_64-pc-linux-gnu-gcc -c -O2 -march=core2 -msse4 -std=c99 pp.i 2> /dev/null
objdump -d pp.o | grep pcmpgtq > /dev/null
echo Fail 0, pass 1: $?
Comment 14 Alex Orange 2024-09-13 16:54:15 UTC
cvise'd fail code:

PL_op_0;
*Perl_pp_fc_send_s;
Perl_pp_fc_send() {
  char *d;
  for (; Perl_pp_fc_send_s < Perl_pp_fc_send; d++, Perl_pp_fc_send_s++)
    *d = Perl_pp_fc_send_s <= 'A';
  return PL_op_0;
}


I'll be filing a bug to gcc shortly.
Comment 15 Alex Orange 2024-09-13 19:02:00 UTC
Ok, so it turns out this is a bug in resolve-march-native. Apparently -msse4 means pull in all sse4 kinds (sse4a, sse4.1, sse4.2). I'd forgotten to actually try -march=native on gcc, and that does actually produce valid code. Try to figure out the logic that resolve-... uses to come up with the flags it gives you so I can file a bug report on that (and perhaps provide a patch).
Comment 16 Alex Orange 2024-09-16 16:10:02 UTC
Here's the two relevant other bugs here:

Request for better documentation of -msse4/-mno-sse4 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116708
Bug report for resolve-march-native https://github.com/hartwork/resolve-march-native/issues/177

For now I'm just manually removing -msse4 and rebuilding all my binpkgs.
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-17 23:15:55 UTC
Thanks. Not a Perl bug then and not sure we can do much else on our side.
Comment 18 Larry the Git Cow gentoo-dev 2024-09-20 19:45:08 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9c2f46e265766151302d139c4e86d79eecb030d

commit b9c2f46e265766151302d139c4e86d79eecb030d
Author:     Sebastian Pipping <sping@gentoo.org>
AuthorDate: 2024-09-20 19:43:44 +0000
Commit:     Sebastian Pipping <sping@gentoo.org>
CommitDate: 2024-09-20 19:44:09 +0000

    app-misc/resolve-march-native: 5.1.0 with SSE4 fixes
    
    Bug: https://bugs.gentoo.org/939551
    Signed-off-by: Sebastian Pipping <sping@gentoo.org>

 app-misc/resolve-march-native/Manifest              |  1 +
 .../resolve-march-native-5.1.0.ebuild               | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)