[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mipseb-linux support (sgi indy's)



(tried with 19981213 and 19981206, but should work with any version of
egcs, and likely with gcc 2.8* as well.)

This should add support for mips-unknown-linux-gnu.  mainly, this is
useful for SGI Indy's running linux.  It's not perfect. g++ still fails
about 800 of it's tests, but otherwise it's ok.  This is based off the
mipsel linux.h, and some of the other linux arch's linux.h files -
mostly arm and sparc.

One thing that's somewhat questionable about this patch.  I set the
default cpu to a R4000.  i think that will still work on R3000s, but i'm
not sure.  For the moment, it;s a moot point since i think there are no
R3000 big endian machines that will boot linux.

If this is deemed large enough to require a formal copyright assignment,
that's no big deal.  just let me know.

job

--- orig/egcs-19981213/gcc/configure    Sun Dec 13 15:35:03 1998
+++ egcs-19981213/gcc/configure Tue Dec 15 16:14:47 1998
@@ -4480,10 +4480,10 @@
        mips*-*-linux*)                         # Linux MIPS, either endian.
                xmake_file=x-linux
                xm_file="xm-siglist.h ${xm_file}"
-               case $machine in
+                case $machine in
                        mipsel-*)  tm_file="mips/elfl.h mips/linux.h" ;;
-                       *)         tm_file="mips/elf.h mips/linux.h" ;;
-               esac
+                       *)         tm_file="mips/elf.h mips/linuxeb.h" ;;
+                esac
                extra_parts="crtbegin.o crtend.o"
                gnu_ld=yes
                gas=yes

