public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ARM Linking Arguments
@ 2024-03-26 23:21 Joel Sherrill
  2024-03-27  8:59 ` Christophe Lyon
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Sherrill @ 2024-03-26 23:21 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]

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

Thanks.

--joel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ARM Linking Arguments
  2024-03-26 23:21 ARM Linking Arguments Joel Sherrill
@ 2024-03-27  8:59 ` Christophe Lyon
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Lyon @ 2024-03-27  8:59 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-27  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 23:21 ARM Linking Arguments Joel Sherrill
2024-03-27  8:59 ` Christophe Lyon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).