Created attachment 457054 [details, diff] arm-embedded-multilib.patch Patch arm-embedded-multilib.patch for GCC adds cortex-m and cortex-r multilib support. Got it here. > Add support for ARM embedded multilibs > https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03400.html This patch is made for gcc-6.2. Changes only applied when builded with appropriate with-multilib-list options. Useful to make crossdev ebuilds suitable for building projects like opencm3. > crossdev -s0 --ex-gdb --genv 'EXTRA_ECONF="--with-multilib-list=armv6-m,armv7,armv7-m,armv7e-m,armv7-r,armv7-a,cortex-m7"' --target arm-none-eabi Upstream did not accept this patch because of lack of related documentation changes. But it works for me, I have got very latest arm-none-eabi toolchain. Crossdev developers could be interested in.
This was added to upstream commit f3c3922fb10295a65cbb8cdfda7eced0eda125f8 Author: thopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Tue Nov 22 14:01:57 2016 +0000 Add multilib support for embedded bare-metal targets 2016-11-22 Thomas Preud'homme <thomas.preudhomme@arm.com> git tag --contains f3c3922fb102 gcc-7_1_0-release gcc-7_2_0-release crossdev --g 7.2.0 -s1 --genv 'EXTRA_ECONF="--with-multilib-list=rmprofile"' --target arm-none-eabi Got an error /var/tmp/portage/cross-arm-none-eabi/gcc-7.2.0/work/build/gcc/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory # include_next <stdint.h> I'll investigate it later.
rmprofile is available in the latest gcc releases and it works fine. No patching is required anymore.
See also: commit e61ffcd622d34570b294e7f4a3e922bdc980cd65 Author: Marek Behún <kabel@kernel.org> Date: Thu Aug 18 20:01:58 2022 +0200 toolchain.eclass: build multilibs for ARM's A, R and M architecture profiles For ARM targets, with USE=multilib and with CTARGET that does not imply any of --with-arch, --with-cpu, --with-mode or --with-float options to gcc's configuration (when arm_arch=arm), pass option --with-multilib-list=aprofile,rmprofile to gcc's configuration to make it build multilibs for A, R and M architecture profiles. This makes it possible to have one compiler capable of generating correct code (linking correct libgcc/CRT) for various ARM targets: from armv6 to armv7, for both soft float and half float, for various FPU types. Example of arm-none-eabi-gcc -print-libgcc-file-name output for various options: default: /usr/lib/gcc/arm-none-eabi/12.1.1/libgcc.a -mcpu=cortex-m0 /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v6-m/nofp/libgcc.a -march=armv7-m /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v7-m/nofp/libgcc.a -march=armv7-a /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v7-a/nofp/libgcc.a -march=armv7-a -mhard-float -mfpu=neon /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v7-a+simd/hard/libgcc.a -march=armv7-a -mhard-float -mfpu=vfp /usr/lib/gcc/arm-none-eabi/12.1.1/thumb/v7-a+fp/hard/libgcc.a Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Sam James <sam@gentoo.org> which we later reverted: commit 3e6f0d7e573c9141d2f3b5bb284caef999663294 Author: Marek Behún <kabel@kernel.org> Date: Thu Aug 18 19:53:10 2022 +0200 Revert "toolchain.eclass: ensure thumb mode for armv6m" This reverts commit 903b71810e0b270a7d494e16e2d799fcd95ae50f. The commit caused default libgcc to be built in thumb mode for armv6m target, but it broke subsequent compilation of newlib via crossdev. The whole reason of this commit was to have the compiler generate correct code when libgcc was used in thumb mode, but now this is not needed anymore, because now we configure gcc with --with-multilib-list=aprofile,rmprofile for CTARGET=arm-* when used with multilib, which generates compiler that builds correct binaries for -march=armv6-m even if libgcc is used. Signed-off-by: Marek Behún <kabel@kernel.org> Closes: https://github.com/gentoo/gentoo/pull/26914 Signed-off-by: Sam James <sam@gentoo.org>
... and (we didn't revert this): commit 903b71810e0b270a7d494e16e2d799fcd95ae50f Author: Marek Behún <kabel@kernel.org> Date: Mon May 30 13:00:09 2022 +0200 toolchain.eclass: ensure thumb mode for armv6m Currently the eclass ensures thumb mode compilation for libgcc for armv7m targets with [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-} ... [[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb ) But libgcc should also be compiled in thumb mode for the armv6m target. Add the dash as is done for the armv7 case so that --with-mode=thumb option is added for armv6m. Signed-off-by: Marek Behún <kabel@kernel.org> Closes: https://github.com/gentoo/gentoo/pull/25687 Signed-off-by: Sam James <sam@gentoo.org>