public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* arm-elf MULTILIBS_DEFAULT
@ 2003-02-27  6:16 Ralf Corsepius
  2003-02-27 11:22 ` Richard Earnshaw
  0 siblings, 1 reply; 5+ messages in thread
From: Ralf Corsepius @ 2003-02-27  6:16 UTC (permalink / raw)
  To: GCC List

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? 

TIA,
	Ralf



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

* Re: arm-elf MULTILIBS_DEFAULT
  2003-02-27  6:16 arm-elf MULTILIBS_DEFAULT Ralf Corsepius
@ 2003-02-27 11:22 ` Richard Earnshaw
  2003-02-28  8:20   ` Ralf Corsepius
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Earnshaw @ 2003-02-27 11:22 UTC (permalink / raw)
  To: Ralf Corsepius; +Cc: GCC List, 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).

R.

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

* Re: arm-elf MULTILIBS_DEFAULT
  2003-02-27 11:22 ` Richard Earnshaw
@ 2003-02-28  8:20   ` Ralf Corsepius
  2003-02-28 10:55     ` Richard Earnshaw
  0 siblings, 1 reply; 5+ messages in thread
From: Ralf Corsepius @ 2003-02-28  8:20 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: GCC List, Joel Sherrill

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

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


[-- Attachment #2: gcc-3.2.2-arm-rtems-rc-20030227-1.diff --]
[-- Type: text/plain, Size: 1520 bytes --]

--- 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}}"

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

* Re: arm-elf MULTILIBS_DEFAULT
  2003-02-28  8:20   ` Ralf Corsepius
@ 2003-02-28 10:55     ` Richard Earnshaw
  2003-02-28 13:09       ` Ralf Corsepius
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Earnshaw @ 2003-02-28 10:55 UTC (permalink / raw)
  To: Ralf Corsepius; +Cc: Richard.Earnshaw, GCC List, Joel Sherrill


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

Nearly, but not quite.

> +
> +/* Because TARGET_DEFAULT sets ARM_FLAG_SOFT_FLOAT */
> +#undef SUBTARGET_EXTRA_ASM_SPEC
> +#define SUBTARGET_EXTRA_ASM_SPEC "\
> +   %{!mhard-float: \
> +    %{!msoft-float:-mno-fpu}}"
> 

This should be in SUBTARGET_ASM_FLOAT_SPEC.

Also, the order of your include files looks suspect (in config.gcc); I 
think it should be

dbxelf.h elfos.h arm/rtems-elf.h rtems.h arm/elf.h arm/aout.h arm/arm.h

Note that arm/unknown-elf.h should not be included -- it's for an unknown 
OS environment and is bogus in this instance (if there really is a 
definition in this file that you rely on, copy it to arm/rtems-elf.h).

Once you have the include order correct it won't be necessary to keep 
undefining macros before defining variants.

R.

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

* Re: arm-elf MULTILIBS_DEFAULT
  2003-02-28 10:55     ` Richard Earnshaw
@ 2003-02-28 13:09       ` Ralf Corsepius
  0 siblings, 0 replies; 5+ messages in thread
From: Ralf Corsepius @ 2003-02-28 13:09 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: GCC List, Joel Sherrill

Am Fre, 2003-02-28 um 11.15 schrieb Richard Earnshaw:
> > Below is the patch I am currently using and which AFAIS seems to
> > implement the desired behavior.
> > 
> > Ralf
> 
> Nearly, but not quite.
> 
> > +
> > +/* Because TARGET_DEFAULT sets ARM_FLAG_SOFT_FLOAT */
> > +#undef SUBTARGET_EXTRA_ASM_SPEC
> > +#define SUBTARGET_EXTRA_ASM_SPEC "\
> > +   %{!mhard-float: \
> > +    %{!msoft-float:-mno-fpu}}"
> > 
> 
> This should be in SUBTARGET_ASM_FLOAT_SPEC.
Hmm, I saw that you redirect it, but ...

> Also, the order of your include files looks suspect (in config.gcc); I 
> think it should be
> 
> dbxelf.h elfos.h arm/rtems-elf.h rtems.h arm/elf.h arm/aout.h arm/arm.h
> 
> Note that arm/unknown-elf.h should not be included -- it's for an unknown 
> OS environment and is bogus in this instance (if there really is a 
> definition in this file that you rely on, copy it to arm/rtems-elf.h).
Bummer, I just extended what has been present before. 
This arm-rtems must have been broken for quite a while :-(

> Once you have the include order correct it won't be necessary to keep 
> undefining macros before defining variants.
OK, this might explain why I am having problems at all. I was already
wondering why the different defaults didn't match :-(

Ralf
 

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

end of thread, other threads:[~2003-02-28 10:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-27  6:16 arm-elf MULTILIBS_DEFAULT Ralf Corsepius
2003-02-27 11:22 ` Richard Earnshaw
2003-02-28  8:20   ` Ralf Corsepius
2003-02-28 10:55     ` Richard Earnshaw
2003-02-28 13:09       ` Ralf Corsepius

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).