MULTILIB_DEFAULTS need an update for ARM multilib builds
Matthias Klose
doko at ubuntu.com
Mon Apr 30 16:28:09 UTC 2012
I did see gcc-4.7 fail to build for an sf/hf multilib configuration. The reason
was that gcc -print-multi-directory didn't print anything for the non-default,
and gcc -print-multi-lib only prints `.'. The reason is that set_multilib_dir
in gcc.c only consults MULTILIB_DEFAULTS (only defined in linux-elf.h), but not
the default configure options in configargs.h. This proposed patch updates
MULTILIB_DEFAULTS depending on the configure options. An alternative approach
would be to update set_multilib_dir and print_multilib_info to lookup the
configure_default_options in configargs.h as well.
Note that this didn't fail to build in gcc-4.6, but I can't see yet what change
did cause the build failure.
Matthias
-------------- next part --------------
# DP: Set MULTILIB_DEFAULTS for ARM multilib builds
--- a/src/gcc/config.gcc
+++ b/src/gcc/config.gcc
@@ -3053,6 +3053,9 @@
"" \
| soft | hard | softfp)
# OK
+ if test x{$with_float} != x; then
+ tm_defines="${tm_defines} TARGET_CONFIGURED_FLOAT_ABI=ARM_FLOAT_ABI_`echo $with_float | tr a-z A-Z`"
+ fi
;;
*)
echo "Unknown floating point type used in --with-float=$with_float" 1>&2
@@ -3097,6 +3100,9 @@
"" \
| arm | thumb )
#OK
+ if test "$with_mode" = thumb; then
+ tm_defines="${tm_defines} TARGET_CONFIGURED_THUMB_MODE=1"
+ fi
;;
*)
echo "Unknown mode used in --with-mode=$with_mode"
--- a/src/gcc/config/arm/linux-eabi.h
+++ b/src/gcc/config/arm/linux-eabi.h
@@ -34,7 +34,11 @@
/* We default to a soft-float ABI so that binaries can run on all
target hardware. */
#undef TARGET_DEFAULT_FLOAT_ABI
+#ifdef TARGET_CONFIGURED_FLOAT_ABI
+#define TARGET_DEFAULT_FLOAT_ABI TARGET_CONFIGURED_FLOAT_ABI
+#else
#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
+#endif
/* We default to the "aapcs-linux" ABI so that enums are int-sized by
default. */
@@ -68,6 +72,36 @@
"%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
%{!mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "}"
+/* Set the multilib defaults according the configuration, needed to
+ let gcc -print-multi-dir do the right thing. */
+
+#if TARGET_BIG_ENDIAN_DEFAULT
+#define MULTILIB_DEFAULT_ENDIAN "mbig-endian"
+#else
+#define MULTILIB_DEFAULT_ENDIAN "mlittle-endian"
+#endif
+
+#if TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFT
+#define MULTILIB_DEFAULT_FLOAT_ABI "mfloat-abi=soft"
+#elif TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_SOFTFP
+#define MULTILIB_DEFAULT_FLOAT_ABI "mfloat-abi=softfp"
+#else
+#define MULTILIB_DEFAULT_FLOAT_ABI "mfloat-abi=hard"
+#endif
+
+#ifndef TARGET_CONFIGURED_THUMB_MODE
+#define MULTILIB_DEFAULT_MODE "marm"
+#elif TARGET_CONFIGURED_THUMB_MODE == 1
+#define MULTILIB_DEFAULT_MODE "mthumb"
+#else
+#define MULTILIB_DEFAULT_MODE "marm"
+#endif
+
+#undef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS \
+ { MULTILIB_DEFAULT_MODE, MULTILIB_DEFAULT_ENDIAN, \
+ MULTILIB_DEFAULT_FLOAT_ABI, "mno-thumb-interwork" }
+
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef LINK_SPEC
More information about the linaro-toolchain
mailing list