ARM Linking Arguments
Christophe Lyon
christophe.lyon@arm.com
Wed Mar 27 08:59:17 GMT 2024
Hi!
On 3/27/24 00:21, Joel Sherrill wrote:
> Hi
>
> I am trying to compile some test code for an odd ARM with single
> precision. I think I have successfully compiled a toolchain with
> libraries with only 32 bit float. But I think there need to be some
> arguments on the link that gcc may not be passing through.
>
> The CPU flags are "c -mcpu=cortex-m7 -mthumb -mlittle-endian
> -mfloat-abi=hard -mfpu=fpv5-sp-d16 -march=armv7e-m+fpv5"
>
> Based on the output, I think ld has a different idea of what the
> executable "main" should be from what the input objects are.
>
> Any thoughts on what would be a way to correct this?
>
> /home/joel/test-gcc/install-arm-eabi//bin/arm-rtems6-gcc
> -mcpu=cortex-m7 -mthumb -mlittle-endian -mfloat-abi=hard
> -mfpu=fpv5-sp-d16 -march=armv7e-m+fpv5 -c -o main.o main.c
> /home/joel/test-gcc/install-arm-eabi//bin/arm-rtems6-gcc -mcpu=cortex-m7
> -mthumb -mlittle-endian -mfloat-abi=hard -mfpu=fpv5-sp-d16
> -march=armv7e-m+fpv5 -c -o crunch_f32.o crunch_f32.c
> /home/joel/test-gcc/install-arm-eabi//bin/arm-rtems6-gcc -mcpu=cortex-m7
> -mthumb -mlittle-endian -mfloat-abi=hard -mfpu=fpv5-sp-d16
> -march=armv7e-m+fpv5 -c -o crunch_f64.o crunch_f64.c
> /home/joel/test-gcc/install-arm-eabi//bin/arm-rtems6-gcc -mcpu=cortex-m7
> -mthumb -mlittle-endian -mfloat-abi=hard -mfpu=fpv5-sp-d16
> -march=armv7e-m+fpv5 -o main main.o crunch_f32.o crunch_f64.o
>
> /home/joel/test-gcc/install-arm-eabi/lib/gcc/arm-rtems6/12.3.1/../../../../arm-rtems6/bin/ld: error: main.o uses VFP register arguments, main does not
>
> /home/joel/test-gcc/install-arm-eabi/lib/gcc/arm-rtems6/12.3.1/../../../../arm-rtems6/bin/ld: failed to merge target specific data of file main.o
>
In general, this indicates that you are using the wrong multilib (or
rather that your toolchain does not have the right multilib for the
flags you supplied).
When the linker says "main does not", it's probably because the
executable being generated ("main") inherits attributes from crt0.o
(which apparently does not use VFP register arguments, so is compiled
with --float-abi=soft or softfp), but main.o was compiled with
--float-abi=hard, hence the conflict.
What does --print-multi-lib say?
Thanks,
Christophe
> Thanks.
>
> --joel
More information about the Binutils
mailing list