Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/, eclass/tests/
Date: Fri, 25 Aug 2017 13:53:25
Message-Id: 1503669198.6f0e2e53c401a01ee8015e356699bbfb9d246e35.mgorny@gentoo
1 commit: 6f0e2e53c401a01ee8015e356699bbfb9d246e35
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 1 16:14:44 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 25 13:53:18 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f0e2e53
7
8 flag-o-matic.eclass: Strip LDFLAGS unsupported by the C compiler, #621274
9
10 Include LDFLAGS in the variables stripped by strip-unsupported-flags.
11 The code reuses the current functions for testing CC, and so only remove
12 LDFLAGS that are rejected by the C compiler and not the linker. This
13 solves the case of bug #621274 where LDFLAGS contained GCC-specific
14 -flto flag.
15
16 eclass/flag-o-matic.eclass | 3 +++
17 eclass/tests/flag-o-matic.sh | 2 +-
18 2 files changed, 4 insertions(+), 1 deletion(-)
19
20 diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
21 index 79866e04a48..4e3cfff5afd 100644
22 --- a/eclass/flag-o-matic.eclass
23 +++ b/eclass/flag-o-matic.eclass
24 @@ -546,6 +546,9 @@ strip-unsupported-flags() {
25 export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS})
26 export FFLAGS=$(test-flags-F77 ${FFLAGS})
27 export FCFLAGS=$(test-flags-FC ${FCFLAGS})
28 + # note: this does not verify the linker flags but it is enough
29 + # to strip invalid C flags which are much more likely, #621274
30 + export LDFLAGS=$(test-flags-CC ${LDFLAGS})
31 }
32
33 # @FUNCTION: get-flag
34
35 diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
36 index 5e7ee354bf3..53af9f862c4 100755
37 --- a/eclass/tests/flag-o-matic.sh
38 +++ b/eclass/tests/flag-o-matic.sh
39 @@ -55,7 +55,7 @@ done <<<"
40
41 tbegin "strip-unsupported-flags"
42 strip-unsupported-flags
43 -[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]]
44 +[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]] && [[ ${LDFLAGS} == "" ]]
45 ftend
46
47 for var in $(all-flag-vars) ; do