Patchwork [ARM] ARM / linux float ABI discrepancy

login
register
mail settings
Submitter Christophe LYON
Date Sept. 7, 2010, 12:30 p.m.
Message ID <4C863049.1050202@st.com>
Download mbox | patch
Permalink /patch/64002/
State New
Headers show

Comments

Christophe LYON - Sept. 7, 2010, 12:30 p.m.
Hi,

As I mentioned in http://gcc.gnu.org/ml/gcc/2010-08/msg00280.html, there 
is a discrepancy in the description of the default float ABI when it 
comes to multilib support for ARM/Linux.

Without this patch, using
MULTILIB_OPTIONS       = msoft-float/mhard-float

would have the effect of handling 2 lib sets both compiled as msoft-float.

The small patch I propose is attached.

Christophe.
Joseph S. Myers - Sept. 7, 2010, 1:28 p.m.
On Tue, 7 Sep 2010, Christophe Lyon wrote:

> Hi,
> 
> As I mentioned in http://gcc.gnu.org/ml/gcc/2010-08/msg00280.html, there is a
> discrepancy in the description of the default float ABI when it comes to
> multilib support for ARM/Linux.
> 
> Without this patch, using
> MULTILIB_OPTIONS       = msoft-float/mhard-float
> 
> would have the effect of handling 2 lib sets both compiled as msoft-float.
> 
> The small patch I propose is attached.

The floating-point ABI issue isn't as simple as your patch would suggest, 
because the default can be controlled with the --with-float configure 
option.  In addition, there are the alternative -mfloat-abi=* spellings, 
so you need either to add MULTILIB_MATCHES for those to work properly, or 
to make -mhard-float and -msoft-float really be aliases for the canonical 
-mfloat-abi= versions using the .opt alias machinery (and then adjust all 
the t-* files using those options accordingly).  (Once my multilib 
selection changes are finished, it wouldn't actually be necessary to mark 
the options as aliases to get the multilib selection working correctly.)

The endianness part may be the remaining bit of PR target/16350.
Christophe LYON - Sept. 7, 2010, 3:09 p.m.
> The floating-point ABI issue isn't as simple as your patch would suggest,
> because the default can be controlled with the --with-float configure
> option.
Indeed, I did not take this configure flag into account.

I just meant to make the default more coherent.

>  In addition, there are the alternative -mfloat-abi=* spellings,
> so you need either to add MULTILIB_MATCHES for those to work properly, or
> to make -mhard-float and -msoft-float really be aliases for the canonical
> -mfloat-abi= versions using the .opt alias machinery (and then adjust all
> the t-* files using those options accordingly).  (Once my multilib
> selection changes are finished, it wouldn't actually be necessary to mark
> the options as aliases to get the multilib selection working correctly.)

I didn't mention same for the sake of clarity/shortness in my email.

My patch is just here for the casual "user" who wants to add some 
multilibs, without adding -with-float= and who doesn't understand why he 
gets the wrong lib variants generated.


As of handling -with-float= it does seem to require some work in the 
initialization phase, so as to properly override the multilib_defauts 
before they are taken into account.

Christophe.

Patch

diff -rup gcc-4.5.0/gcc/config/arm/linux-eabi.h gcc-4.5.0.patched//gcc/config/arm/linux-eabi.h
--- gcc-4.5.0/gcc/config/arm/linux-eabi.h	2009-10-30 21:03:09.000000000 +0100
+++ gcc-4.5.0.patched//gcc/config/arm/linux-eabi.h	2010-09-07 09:51:13.000000000 +0200
@@ -35,6 +35,10 @@ 
 #undef  TARGET_DEFAULT_FLOAT_ABI
 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
 
+#undef  MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS \
+	{ "marm", TARGET_ENDIAN_OPTION, "msoft-float", "mno-thumb-interwork" }
+
 /* We default to the "aapcs-linux" ABI so that enums are int-sized by
    default.  */
 #undef  ARM_DEFAULT_ABI
diff -rup gcc-4.5.0/gcc/config/arm/linux-elf.h gcc-4.5.0.patched//gcc/config/arm/linux-elf.h
--- gcc-4.5.0/gcc/config/arm/linux-elf.h	2009-11-05 15:47:45.000000000 +0100
+++ gcc-4.5.0.patched//gcc/config/arm/linux-elf.h	2010-09-07 09:51:09.000000000 +0200
@@ -51,7 +51,7 @@ 
 
 #undef  MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS \
-	{ "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
+	{ "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
 
 /* Now we define the strings used to build the spec file.  */
 #undef  LIB_SPEC