commit: 68466c8b5bda1cbf82e364763c42c7c9df1dfff0
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 9 21:54:27 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 9 21:55:18 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=68466c8b
sys-devel/binutils: backport LTO fixes to 2.42-r1
>From 33056c4e55b76cfdcee02c206acbfd770d7ae378.
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-devel/binutils/binutils-2.42-r1.ebuild | 32 ++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/sys-devel/binutils/binutils-2.42-r1.ebuild
b/sys-devel/binutils/binutils-2.42-r1.ebuild
index 247aaaa1fa03..a7bca7df85af 100644
--- a/sys-devel/binutils/binutils-2.42-r1.ebuild
+++ b/sys-devel/binutils/binutils-2.42-r1.ebuild
@@ -333,10 +333,20 @@ src_configure() {
)
fi
+ if use test || { use pgo && tc-is-lto ; } ; then
+ # -Wa,* needs to be consistent everywhere or lto-wrapper will
complain
+ filter-flags '-Wa,*'
+ fi
+
if ! is_cross ; then
- myconf+=( $(use_enable pgo pgo-build lto) )
+ myconf+=( $(use_enable pgo pgo-build $(tc-is-lto && echo "lto"
|| echo "yes")) )
if use pgo ; then
+ # We let configure handle it for us because it has to
run
+ # the testsuite later on for profiling, and LTO isn't
compatible
+ # with the testsuite.
+ filter-lto
+
export BUILD_CFLAGS="${CFLAGS}"
fi
fi
@@ -378,10 +388,24 @@ src_test() {
local -x XZ_OPT="-T1"
local -x XZ_DEFAULTS="-T1"
- # bug #637066
- filter-flags -Wall -Wreturn-type
+ (
+ # Tests don't expect LTO
+ filter-lto
- emake -k check
+ # lto-wrapper warnings which confuse tests
+ filter-flags '-Wa,*'
+
+ # bug #637066
+ filter-flags -Wall -Wreturn-type
+
+ 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}"
+ )
}
src_install() {