mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-22 10:57:07 -08:00
sys-devel/binutils: rework LTO handling
Get tests passing when LTO is used and rework USE=pgo handling while at it, as it's interlinked with LTO b/c of the upstream infra for it. This follows on from: *1764651a4f*f900949be8*f900949be8where I kept hitting misc issues where the build for the live ebuild failed with LTO or otherwise. With this, I only needed one patch to libctf's tests [0] which I've now pinged upstream. (I also had an odd single gprofng failure I haven't looked at yet.) * For LTO + (tests || pgo), always filter '-Wa,*'. This is an unfortunate one, but the bootstrap test fails with it. * USE=pgo no longer implies LTO. If -flto is being used, then we pass --enable-pgo-build=lto. If not, we pass --enable-pgo-build=yes. * For USE=pgo, filter out LTO after we applied the build system configuration, because otherwise there's a risk we're going to break the tests used for profiling. * In src_test, use a subshell to localise the filtering of flags we do. * For tests, pass {C,CXX,LD}FLAGS_FOR_TARGET to make, as otherwise it'll use what it found from configure (and e.g. pick up LTO again -> many tests fail as they're not intended to be used with it). [0] https://inbox.sourceware.org/binutils/87sf2evr35.fsf@esperi.org.uk/ Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user