diff -u -N -r orig/egcs-19981213/gcc/config/mips/linuxeb.h egcs-19981213/gcc/config/mips/linuxeb.h
--- orig/egcs-19981213/gcc/config/mips/linuxeb.h	Wed Dec 31 18:00:00 1969
+++ egcs-19981213/gcc/config/mips/linuxeb.h	Wed Dec 16 09:27:19 1998
@@ -0,0 +1,163 @@
+/* Definitions for MIPS running Linux-based GNU systems with ELF format.
+   (Big Endian)
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
+
+GNU CC 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 GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#undef MACHINE_TYPE 
+#define MACHINE_TYPE "MIPS Linux/ELF (Big Endian)"
+
+/* Required to keep collect2.c happy ; done in mips/elf.h but i'm paranoid */
+#undef  OBJECT_FORMAT_COFF 
+#ifndef OBJECT_FORMAT_ELF
+#define OBJECT_FORMAT_ELF
+#endif
+
+#undef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { "EB", "mips1" }
+
+/* Don't assume anything about the header files. */
+#define NO_IMPLICIT_EXTERN_C
+
+#define LINUX_DEFAULT_ELF
+#define HAVE_ATEXIT
+#define TARGET_MEM_FUNCTIONS
+#undef MD_EXEC_PREFIX
+#undef MD_STARTFILE_PREFIX
+#undef ASM_FINAL_SPEC
+
+/* If we don't set MASK_ABICALLS, we can't default to PIC. */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS)
+
+
+/*
+ * we need to force this since mips.h was already included and sets 
+ * the default abi to ABI_32 (o32).  this probably should not be here.
+ */
+/* #undef mips_abi */
+/* #define mips_abi ABI_N32 */
+/* #define MIPS_ISA_DEFAULT 3 */
+/* #define MIPS_ABI_DEFAULT ABI_N32 */
+
+/*
+ * Specify predefined symbols in preprocessor.
+ */
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "-Dmips -DMIPSEB -DR4000 -D_mips -D_MIPSEB -D_R4000 \
+-D__ELF__ -Dunix -D_R4000 -Dlinux -Asystem(linux) -Asystem(posix) \
+-Acpu(mips) -Amachine(mips)"
+
+/* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
+   the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
+   provides part of the support for getting C++ file-scope static
+   object constructed before entering `main'. */
+
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC \
+  "%{!shared: \
+     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
+   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+
+/* Provide a ENDFILE_SPEC appropriate for GNU/Linux.  Here we tack on
+   the GNU/Linux magical crtend.o file (see crtstuff.c) which
+   provides part of the support for getting C++ file-scope static
+   object constructed before entering `main', followed by a normal
+   GNU/Linux "finalizer" file, `crtn.o'.  */
+
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+
+/* From iris5.h but since we use gas, default to gas's val of 0, not 8 */
+/* -G is incompatible with -KPIC which is the default, so only allow objects
+   in the small data section if the user explicitly asks for it.  */
+#undef MIPS_DEFAULT_GVALUE
+#define MIPS_DEFAULT_GVALUE 0
+
+/* Borrowed from sparc/linux.h and mips/linux.h */
+#undef LINK_SPEC
+#define LINK_SPEC "-Y P,/usr/lib %{shared:-shared} \
+%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
+%{bestGnum} %(linker_endian_spec) \
+  %{!shared: \
+    %{!ibcs: \
+      %{!static: \
+        %{rdynamic:-export-dynamic} \
+        %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
+        %{static:-static}}}"
+
+/* Borrowed from sparc/linux.h */
+/* We no longer link with libc_p.a or libg.a by default. If you
+   want to profile or debug the GNU/Linux C library, please add
+   -lc_p or -ggdb to LDFLAGS at the link time, respectively.  */
+#undef LIB_SPEC
+#define LIB_SPEC \
+  "%{shared: -lc} \
+   %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
+     %{profile:-lc_p} %{!profile: -lc}}"
+
+#undef SUBTARGET_ASM_SPEC
+#define SUBTARGET_ASM_SPEC "-KPIC"
+
+/* from iris6.h  ; tweaked to be o32/mips1 not n32/mips3*/
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "\
+%{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
+%{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
+%{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
+%{mips4: -D_MIPS_ISA=_MIPS_ISA_MIPS4} \
+%{!mips*: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
+%{mabi=32: -D_MIPS_SIM=_MIPS_SIM_ABI32}	\
+%{mabi=n32: -D_ABIN32=2 -D_MIPS_SIM=_ABIN32} \
+%{mabi=64: -D_ABI64=3 -D_MIPS_SIM=_ABI64} \
+%{!mabi*: -D_MIPS_SIM=_ABI32} \
+%{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \
+%{mabi=32: -D_MIPS_SZLONG=32} \
+%{mabi=n32: -D_MIPS_SZLONG=32} \
+%{mabi=64: -D_MIPS_SZLONG=64} \
+%{!mabi*: -D_MIPS_SZLONG=32} \
+%{mabi=32: -D_MIPS_SZPTR=32} \
+%{mabi=n32: -D_MIPS_SZPTR=32} \
+%{mabi=64: -D_MIPS_SZPTR=64} \
+%{!mabi*: -D_MIPS_SZPTR=32} \
+%{!mips*: -U__mips -D__mips=1} \
+%{mabi=32: -U__mips64} \
+%{mabi=n32: -D__mips64} \
+%{mabi=64: -D__mips64} \
+%{!mabi*: -U__mips64} \
+%{!mlong64: -D_MIPS_SZLONG=32}%{mlong64: -D_MIPS_SZLONG=64}"
+
+
+/* Support const sections and the ctors and dtors sections for g++.
+   Note that there appears to be two different ways to support const
+   sections at the moment.  You can either #define the symbol
+   READONLY_DATA_SECTION (giving it some code which switches to the
+   readonly data section) or else you can #define the symbols
+   EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
+   SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
+
+/* defined elsewhere : (mips/mips.h)
+ * EXTRA_SECTION_FUNCTIONS
+ * SELECT_RTX_SECTION
+ * EXTRA_SECTIONS
+ * SELECT_SECTION
+*/
+
+#define USE_CONST_SECTION	1
+


Reply to: