Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Fri, 30 Mar 2018 11:43:17
Message-Id: 1522410188.1b31083fd156425cc687fee7058b74b752be768e.slyfox@gentoo
1 commit: 1b31083fd156425cc687fee7058b74b752be768e
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 30 11:30:09 2018 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 30 11:43:08 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b31083f
7
8 toolchain-glibc.eclass: fix glibc-headers bootstrap on non-multilib host
9
10 The error is found by wm_ attempting to build a cross-compiler
11 CHOST=powerpc-unknown-linux-gnu CTARGET=mips64-unknown-linux-gnu
12 Boostrap failed on glibc-headers (./configure phase) as:
13
14 configure:2623: powerpc-unknown-linux-gnu-gcc -mabi=n32 -c -O1 -pipe -U_FORTIFY_SOURCE conftest.c >&5
15 powerpc-unknown-linux-gnu-gcc: error: unrecognized command line option '-mabi=n32'; did you mean '-mabi=d32'?
16
17 Note how target's ABI is mexed into host's compiler flags.
18
19 The error above happens on every host=non-multilib target=multilib combination.
20 I've reproduced it on:
21 CHOST=i686-pc-linux-gnu CTARGET=mips64-unknown-linux-gnu
22
23 The fix is not to inject target's CFLAGS ABI into CC for
24 USE=headers-only bootstrap step as we don't have cross-compiler yet.
25
26 Tested by successfully bootstrapping cross-compiler on
27 CHOST=i686-pc-linux-gnu CTARGET=mips64-unknown-linux-gnu
28
29 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
30
31 eclass/toolchain-glibc.eclass | 8 ++++++++
32 1 file changed, 8 insertions(+)
33
34 diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
35 index bd10f2cbbe4..d75ca2eefdf 100644
36 --- a/eclass/toolchain-glibc.eclass
37 +++ b/eclass/toolchain-glibc.eclass
38 @@ -370,6 +370,14 @@ setup_env() {
39
40 export ABI=${ABI:-${DEFAULT_ABI:-default}}
41
42 + if use headers-only ; then
43 + # Avoid mixing host's CC and target's CFLAGS_${ABI}:
44 + # At this bootstrap stage we have only binutils for
45 + # target but not compiler yet.
46 + einfo "Skip CC ABI injection. We can't use (cross-)compiler yet."
47 + return 0
48 + fi
49 +
50 local VAR=CFLAGS_${ABI}
51 # We need to export CFLAGS with abi information in them because glibc's
52 # configure script checks CFLAGS for some targets (like mips). Keep