The gcc linker sensibly checks that all files use the same calling convention to prevent problems, but it provides an awful error message that left me confused. When I updated a Cortex‑M project to use floating point math (-float-abi=hard
), the linker gave the following error
mylib.o uses VFP register arguments, build/program.elf does not
It sounds like I have to update some setting to tell the linker which calling convention to use for the output, but what it actually means is slightly different: When the first object file is added, its calling convention becomes the calling convention of the output, and when any following files do not match, it is an error, and you see that message.
The most likely cause is that your build system did not rebuild everything, and a full rebuild will fix it. If not, you will need to check your libraries, and then the build options for your object files to see why they were built with a different calling convention. Make sure you put an object file with the correct convention at the start.