commit:     44505befae975f59ae48b194c4aa06dd0e312c7f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  3 02:05:00 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul  3 02:05:57 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44505bef

sys-libs/binutils-libs: sync src_test with sys-devel/binutils

Sync src_test with sys-devel/binutils.

Fixes test failures with -Wa,--gsframe which confuses libctf (IIRC)
tests.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../binutils-libs/binutils-libs-2.44-r2.ebuild     | 36 +++++++++++++++++++---
 sys-libs/binutils-libs/binutils-libs-9999.ebuild   | 36 +++++++++++++++++++---
 2 files changed, 64 insertions(+), 8 deletions(-)

diff --git a/sys-libs/binutils-libs/binutils-libs-2.44-r2.ebuild 
b/sys-libs/binutils-libs/binutils-libs-2.44-r2.ebuild
index 68778c83c83f..30409721e947 100644
--- a/sys-libs/binutils-libs/binutils-libs-2.44-r2.ebuild
+++ b/sys-libs/binutils-libs/binutils-libs-2.44-r2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit dot-a libtool toolchain-funcs multilib-minimal
+inherit dot-a flag-o-matic libtool toolchain-funcs multilib-minimal
 
 DESCRIPTION="Core binutils libraries (libbfd, libopcodes, libiberty) for 
external packages"
 HOMEPAGE="https://sourceware.org/binutils/";
@@ -208,9 +208,37 @@ multilib_src_configure() {
 }
 
 multilib_src_test() {
-       # Without this, the default `src_test` check for the 'check' target
-       # with `-n` may fail with parallel make and silently skip tests (bug 
#955595)
-       emake check
+       (
+               # Tests don't expect LTO
+               filter-lto
+
+               # If we have e.g. -mfpmath=sse -march=pentium4 in CFLAGS,
+               # we'll get lto1 warnings for some tests which cause
+               # spurious failures because -mfpmath isn't passed at
+               # link-time. Filter accordingly.
+               #
+               # Alternatively, we could pass C{C,XX}_FOR_TARGET with
+               # some (ideally not all, surely would break some tests)
+               # stuffed in.
+               filter-flags '-mfpmath=*'
+
+               # lto-wrapper warnings which confuse tests
+               filter-flags '-Wa,*'
+
+               # bug #637066
+               filter-flags -Wall -Wreturn-type
+
+               # Note that we need 'check' explicitly if ever cleaning this
+               # up: the default `src_test` check for the 'check' target
+               # with `-n` may fail with parallel make and silently skip tests 
(bug #955595)
+               emake -k check \
+                       CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}" \
+                       
CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}" \
+                       LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" \
+                       CFLAGS="${CFLAGS}" \
+                       CXXFLAGS="${CXXFLAGS}" \
+                       LDFLAGS="${LDFLAGS}"
+       )
 }
 
 multilib_src_install() {

diff --git a/sys-libs/binutils-libs/binutils-libs-9999.ebuild 
b/sys-libs/binutils-libs/binutils-libs-9999.ebuild
index bf7a24d748c7..5afd4e37fd78 100644
--- a/sys-libs/binutils-libs/binutils-libs-9999.ebuild
+++ b/sys-libs/binutils-libs/binutils-libs-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit dot-a libtool toolchain-funcs multilib-minimal
+inherit dot-a flag-o-matic libtool toolchain-funcs multilib-minimal
 
 DESCRIPTION="Core binutils libraries (libbfd, libopcodes, libiberty) for 
external packages"
 HOMEPAGE="https://sourceware.org/binutils/";
@@ -208,9 +208,37 @@ multilib_src_configure() {
 }
 
 multilib_src_test() {
-       # Without this, the default `src_test` check for the 'check' target
-       # with `-n` may fail with parallel make and silently skip tests (bug 
#955595)
-       emake check
+       (
+               # Tests don't expect LTO
+               filter-lto
+
+               # If we have e.g. -mfpmath=sse -march=pentium4 in CFLAGS,
+               # we'll get lto1 warnings for some tests which cause
+               # spurious failures because -mfpmath isn't passed at
+               # link-time. Filter accordingly.
+               #
+               # Alternatively, we could pass C{C,XX}_FOR_TARGET with
+               # some (ideally not all, surely would break some tests)
+               # stuffed in.
+               filter-flags '-mfpmath=*'
+
+               # lto-wrapper warnings which confuse tests
+               filter-flags '-Wa,*'
+
+               # bug #637066
+               filter-flags -Wall -Wreturn-type
+
+               # Note that we need 'check' explicitly if ever cleaning this
+               # up: the default `src_test` check for the 'check' target
+               # with `-n` may fail with parallel make and silently skip tests 
(bug #955595)
+               emake -k check \
+                       CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}" \
+                       
CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}" \
+                       LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" \
+                       CFLAGS="${CFLAGS}" \
+                       CXXFLAGS="${CXXFLAGS}" \
+                       LDFLAGS="${LDFLAGS}"
+       )
 }
 
 multilib_src_install() {

Reply via email to