Patchwork GNU/kFreeBSD systems running on MIPS

login
register
mail settings
Submitter Robert Millan
Date July 21, 2011, 10:45 p.m.
Message ID <CAOfDtXOLTq3Uk6St_HomWSmoX6bGe9=vuD0ZnBKezWb5bjsZbQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/106183/
State New
Headers show

Comments

Robert Millan - July 21, 2011, 10:45 p.m.
This patch adds support for GNU/kFreeBSD systems running on MIPS.
Richard Sandiford - July 25, 2011, 8:30 p.m.
Robert Millan <rmh@gnu.org> writes:
> This patch adds support for GNU/kFreeBSD systems running on MIPS.

Looks good.  However, Rainer's in the middle of moving things from gcc/
to libgcc/ -- where they belong -- and committing a new port now would
interfere with that.  If it's OK, I'd like to hold off applying this
until Rainer's finished his changes.

Thanks,
Richard
Robert Millan - July 26, 2011, 7:06 a.m.
2011/7/25 Richard Sandiford <rdsandiford@googlemail.com>:
> Robert Millan <rmh@gnu.org> writes:
>> This patch adds support for GNU/kFreeBSD systems running on MIPS.
>
> Looks good.  However, Rainer's in the middle of moving things from gcc/
> to libgcc/ -- where they belong -- and committing a new port now would
> interfere with that.  If it's OK, I'd like to hold off applying this
> until Rainer's finished his changes.

It's ok.  Could you give a rough estimate? (few days / weeks / months)
Rainer Orth - July 26, 2011, 9:24 a.m.
Robert,

> 2011/7/25 Richard Sandiford <rdsandiford@googlemail.com>:
>> Robert Millan <rmh@gnu.org> writes:
>>> This patch adds support for GNU/kFreeBSD systems running on MIPS.
>>
>> Looks good.  However, Rainer's in the middle of moving things from gcc/
>> to libgcc/ -- where they belong -- and committing a new port now would
>> interfere with that.  If it's OK, I'd like to hold off applying this
>> until Rainer's finished his changes.

thanks.

> It's ok.  Could you give a rough estimate? (few days / weeks / months)

I'm in the middle of moving shlib support (another day), need to rebase
crtstuff and libgcc1, and finish libgcc2.

I hope to be ready within two or three weeks.

	Rainer
Robert Millan - July 26, 2011, 1:17 p.m.
2011/7/26 Rainer Orth <ro@cebitec.uni-bielefeld.de>:
> I'm in the middle of moving shlib support (another day), need to rebase
> crtstuff and libgcc1, and finish libgcc2.
>
> I hope to be ready within two or three weeks.

Ok then.  I'd appreciate if you can send me a reminder via private
mail when you've finished.

Best regards
Robert Millan - Aug. 17, 2011, 12:45 p.m.
Hi!

2011/7/26 Rainer Orth <ro@cebitec.uni-bielefeld.de>:
> Robert,
>
>> 2011/7/25 Richard Sandiford <rdsandiford@googlemail.com>:
>>> Robert Millan <rmh@gnu.org> writes:
>>>> This patch adds support for GNU/kFreeBSD systems running on MIPS.
>>>
>>> Looks good.  However, Rainer's in the middle of moving things from gcc/
>>> to libgcc/ -- where they belong -- and committing a new port now would
>>> interfere with that.  If it's OK, I'd like to hold off applying this
>>> until Rainer's finished his changes.
> I'm in the middle of moving shlib support (another day), need to rebase
> crtstuff and libgcc1, and finish libgcc2.

My patch still applies cleanly to current HEAD, has this migration
happened already?  If not, what's the current ETA?  I'll have almost
no spare time after this week, I'd like to sort this out before/during
the weekend if possible.

Thanks!
Rainer Orth - Aug. 17, 2011, 1:48 p.m.
Hi Robert,

> My patch still applies cleanly to current HEAD, has this migration
> happened already?  If not, what's the current ETA?  I'll have almost
> no spare time after this week, I'd like to sort this out before/during
> the weekend if possible.

all the relevant patches have been posted by now.  One needs a bit work,
the others are awaiting review.

	Rainer
Robert Millan - Sept. 23, 2011, 9:12 p.m.
Hi there,

2011/8/17 Rainer Orth <ro@cebitec.uni-bielefeld.de>:
> Hi Robert,
>
>> My patch still applies cleanly to current HEAD, has this migration
>> happened already?  If not, what's the current ETA?  I'll have almost
>> no spare time after this week, I'd like to sort this out before/during
>> the weekend if possible.
>
> all the relevant patches have been posted by now.  One needs a bit work,
> the others are awaiting review.

Is there any news about this?

