[Solved] Build freestanding arm32 target with soft float ABI

I’m trying to build a project for a freestanding arm32 target, specifically the Cortex M0+. The issue I’m running into is that during linking, arm-none-eabi-ld complains that the object file uses VFP (hard float) instructions while libgcc does not.

Looking at the compiler source, it seems to have a hardcoded target triple that uses the gnueabihf hard float ABI.

I’ve been scouring the internet as best I can given the useless state of modern search engines and have come up empty except for confirming the above information. I’m honestly just a bit outside of my depth on this, but pushing my boundaries kind of the point of this whole project.

I did try building with -target-features:soft-float and -target-features:thumb2. The first didn’t change the outcome, the second threw an LLVM error.

Edit: repo link

I believe soft floats will not just be a switch to pull, it requires the compiler to emit emulation code for floating point operations. I made this PR to set up a base for doing that so somebody could pick it up Float emulation start for more embedded support by laytan · Pull Request #4143 · odin-lang/Odin · GitHub, I don’t have a lot of time lately.

2 Likes

This 100% will not work because neither support for ARMv6-M nor soft float is implemented. Odin’s definition of 32-bit ARM currently is currently ARMv8-M with both the SP and DP FPUs.

1 Like

Thanks for the info!