arm-none-eabi for os development, hardfp/softfp libgcc issue
Posted: Sat Dec 11, 2021 9:30 am
Hi,
My kernel supports ARM architectures ; to build i use the arm-none-eabi toolchain (https://developer.arm.com/tools-and-sof ... /downloads). I did not build a cross-compiler and directly used this toolchain because i believe it does targets bare metal, so no need to rebuild a compiler to do that. Am i wrong ?
However, i had problems recently :
i link with libgcc, which gives me support for divmod (division and reminder) (_udivmoddi4 and such)
I target multiple architectures, and i only compiled for i686 ; when i tried to compile for ARM again, i got this error :
I compile my kernel with , as i target RPI2. I don't understand where i am using a VFP register, because i don't have any floating point operation in the kernel ; but i added a 64-bits integer division, which i suspect gcc will optimize using vfp registers (ARMv7 is 32-bits).
It appears that the libgcc provided with arm-none-eabi is 'softfp' : software-only floating point operations, and that is incompatible with 'hardfp' : hardware floating points operations.
The way i see it, i only have 2 solutions :
- Change the kernel compile flag to softfp (which means all operations are done in software, no hardware acceleration : poor performances...)
- Rebuild/have a libgcc on each kernel compilation for my target (vfpv4 here, but might be different for rpi0 or rpi4 or ...) with hardfp (which seems really boring and tedious to setup...)
I think i'll go for the second option ; but is there something i'm missing ? something i don't see ?
EDIT : something that seems strange to me is that uint64_t division generated code that uses VFP registers, but uint32_t division used libgcc udivmod...
My kernel supports ARM architectures ; to build i use the arm-none-eabi toolchain (https://developer.arm.com/tools-and-sof ... /downloads). I did not build a cross-compiler and directly used this toolchain because i believe it does targets bare metal, so no need to rebuild a compiler to do that. Am i wrong ?
However, i had problems recently :
i link with libgcc, which gives me support for divmod (division and reminder) (_udivmoddi4 and such)
I target multiple architectures, and i only compiled for i686 ; when i tried to compile for ARM again, i got this error :
Code: Select all
arm-none-eabi-ld: error: kernel.elf uses VFP register arguments, libgcc.a (_udivmoddi4.o) does not
Code: Select all
-mfpu=neon-vfpv4 -mfloat-abi=hard
It appears that the libgcc provided with arm-none-eabi is 'softfp' : software-only floating point operations, and that is incompatible with 'hardfp' : hardware floating points operations.
The way i see it, i only have 2 solutions :
- Change the kernel compile flag to softfp (which means all operations are done in software, no hardware acceleration : poor performances...)
- Rebuild/have a libgcc on each kernel compilation for my target (vfpv4 here, but might be different for rpi0 or rpi4 or ...) with hardfp (which seems really boring and tedious to setup...)
I think i'll go for the second option ; but is there something i'm missing ? something i don't see ?
EDIT : something that seems strange to me is that uint64_t division generated code that uses VFP registers, but uint32_t division used libgcc udivmod...