Re: GCC with Cortex-M4 hard float link error "X uses VFP register arguments, Y does not"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22 August 2012 16:20, Johannes Bauer <dfnsonfsduifb@xxxxxx> wrote:
> Hi list,
>
> I have a problem with gcc-4.7.1 (and g++) for ARM, specifically the
> Cortex M4 (Thumb2 variant). I've compiled it with newlib and multilib
> support and am now trying to get hard float running, with no success so
> far. Showing that multilib is enabled:
>
> $ arm-none-eabi-g++ -print-multi-lib
> .;
> thumb;@mthumb
> fpu;@mfloat-abi=hard
>
> I compile with
>
> arm-none-eabi-gcc -Wall -O2 -g -mcpu=cortex-m4 -mfloat-abi=hard -mthumb
> -std=c99 -c -o foo.o foo.c
>
> Compiling the modules works fine and hard float instructions are generated:
>
> 0000013c <floattest(float)>:
>  13c:   ed9f 7b08       vldr    d7, [pc, #32]   ; 160
> <floattest(float)+0x24>
>  140:   eeb7 0ac0       vcvt.f64.f32    d0, s0
>  144:   ee20 0b07       vmul.f64        d0, d0, d7
>  148:   ed9f 7b07       vldr    d7, [pc, #28]   ; 168
> <floattest(float)+0x2c>
>  14c:   eeb7 0bc0       vcvt.f32.f64    s0, d0
>  150:   eeb7 0ac0       vcvt.f64.f32    d0, s0
>  154:   ee30 0b07       vadd.f64        d0, d0, d7
>  158:   eeb7 0bc0       vcvt.f32.f64    s0, d0
>  15c:   4770            bx      lr
>  15e:   bf00            nop
>  160:   e631f8a1        .word   0xe631f8a1
>  164:   40c81cd6        .word   0x40c81cd6
>  168:   692b3cc5        .word   0x692b3cc5
>  16c:   3f5437c5        .word   0x3f5437c5
>
> When it comes to linking, however, this is a different story. For each
> module "m" and the final ELF target "t" I get a message:
>
> [...]/bin/arm/lib/gcc/arm-none-eabi/4.7.1/../../../../arm-none-eabi/bin/ld:
> error: m.o uses VFP register arguments, t does not
> [...]/bin/arm/lib/gcc/arm-none-eabi/4.7.1/../../../../arm-none-eabi/bin/ld:
> failed to merge target specific data of file m.o
>
> I'm guessing it's trying to link newlib stuff in from the libcrt* which
> might not be compiled with hard float, can that be correct? Then why
> would gcc's multilib show the correct strings? Could somebody please
> explain to me what I'm doing wrong?

A couple of questions which may help diagnose the issue:

1) How have you configured GCC? (What does gcc -v show?)

2) What does the following command say is the directory in use?

  arm-none-eabi-gcc -Wall -O2 -g -mcpu=cortex-m4 -mfloat-abi=hard -mthumb \
      -std=c99 -c -o foo.o foo.c -print-multi-directory

Thanks,

Matt

-- 
Matthew Gretton-Dann
Linaro Toolchain Working Group
matthew.gretton-dann@xxxxxxxxxx


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux