Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 23 Aug 2022 05:24:29
Message-Id: 1661232236.e61ffcd622d34570b294e7f4a3e922bdc980cd65.sam@gentoo
1 commit: e61ffcd622d34570b294e7f4a3e922bdc980cd65
2 Author: Marek BehĂșn <kabel <AT> kernel <DOT> org>
3 AuthorDate: Thu Aug 18 18:01:58 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 23 05:23:56 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e61ffcd6
7
8 toolchain.eclass: build multilibs for ARM's A, R and M architecture profiles
9
10 For ARM targets, with USE=multilib and with CTARGET that does not imply
11 any of --with-arch, --with-cpu, --with-mode or --with-float options to
12 gcc's configuration (when arm_arch=arm), pass option
13 --with-multilib-list=aprofile,rmprofile to gcc's configuration to make
14 it build multilibs for A, R and M architecture profiles.
15
16 This makes it possible to have one compiler capable of generating
17 correct code (linking correct libgcc/CRT) for various ARM targets: from
18 armv6 to armv7, for both soft float and half float, for various FPU
19 types.
20
21 Example of arm-none-eabi-gcc -print-libgcc-file-name output for various
22 options:
23 default:
24 /usr/lib/gcc/arm-none-eabi/12.1.1/libgcc.a
25 -mcpu=cortex-m0
26 /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v6-m/nofp/libgcc.a
27 -march=armv7-m
28 /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v7-m/nofp/libgcc.a
29 -march=armv7-a
30 /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v7-a/nofp/libgcc.a
31 -march=armv7-a -mhard-float -mfpu=neon
32 /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v7-a+simd/hard/libgcc.a
33 -march=armv7-a -mhard-float -mfpu=vfp
34 /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v7-a+fp/hard/libgcc.a
35
36 Signed-off-by: Marek BehĂșn <kabel <AT> kernel.org>
37 Signed-off-by: Sam James <sam <AT> gentoo.org>
38
39 eclass/toolchain.eclass | 11 +++++++++++
40 1 file changed, 11 insertions(+)
41
42 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
43 index ed473e0c626f..29076efc3f54 100644
44 --- a/eclass/toolchain.eclass
45 +++ b/eclass/toolchain.eclass
46 @@ -1213,6 +1213,17 @@ toolchain_src_configure() {
47 armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;;
48 esac
49 fi
50 +
51 + # If multilib is used, make the compiler build multilibs
52 + # for A or R and M architecture profiles. Do this only
53 + # when no specific arch/mode/float is specified, e.g.
54 + # for target arm-none-eabi, since doing this is
55 + # incompatible with --with-arch/cpu/float/fpu.
56 + if is_multilib && [[ ${arm_arch} == arm ]] && \
57 + tc_version_is_at_least 7.1
58 + then
59 + confgcc+=( --with-multilib-list=aprofile,rmprofile )
60 + fi
61 ;;
62 mips)
63 # Add --with-abi flags to set default ABI