This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Build a tri-arch compiler on mips-linux-gnu


This patch is an improved version of the one we're using in Debian.
It saves the current behaviour on mips-linux-gnu and mips64-linux-gnu,
and builds a tri-arch (o32/n32/64) compiler defaulted to o32 on
mips-linux-gnu is --enable-targets=all is set. Regtesting running on
mips-linux-gnu (o32 userspace and 64-bit kernel), and I plan go do one
on mips64-linux-gnu too.
Ok for trunk when stage1 opens if all pass?


2009-23-03  Arthur Loiret  <>

	* config.gcc (mips*-*-linux*): If 'enabled_targets' is 'all', build
	a tri-arch compiler defaulting to 32-bit (ABI o32). In this case:
	(tm_file): Add mips/linux64.h.
	(tmake_file): Add mips/t-linux64.
	(tm_defines): Add MIPS_ABI_DEFAULT=ABI_32.
	* config/mips/linux64.h (DRIVER_SELF_SPECS): Use MULTILIB_ABI_DEFAULT
	instead of hardcoded mabi=n32.
	* config/mips/t-linux64 (MULTILIB_DIRNAMES): Set to 'n32 . 64' if
	tm_defines contains MIPS_ABI_DEFAULT ABI_32, to follow the glibc
	* doc/install.texi: Add mips-linux to the list of targets supporting
	--enable-targets=all. Document the effect on mips.
 gcc/config.gcc            |    7 ++++++-
 gcc/config/mips/linux64.h |    6 ++++--
 gcc/config/mips/t-linux64 |    4 ++++
 gcc/doc/install.texi      |    6 ++++--
 4 files changed, 18 insertions(+), 5 deletions(-)

--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1570,8 +1570,13 @@ mips64*-*-linux* | mipsisa64*-*-linux*)
 	test x$with_llsc != x || with_llsc=yes
 mips*-*-linux*)				# Linux MIPS, either endian.
-        tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
+	tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} mips/linux.h"
 	tmake_file="${tmake_file} mips/t-libgcc-mips16"
+	if test x$enable_targets = xall; then
+		tm_file="${tm_file} mips/linux64.h"
+		tmake_file="${tmake_file} mips/t-linux64"
+		tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_32"
+	fi
 	case ${target} in
 		tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33"
--- a/gcc/config/mips/linux64.h
+++ b/gcc/config/mips/linux64.h
@@ -20,13 +20,15 @@ along with GCC; see the file COPYING3.  If not see
 <>.  */
 /* Force the default endianness and ABI flags onto the command line
-   in order to make the other specs easier to write.  */
+   in order to make the other specs easier to write.
+   On mips64, config.gcc defines MIPS_ABI_DEFAULT to ABI_N32, so
+   we can use MULTILIB_ABI_DEFAULT.  */
   " %{!EB:%{!EL:%(endian_spec)}}" \
-  " %{!mabi=*: -mabi=n32}"
+  " %{!mabi=*: -" MULTILIB_ABI_DEFAULT "}"
 #undef LIB_SPEC
 #define LIB_SPEC "\
--- a/gcc/config/mips/t-linux64
+++ b/gcc/config/mips/t-linux64
@@ -1,5 +1,9 @@
 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+ifneq ($(filter MIPS_ABI_DEFAULT=ABI_32,$(tm_defines)),)
 MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1255,8 +1255,10 @@ powerpc-linux for powerpc64-linux, only generates 32-bit code.  This
 option enables the 32-bit target to be a bi-arch compiler, which is
 useful when you want a bi-arch compiler that defaults to 32-bit, and
 you are building a bi-arch or multi-arch binutils in a combined tree.
-Currently, this option only affects sparc-linux, powerpc-linux and
+On mips-linux, this will build a tri-arch compiler (ABI o32/n32/64),
+defaulted to o32.
+Currently, this option only affects sparc-linux, powerpc-linux, x86-linux
+and mips-linux.
 @item --enable-secureplt
 This option enables @option{-msecure-plt} by default for powerpc-linux.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]