arm-elf MULTILIBS_DEFAULT

Ralf Corsepius corsepiu@faw.uni-ulm.de
Fri Feb 28 08:20:00 GMT 2003


Am Don, 2003-02-27 um 11.36 schrieb Richard Earnshaw:
> > Hi,
> > 
> > I am trying to extend the multilib being used for arm-rtems (more less
> > is identical to arm-*-elf).
> > 
> > To do so, I introduced a gcc/config/arm/t-rtems containing this:
> > MULTILIB_OPTIONS     = marm/mthumb msoft-float/mhard-float
> > MULTILIB_DIRNAMES    = arm thumb soft fpu
> > MULTILIB_EXCEPTIONS  =
> > MULTILIB_MATCHES =
> > 
> > Resulting into this multilibs:
> > # /opt/rtems/bin/arm-rtems-gcc -print-multi-lib
> > .;
> > thumb;@mthumb
> > fpu;@mhard-float
> > thumb/fpu;@mthumb@mhard-float
> > 
> > [Note this assumes '.' to imply -msoft-float -marm]
> > 
> > However, when trying to link an arbitrary fp-application using
> > -msoft-float I end up with the linker complaining about FP-stuff:
> > 
> > # /opt/rtems/bin/arm-rtems-gcc -msoft-float tmp.c
> > /opt/rtems/lib/gcc-lib/arm-rtems/3.2.2/../../../../arm-rtems/bin/ld:
> > ERROR: /opt/rtems/lib/gcc-lib/arm-rtems/3.2.2/libgcc.a(_df_to_sf.o) uses
> > hardware FP, whereas a.out uses software FP
> > ..
> > 
> > If I understand correctly, this indicates that the arm-elf default flags
> > do not match with arm-elf's MULTILIB_DEFAULTS (from arm-elf.h).
> > 
> > What am I missing? 
> > 
> >
> You need to ensure that the compiler driver passes the correct flags to 
> the assembler when the default multilib  variant is selected.  You do this 
> in rtems-elf.h (take a look at the way netbsd-elf.h does it).

Thanks for the hint, Richard.

Below is the patch I am currently using and which AFAIS seems to
implement the desired behavior.

Ralf

-------------- next part --------------
--- gcc-3.2.2.orig/gcc/config.gcc	2003-02-25 15:45:35.000000000 +0100
+++ gcc-3.2.2/gcc/config.gcc	2003-02-25 18:55:15.000000000 +0100
@@ -746,7 +746,7 @@
 arm*-*-rtems*)
 	xm_defines=POSIX
 	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/rtems-elf.h rtems.h"
-	tmake_file="arm/t-arm-elf t-rtems"
+	tmake_file="arm/t-arm-elf arm/t-rtems t-rtems"
 	if test x$enable_threads = xyes; then
 	  thread_file='rtems'
 	fi
--- gcc-3.2.2.orig/gcc/config/arm/t-rtems	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.2.2/gcc/config/arm/t-rtems	2003-02-26 05:10:35.000000000 +0100
@@ -0,0 +1,4 @@
+MULTILIB_OPTIONS     = marm/mthumb msoft-float/mhard-float
+MULTILIB_DIRNAMES    = arm thumb soft fpu
+MULTILIB_EXCEPTIONS  = 
+MULTILIB_MATCHES = marm=mno-thumb
--- gcc-3.2.2/gcc/config/arm/rtems-elf.h	2002-05-01 02:11:01.000000000 +0200
+++ gcc-3.2.2/gcc/config/arm/rtems-elf.h	2003-02-27 16:27:21.000000000 +0100
@@ -26,3 +26,17 @@
 
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES "-D__rtems__ -D__ELF__ -Asystem=rtems"
+
+/* Redefine it to be independent of any defaults */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT  (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME)
+
+/* Because TARGET_DEFAULT sets ARM_FLAG_SOFT_FLOAT */
+#undef CPP_FLOAT_DEFAULT_SPEC
+#define CPP_FLOAT_DEFAULT_SPEC "-D__SOFTFP__"
+
+/* Because TARGET_DEFAULT sets ARM_FLAG_SOFT_FLOAT */
+#undef SUBTARGET_EXTRA_ASM_SPEC
+#define SUBTARGET_EXTRA_ASM_SPEC "\
+   %{!mhard-float: \
+    %{!msoft-float:-mno-fpu}}"


More information about the Gcc mailing list