dev-libs/libffi-3.4.6-r2 failing to pass tests when compiled under Clang/systemd system profile Continues to fail at same point with no LTO, and with common <LDFLAGS="${LDFLAGS} -Wl,-undefined-version"> workaround; tests passing when compiled with GCC: MARCH_FLAGS="-march=native" COMMON_FLAGS="${MARCH_FLAGS} -O2 -pipe -fuse-ld=bfd" CFLAGS="${COMMON_FLAGS}" CXXFLAGS="${COMMON_FLAGS}" FCFLAGS="${COMMON_FLAGS}" FFLAGS="${COMMON_FLAGS}" CC=gcc CXX=g++ Reproducible: Always Steps to Reproduce: 1. FEATURES=test; CLANG/systemd profile 2. Compile dev-libs/libffi 3. Actual Results: Running /var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/libffi.bhaible/bhaible.exp ... FAIL: libffi.bhaible/test-call.c -W -Wall -DDGTEST=20 -Wno-unused-variable -Wno-unused-parameter -Wno-uninitialized -O2 execution test Running /var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/libffi.call/call.exp ... FAIL: libffi.call/promotion.c -W -Wall -O2 execution test Portage 3.0.66.1 (python 3.12.8-final-0, default/linux/amd64/23.0/llvm/systemd, gcc-14, glibc-2.40-r8, 6.6.67-gentoo-dist x86_64) ================================================================= System uname: Linux-6.6.67-gentoo-dist-x86_64-Intel-R-_Core-TM-_i5-4570T_CPU_@_2.90GHz-with-glibc2.40 KiB Mem: 8014864 total, 2835384 free KiB Swap: 12582908 total, 12582896 free Timestamp of repository gentoo: Wed, 29 Jan 2025 22:30:00 +0000 Head commit of repository gentoo: 4d481ef1b25ffa1869427d75fe30818f14e53a22 Timestamp of repository dlang: Tue, 28 Jan 2025 07:36:33 +0000 Head commit of repository dlang: 79c6b225a97054abfcda7306a0809f5939da7574 sh bash 5.2_p37 ld GNU ld (Gentoo 2.43 p3) 2.43.1 app-misc/pax-utils: 1.3.8::gentoo app-shells/bash: 5.2_p37::gentoo dev-build/autoconf: 2.13-r8::gentoo, 2.72-r1::gentoo dev-build/automake: 1.16.5-r2::gentoo dev-build/cmake: 3.30.6::gentoo dev-build/libtool: 2.5.4::gentoo dev-build/make: 4.4.1-r100::gentoo dev-build/meson: 1.6.1::gentoo dev-java/java-config: 2.3.4::gentoo dev-lang/perl: 5.40.0-r1::gentoo dev-lang/python: 3.12.8_p1::gentoo, 3.13.1_p1::gentoo dev-lang/rust-bin: 1.81.0-r101::gentoo, 1.83.0::gentoo llvm-core/clang: 18.1.8-r6::gentoo, 19.1.4::gentoo llvm-core/lld: 18.1.8::gentoo, 19.1.4::gentoo llvm-core/llvm: 18.1.8-r6::gentoo, 19.1.4::gentoo sys-apps/baselayout: 2.17::gentoo sys-apps/sandbox: 2.39::gentoo sys-apps/systemd: 256.10::gentoo sys-devel/binutils: 2.43-r2::gentoo sys-devel/binutils-config: 5.5.2::gentoo sys-devel/gcc: 14.2.1_p20241221::gentoo sys-devel/gcc-config: 2.12.1::gentoo sys-kernel/linux-headers: 6.6-r1::gentoo (virtual/os-headers) sys-libs/glibc: 2.40-r8::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: False sync-rsync-verify-metamanifest: yes sync-rsync-extra-opts: sync-rsync-verify-jobs: 1 sync-rsync-verify-max-age: 3 dlang location: /var/db/repos/dlang sync-type: git sync-uri: https://github.com/gentoo-mirror/dlang.git masters: gentoo volatile: False local location: /var/db/repos/local masters: gentoo volatile: False Binary Repositories: gentoobinhost priority: 1 sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64_llvm ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE" ADDR2LINE="llvm-addr2line" AR="llvm-ar" AS="clang -c" CBUILD="x86_64-pc-linux-gnu" CC="clang" CFLAGS="-march=native -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d" CPP="clang-cpp" CXX="clang++" CXXFLAGS="-march=native -O2 -pipe" DISTDIR="/var/cache/distfiles" 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="-march=native -O2 -pipe" 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="-march=native -O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_AU.utf8" LD="ld.lld" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs" LEX="flex" NM="llvm-nm" OBJCOPY="llvm-objcopy" OBJDUMP="llvm-objdump" 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" RANLIB="llvm-ranlib" READELF="llvm-readelf" RUSTFLAGS=" -C target-cpu=native -Clinker-plugin-lto" SHELL="/bin/bash" STRINGS="llvm-strings" STRIP="llvm-strip" USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cet clang colord crypt cups dbus dist-kernel dracut dri dts dvd dvdr eds encode evo exif flac fuse gdbm gdk-pixbuf gif gnome gnome-keyring gnome-online-accounts gnome-shell google gpm gstreamer gtk gui iconv icu introspection ios ipv6 jpeg keyring kf6compat lcms libnotify libtirpc llvm-libunwind lto mad mng mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qml qt5 qt6 readline sdl seccomp sound spell ssl startup-notification svg systemd test-rust tiff tracker truetype udev udisks unicode upower usb vorbis vulkan wayland wxwidgets x264 xattr xcb xft xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gcc_13" 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 aes avx avx2 f16c fma3 pclmul popcnt rdrand sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax 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" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PERL_FEATURES="ithreads" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="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: ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, SIZE, YACC, YFLAGS
Please include the full build.log. The log files for the tests themselves would be appreciated too.
Created attachment 917894 [details] build.log
Created attachment 917895 [details] Test logs
From what I can see from the logs the relevant sections would be: PASS: libffi.call/promotion.c -W -Wall -O0 execution test Executing on host: clang /var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/libffi.call/promotion.c -W -Wall -O2 -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include/.. -L/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs -lffi -lm -o ./promotion.exe (timeout = 300) spawn -ignore SIGHUP clang /var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/libffi.call/promotion.c -W -Wall -O2 -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include/.. -L/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs -lffi -lm -o ./promotion.exe PASS: libffi.call/promotion.c -W -Wall -O2 (test for excess errors) Setting LD_LIBRARY_PATH to :/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs:/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs::/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs:/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs Execution timeout is: 300 spawn [open ...] FAIL: libffi.call/promotion.c -W -Wall -O2 execution test When running: "clang /var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/libffi.call/promotion.c -W -Wall -O2 -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include/.. -L/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs -lffi -lm -o ./promotion.exe" and executing result: Check failed: (int)rint == (signed char) sc + (signed short) ss + (unsigned char) uc + (unsigned short) us Aborted (core dumped) ----------------------------- Executing on host: clang /var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/libffi.bhaible/test-call.c -W -Wall -DDGTEST=20 -Wno-unused-variable -Wno-unused-parameter -Wno-uninitialized -O2 -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include/.. -L/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs -lffi -lm -o ./test-call.exe (timeout = 300) spawn -ignore SIGHUP clang /var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/libffi.bhaible/test-call.c -W -Wall -DDGTEST=20 -Wno-unused-variable -Wno-unused-parameter -Wno-uninitialized -O2 -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include/.. -L/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs -lffi -lm -o ./test-call.exe PASS: libffi.bhaible/test-call.c -W -Wall -DDGTEST=20 -Wno-unused-variable -Wno-unused-parameter -Wno-uninitialized -O2 (test for excess errors) Setting LD_LIBRARY_PATH to :/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs::/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs Execution timeout is: 300 spawn [open ...] uchar f(uchar,ushort,uint,ulong):(97,2,3,4)->255 uchar f(uchar,ushort,uint,ulong):(4286611297,196610,3,4)->255 FAIL: libffi.bhaible/test-call.c -W -Wall -DDGTEST=20 -Wno-unused-variable -Wno-unused-parameter -Wno-uninitialized -O2 execution test When running: "lang /var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/libffi.bhaible/test-call.c -W -Wall -DDGTEST=20 -Wno-unused-variable -Wno-unused-parameter -Wno-uninitialized -O2 -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6/testsuite/../include -I/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../include/.. -L/var/tmp/portage/dev-libs/libffi-3.4.6-r2/work/libffi-3.4.6-abi_x86_64.amd64/testsuite/../.libs -lffi -lm -o ./test-call.exe" and executing result: uchar f(uchar,ushort,uint,ulong):(97,2,3,4)->255 uchar f(uchar,ushort,uint,ulong):(4286611297,196610,3,4)->255 Aborted (core dumped)
Created attachment 918169 [details] no patches passing tests Same failure for me. Interestingly, one of the Gentoo patches is breaking the test on Clang. I tried a custom ebuild with the patches section commented out and the test passed fine. Tests pass without the emake -Onone as well. Including a build log. I'll try to narrow down to which patch in the meantime.
Thanks. I've just got home from travel so bear with me as I rest and then spin up again. Can you also try 9999? I suspect it'll fail, as all the patches are backports.
Created attachment 918170 [details] x86-sse and floating point alterations disabled Removed the architecture patches, failure. Removed the one tests.patch and no more failure. So I re-enabled the architecture passes, kept tests.patch off. Failure. libffi-3.4.6-tests.patch and libffi-3.4.6-x86-sse.patch both contribute to the failure, one is changing the floating point values and the other seems to be related slightly. I'm not educated in computer math and coding but at least I narrowed it down for you guys.
(In reply to Sam James from comment #6) > Thanks. I've just got home from travel so bear with me as I rest and then > spin up again. > > Can you also try 9999? I suspect it'll fail, as all the patches are > backports. Indeed good sir, however, configure phase is failing for me from no configure script being found. Never had that happen for a 9999 package before. Rest up, I'm in no rush.
Sorry to repeat comment. The whole reason I even checked for libffi failures is because dev-scheme/guile is currently failing the libffi test for me. This time I went back to disabling all the backport patches, and then re-ran the Guile test suite. It's now passing, so one of the other patches is breaking the Guile test suite. bad return from expression `(f-s16-u8 10)': expected -19990; got -28182 bad return from expression `(f-s32-u8 10)': expected -1999999990; got 454446602 bad return from expression `(f-u32-u8 10)': expected 4000000010; got 2159479306 bad return from expression `(f-s64-u8 10)': expected -1999999990; got -1694597622 bad return from expression `(f-u64-u8 10)': expected 4000000010; got 4269780746 bad return from expression `(f-sum-many 255 65535 4294967295 1844674407370955161 -1 2000 -30000 40000000000 5 -6000 70000 -80000000000)': expected 1844674371666024250; got 1844674380255828026 That's the output from guile's libffi test. If you want, I can open another bug report but it seems relevant to this as it's the patches that are breaking the libffi test suite and guile's libffi test.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b49b3982628421826327a0a39dd5e892b6a821e commit 0b49b3982628421826327a0a39dd5e892b6a821e Author: Sam James <sam@gentoo.org> AuthorDate: 2025-02-04 13:10:13 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-02-04 13:14:31 +0000 dev-libs/libffi: eautoreconf for live This clearly can't have worked before, I either lost a hunk when staging w/ git add -p or committed it before it was ready and forgot to go back to it. Bug: https://bugs.gentoo.org/949051 Signed-off-by: Sam James <sam@gentoo.org> dev-libs/libffi/libffi-9999.ebuild | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
No problem and thanks. Your investigation / findings so far indicate it's the same bug and I agree we should keep it in here.
(In reply to Sam James from comment #11) > No problem and thanks. Your investigation / findings so far indicate it's > the same bug and I agree we should keep it in here. Tested 9999 after you fixed the ebuild and same test failures as the back ported patches. I'll do some digging later to see which patch is causing the guile test failure.
I derped somewhere earlier today. The only patches messing up dev-scheme/guile are the two previously reported ones, libffi-3.4.6-tests.patch and libffi-3.4.6-x86-sse.patch.
Thanks. I've filed https://github.com/libffi/libffi/issues/879 upstream.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd45b77ea1fc68fff191eb7d4ec40f5cb74d5466 commit fd45b77ea1fc68fff191eb7d4ec40f5cb74d5466 Author: Sam James <sam@gentoo.org> AuthorDate: 2025-02-05 00:09:24 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-02-05 00:11:26 +0000 dev-libs/libffi: drop problematic SSE patch While this works fine with GCC, it causes 2 test failures with Clang (not the test just added, either), and then also causes failures w/ Clang-built libffi in guile's testsuite. Drop libffi-3.4.6-x86-sse.patch and the followup libffi-3.4.6-tests.patch accordingly for now, given that while it seems to fix a real issue in libffi, it wasn't reported as a "real bug" in Gentoo, and the status quo seems worse than reverting it. Thanks to Jeff for the original report and also unhappy-ending for looking into it and narrowing down which patch was the problem, and mentioning the fallout in guile. Bug: https://github.com/libffi/libffi/issues/879 Bug: https://bugs.gentoo.org/949051 Signed-off-by: Sam James <sam@gentoo.org> dev-libs/libffi/libffi-3.4.6-r3.ebuild | 94 ++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=913b9ae63372f13deb88137f646213574ae94158 commit 913b9ae63372f13deb88137f646213574ae94158 Author: Sam James <sam@gentoo.org> AuthorDate: 2025-02-09 03:34:16 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-02-09 03:34:52 +0000 dev-libs/libffi: add 3.4.7 Note that this contains a revert and unconditional skip for the change that we reverted in fd45b77ea1fc68fff191eb7d4ec40f5cb74d5466 as it made it into the release. (The test is new with the problematic change.) Closes: https://bugs.gentoo.org/949051 Signed-off-by: Sam James <sam@gentoo.org> dev-libs/libffi/Manifest | 1 + ...x86-ffi64-calls-with-6-gp-and-some-sse-re.patch | 38 ++++++++++ dev-libs/libffi/libffi-3.4.7.ebuild | 87 ++++++++++++++++++++++ 3 files changed, 126 insertions(+)