diff mbox

[#4] Support for MIPS targets running GNU/kFreeBSD

Message ID AANLkTi=exT-pq7KPeadivkvyvF33wc5uUi=N9ZEU3=Zu@mail.gmail.com
State New
Headers show

Commit Message

Robert Millan Jan. 22, 2011, 10:04 p.m. UTC
This patch adds support for MIPS targets running GNU/kFreeBSD.

It depends on my previous patch, sent in a message with title
"Support for AMD64 targets running GNU/kFreeBSD".

ChangeLog entry is in patch header.
diff mbox

Patch

2011-01-22  Robert Millan  <rmh@gnu.org>

	Support for MIPS targets running GNU/kFreeBSD.

	* config.gcc: Detect mips*-*-kfreebsd*-gnu.
	* config.host: Likewise.
	* config/mips/kfreebsd-gnu.h: New file (undefines MD_UNWIND_SUPPORT).
	* config/mips/linux.h: Restrict `-march=native' support to GNU/Linux.
	* config/mips/linux64.h (LINK_SPEC): Process emulation names through
	LINK_EMULATION().

=== modified file 'gcc/config.gcc'
--- gcc/config.gcc	2011-01-22 10:38:43 +0000
+++ gcc/config.gcc	2011-01-22 11:58:21 +0000
@@ -1816,20 +1816,25 @@  mips*-*-netbsd*)			# NetBSD/mips, either
 	tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h"
 	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
 	;;
-mips64*-*-linux* | mipsisa64*-*-linux*)
+mips64*-*-linux* | mipsisa64*-*-linux* | mips64*-*-kfreebsd*-gnu | mipsisa64*-*-kfreebsd*-gnu)
 	tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/linux.h mips/linux64.h"
 	tmake_file="${tmake_file} mips/t-linux64 mips/t-libgcc-mips16"
 	tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
+	case ${target_os} in
+		kfreebsd*-gnu)
+			tm_file="${tm_file} kfreebsd-gnu.h mips/kfreebsd-gnu.h"
+			;;
+	esac
 	case ${target} in
 		mips64el-st-linux-gnu)
 			tm_file="${tm_file} mips/st.h"
 			tmake_file="${tmake_file} mips/t-st"
 			;;
-		mips64octeon*-*-linux*)
+		mips64octeon*-*-*)
 			tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\""
 			target_cpu_default=MASK_SOFT_FLOAT_ABI
 			;;
-		mipsisa64r2*-*-linux*)
+		mipsisa64r2*-*-*)
 			tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65"
 			;;
 	esac
@@ -1838,9 +1843,14 @@  mips64*-*-linux* | mipsisa64*-*-linux*)
 	gas=yes
 	test x$with_llsc != x || with_llsc=yes
 	;;
-mips*-*-linux*)				# Linux MIPS, either endian.
+mips*-*-linux* | mips*-*-kfreebsd*-gnu)			# GNU/* MIPS, either endian.
         tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/linux.h"
 	tmake_file="${tmake_file} mips/t-libgcc-mips16"
+	case ${target_os} in
+	kfreebsd*-gnu)
+		tm_file="${tm_file} kfreebsd-gnu.h mips/kfreebsd-gnu.h"
+		;;
+	esac
 	case ${target} in
         mipsisa32r2*)
 		tm_defines="${tm_defines} MIPS_ISA_DEFAULT=33"

=== added file 'gcc/config/mips/kfreebsd-gnu.h'
--- gcc/config/mips/kfreebsd-gnu.h	1970-01-01 00:00:00 +0000
+++ gcc/config/mips/kfreebsd-gnu.h	2011-01-22 11:58:21 +0000
@@ -0,0 +1,22 @@ 
+/* Definitions for MIPS running kFreeBSD-based GNU systems with ELF format
+   Copyright (C) 2011
+   Free Software Foundation, Inc.
+   Contributed by Robert Millan.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#undef MD_UNWIND_SUPPORT

=== modified file 'gcc/config/mips/linux.h'
--- gcc/config/mips/linux.h	2011-01-18 22:00:14 +0000
+++ gcc/config/mips/linux.h	2011-01-22 11:58:21 +0000
@@ -117,8 +117,8 @@  along with GCC; see the file COPYING3.
 #endif
 
 /* -march=native handling only makes sense with compiler running on
-   a MIPS chip.  */
-#if defined(__mips__)
+   a MIPS chip (and for now, it is only supported on GNU/Linux).  */
+#if defined(__mips__) && defined(__linux__)
 extern const char *host_detect_local_cpu (int argc, const char **argv);
 # define EXTRA_SPEC_FUNCTIONS \
   { "local_cpu_detect", host_detect_local_cpu },

=== modified file 'gcc/config/mips/linux64.h'
--- gcc/config/mips/linux64.h	2011-01-18 22:00:14 +0000
+++ gcc/config/mips/linux64.h	2011-01-22 11:58:21 +0000
@@ -57,9 +57,9 @@  along with GCC; see the file COPYING3.
       %{mabi=64: -dynamic-linker " LINUX_DYNAMIC_LINKER64 "} \
       %{mabi=32: -dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
     %{static:-static}} \
-%{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
-%{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
-%{mabi=32:-melf32%{EB:b}%{EL:l}tsmip}"
+%{mabi=n32:-m" LINK_EMULATION("elf32%{EB:b}%{EL:l}tsmipn32") "} \
+%{mabi=64:-m" LINK_EMULATION("elf64%{EB:b}%{EL:l}tsmip") "} \
+%{mabi=32:-m" LINK_EMULATION("elf32%{EB:b}%{EL:l}tsmip") "}"
 
 #undef LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX (TARGET_OLDABI ? "$" : ".")

=== modified file 'libgcc/config.host'
--- libgcc/config.host	2011-01-18 22:00:14 +0000
+++ libgcc/config.host	2011-01-22 11:58:21 +0000
@@ -409,11 +409,11 @@  mips-sgi-irix[56]*)
 	;;
 mips*-*-netbsd*)			# NetBSD/mips, either endian.
 	;;
-mips64*-*-linux*)
+mips64*-*-linux* | mips64*-*-kfreebsd*-gnu)
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="{$tmake_file} mips/t-crtfm"
 	;;
-mips*-*-linux*)				# Linux MIPS, either endian.
+mips*-*-linux* | mips*-*-kfreebsd*-gnu)		# GNU/* MIPS, either endian.
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="{$tmake_file} mips/t-crtfm"
 	;;