arm-elf snafu? can't mix default-soft-float, explicit -msoft-float
Nick Clifton
nickc@redhat.com
Wed Jul 23 18:35:00 GMT 2003
Hi Doug,
> Simple testcase:
>
> bash$ rm foo1.c foo2.c ; touch foo1.c foo2.c
> bash$ arm-elf-gcc -c foo1.c
> bash$ arm-elf-objdump -p foo1.o
> foo1.o: file format elf32-littlearm
> private flags = 0: [APCS-32] [FPA float format]
> bash$ arm-elf-gcc -c foo2.c -msoft-float
> foo1.o: file format elf32-littlearm
> private flags = 200: [APCS-32] [FPA float format] [software FP]
> bash$ arm-elf-gcc -nostdlib foo1.o foo2.o
> [links successfully]
> bash$ arm-elf-gcc -nostdlib foo2.o foo1.o
> /samantha/gnu-pure/rel/lib/gcc-lib/arm-elf/3.4/../../../../arm-elf/bin/ld: ERROR: foo1.o uses hardware FP, whereas a.out uses software FP
> This line in gcc/config/arm/elf.h
>
> #ifndef SUBTARGET_ASM_FLOAT_SPEC
> #define SUBTARGET_ASM_FLOAT_SPEC "\
> %{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
> #endif
I think that this is the problem. If you apply the patch below for
example, then arm-elf targets will always pass -mfpu=softfpa to GAS,
unless -mhard-float is specfied, whereas the arm-linux toolchain will
always pass an explicit -mfpu=fpa unless -msoft-float is specified.
What do you think ?
Cheers
Nick
gcc/ChangeLog
2003-07-23 Nick Clifton <nickc@redhat.com>
* config/arm/elf.h (SUBTARGET_ASM_FLOAT_SPEC): Pass
-mfpu=softfpa to GAS by default.
* config/arm/linux-elf.h (SUBTARGET_ASM_FLOAT_SPEC): Define.
Pass -mfpu=fpa to GAS by default.
Index: gcc/config/arm/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/elf.h,v
retrieving revision 1.44
diff -c -3 -p -r1.44 elf.h
*** gcc/config/arm/elf.h 19 Jun 2003 21:47:06 -0000 1.44
--- gcc/config/arm/elf.h 23 Jul 2003 18:32:24 -0000
***************
*** 46,52 ****
#ifndef SUBTARGET_ASM_FLOAT_SPEC
#define SUBTARGET_ASM_FLOAT_SPEC "\
! %{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
#endif
#ifndef ASM_SPEC
--- 46,52 ----
#ifndef SUBTARGET_ASM_FLOAT_SPEC
#define SUBTARGET_ASM_FLOAT_SPEC "\
! %{mapcs-float:-mfloat} %{!mhard-float:-mfpu=softfpa} %{mhard-float:-mfpu=fpa}"
#endif
#ifndef ASM_SPEC
Index: gcc/config/arm/linux-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/linux-elf.h,v
retrieving revision 1.40
diff -c -3 -p -r1.40 linux-elf.h
*** gcc/config/arm/linux-elf.h 14 Jun 2003 17:11:57 -0000 1.40
--- gcc/config/arm/linux-elf.h 23 Jul 2003 18:32:24 -0000
***************
*** 40,45 ****
--- 40,49 ----
#define MULTILIB_DEFAULTS \
{ "marm", "mlittle-endian", "mhard-float", "mapcs-32", "mno-thumb-interwork" }
+ #undef SUBTARGET_ASM_FLOAT_SPEC
+ #define SUBTARGET_ASM_FLOAT_SPEC "\
+ %{mapcs-float:-mfloat} %{!msoft-float:-mfpu=fpa} %{msoft-float:-mfpu=softfpa}"
+
#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
/* The GNU C++ standard library requires that these macros be defined. */
More information about the Binutils
mailing list