Patch

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

	Support for GNU/kFreeBSD systems running on MIPS.

	* config.gcc: Detect mips*-*-kfreebsd*-gnu.
	* config.host: Likewise.
	* config/mips/kfreebsd-gnu.h: New file.
	* config/mips/kfreebsd-gnu64.h: New file.
	* config/mips/gnu-user.h: Restrict `-march=native' support to GNU/Linux.

Index: libgcc/config.host
===================================================================
--- libgcc/config.host	(revision 176595)
+++ libgcc/config.host	(working copy)
@@ -478,6 +478,14 @@ 
 	tmake_file="{$tmake_file} t-crtfm"
 	md_unwind_header=mips/linux-unwind.h
 	;;
+mips64*-*-kfreebsd*-gnu)
+	extra_parts="$extra_parts crtfastmath.o"
+	tmake_file="{$tmake_file} t-crtfm"
+	;;
+mips*-*-kfreebsd*-gnu)			# GNU/kFreeBSD MIPS, either endian.
+	extra_parts="$extra_parts crtfastmath.o"
+	tmake_file="{$tmake_file} t-crtfm"
+	;;
 mips*-*-openbsd*)
 	;;
 mipsisa32-*-elf* | mipsisa32el-*-elf*)
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 176595)
+++ gcc/config.gcc	(working copy)
@@ -1819,20 +1819,28 @@ 
 	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*)
-	tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.h mips/linux64.h"
+mips64*-*-linux* | mipsisa64*-*-linux* | mips64*-*-kfreebsd*-gnu | mipsisa64*-*-kfreebsd*-gnu)
+	tm_file="dbxelf.h elfos.h gnu-user.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/gnu-user64.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
+		linux*)
+			tm_file="${tm_file} linux.h mips/linux64.h"
+			;;
+		kfreebsd*-gnu)
+			tm_file="${tm_file} kfreebsd-gnu.h mips/kfreebsd-gnu64.h"
+			;;
+	esac
 	case ${target} in
-		mips64el-st-linux-gnu)
+		mips64el-st-*)
 			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
@@ -1841,11 +1849,27 @@ 
 	gas=yes
 	test x$with_llsc != x || with_llsc=yes
 	;;
-mips*-*-linux*)				# Linux MIPS, either endian.
-        tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h"
+mips*-*-linux* | mips*-*-kfreebsd*-gnu)			# GNU/* MIPS, either endian.
+        tm_file="dbxelf.h elfos.h gnu-user.h glibc-stdint.h ${tm_file} mips/gnu-user.h"
 	tmake_file="${tmake_file} mips/t-libgcc-mips16"
+	case ${target_os} in
+		linux*)
+			tm_file="${tm_file} linux.h mips/linux.h"
+			;;
+		kfreebsd*-gnu)
+			tm_file="${tm_file} kfreebsd-gnu.h mips/kfreebsd-gnu.h"
+			;;
+	esac
 	if test x$enable_targets = xall; then
-		tm_file="${tm_file} mips/gnu-user64.h mips/linux64.h"
+		tm_file="${tm_file} mips/gnu-user64.h"
+		case ${target_os} in
+			linux*)
+				tm_file="${tm_file} mips/linux64.h"
+				;;
+			kfreebsd*-gnu)
+				tm_file="${tm_file} mips/kfreebsd-gnu64.h"
+				;;
+		esac
 		tmake_file="${tmake_file} mips/t-linux64"
 		tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_32"
 	fi
Index: gcc/config/mips/gnu-user.h
===================================================================
--- gcc/config/mips/gnu-user.h	(revision 176595)
+++ gcc/config/mips/gnu-user.h	(working copy)
@@ -106,8 +106,8 @@ 
 #endif
 
 /* -march=native handling only makes sense with compiler running on
-   a MIPS chip.  */
-#if defined(__mips__)
+   a MIPS chip.  Also, for now only Linux targets are supported.  */
+#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 },
Index: gcc/config/mips/kfreebsd-gnu64.h
===================================================================
--- gcc/config/mips/kfreebsd-gnu64.h	(revision 0)
+++ gcc/config/mips/kfreebsd-gnu64.h	(revision 0)
@@ -0,0 +1,31 @@ 
+/* Definitions for MIPS running kFreeBSD-based GNU systems with ELF format
+   using n32/64 abi.
+   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/>.  */
+
+#define GNU_USER_LINK_EMULATION32	"elf32%{EB:b}%{EL:l}tsmip_fbsd"
+#define GNU_USER_LINK_EMULATION64	"elf64%{EB:b}%{EL:l}tsmip_fbsd"
+#define GNU_USER_LINK_EMULATIONN32	"elf32%{EB:b}%{EL:l}tsmipn32_fbsd"
+
+#define GLIBC_DYNAMIC_LINKER32		"/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER64		"/lib64/ld.so.1"
+#define GLIBC_DYNAMIC_LINKERN32		"/lib32/ld.so.1"
+
+#define GNU_USER_DYNAMIC_LINKERN32	GLIBC_DYNAMIC_LINKERN32
Index: gcc/config/mips/kfreebsd-gnu.h
===================================================================
--- gcc/config/mips/kfreebsd-gnu.h	(revision 0)
+++ gcc/config/mips/kfreebsd-gnu.h	(revision 0)
@@ -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/>.  */
+
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"