Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 667030

Summary: Usable bare-metal ARM cross-toolchains are not buildable since 921cb9c10de4d
Product: Gentoo Linux Reporter: Paul Fertser <fercerpav>
Component: EclassesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED DUPLICATE    
Severity: normal CC: arm, chewi
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Paul Fertser 2018-09-25 11:10:33 UTC
TLDR: it's nice to use arm-none-eabi-gcc for microcontroller firmware development but libgcc and newlib must be multilib for that to work. Since portage commit 921cb9c10de4d this is no longer possible.

Longer description:
ARM cores are used in plenty of microcontrollers and SoCs and come in many varieties: some support only Thumb ISA, some work with both ARM and Thumb, some have no hardware floating point support at all, some can do only single precision calculations, others deal with doubles etc.

When implementing bare-metal software all the involved code must be built in accordance to the specific part's specs, it typically involves libgcc and newlib. ARM provides toolchain binaries that are using multilib, i.e. each library is built in multiple varieties to account for the targets' differences. 

Example output from GCC 8.2.0:
$ arm-none-eabi-gcc -print-multi-lib --version
.;
arm/v5te/softfp;@marm@march=armv5te+fp@mfloat-abi=softfp
arm/v5te/hard;@marm@march=armv5te+fp@mfloat-abi=hard
thumb/nofp;@mthumb@mfloat-abi=soft
thumb/v7/nofp;@mthumb@march=armv7@mfloat-abi=soft
thumb/v7+fp/softfp;@mthumb@march=armv7+fp@mfloat-abi=softfp
thumb/v7+fp/hard;@mthumb@march=armv7+fp@mfloat-abi=hard
thumb/v6-m/nofp;@mthumb@march=armv6s-m@mfloat-abi=soft
thumb/v7-m/nofp;@mthumb@march=armv7-m@mfloat-abi=soft
thumb/v7e-m/nofp;@mthumb@march=armv7e-m@mfloat-abi=soft
thumb/v7e-m+fp/softfp;@mthumb@march=armv7e-m+fp@mfloat-abi=softfp
thumb/v7e-m+fp/hard;@mthumb@march=armv7e-m+fp@mfloat-abi=hard
thumb/v7e-m+dp/softfp;@mthumb@march=armv7e-m+fp.dp@mfloat-abi=softfp
thumb/v7e-m+dp/hard;@mthumb@march=armv7e-m+fp.dp@mfloat-abi=hard
thumb/v8-m.base/nofp;@mthumb@march=armv8-m.base@mfloat-abi=soft
thumb/v8-m.main/nofp;@mthumb@march=armv8-m.main@mfloat-abi=soft
thumb/v8-m.main+fp/softfp;@mthumb@march=armv8-m.main+fp@mfloat-abi=softfp
thumb/v8-m.main+fp/hard;@mthumb@march=armv8-m.main+fp@mfloat-abi=hard
thumb/v8-m.main+dp/softfp;@mthumb@march=armv8-m.main+fp.dp@mfloat-abi=softfp
thumb/v8-m.main+dp/hard;@mthumb@march=armv8-m.main+fp.dp@mfloat-abi=hard

It used to be possible to get a nice multilib arm-none-eabi toolchain by using this command:
USE="-hardened -ssp -pie cxx" crossdev --genv EXTRA_ECONF=\"--with-multilib-list=rmprofile\ --enable-libstdcxx-time=no\" arm-none-eabi'

However, commit 921cb9c10de4d now leads to adding --with-float=soft to the configure arguments and it makes multilib built impossible. Just commenting out "yes)    confgcc+=( --with-float=soft ) ;;" in /usr/portage/eclass/toolchain.eclass allows the build to work.

Please propose a working solution to bare-metal development needs.

Reproducible: Always

Steps to Reproduce:
USE="-hardened -ssp -pie cxx" crossdev --genv EXTRA_ECONF=\"--with-multilib-list=rmprofile\ --enable-libstdcxx-time=no\" arm-none-eabi'
Actual Results:  
Cross-GCC build fails

Expected Results:  
Useful arm-none-eabi toolchain for baremetal microcontroller and SoC development is built.
Comment 1 James Le Cuirot gentoo-dev 2018-09-25 11:35:39 UTC
Hmmm. Things were kind of ambiguous before. tc-is-softfloat assumed hardfloat but only added --with-float=hard for ARMv6 and ARMv7. After changing it to assume softfloat, I thought about removing that condition but left it alone in the end. I still think assuming softfloat is a good idea because if you're not doing multilib then you should explicitly specify one or the other using --with-float. I guess we need a good way to determine if multilib is being applied. I don't know much about multilib though so I'll get back to you.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2018-09-25 19:38:53 UTC

*** This bug has been marked as a duplicate of bug 666896 ***