=== contrib/gcc/config/elfos.h ================================================================== --- contrib/gcc/config/elfos.h (revision 180961) +++ contrib/gcc/config/elfos.h (local) @@ -79,11 +79,14 @@ /* Output #ident as a .ident. */ - +#ifndef ASM_OUTPUT_IDENT #define ASM_OUTPUT_IDENT(FILE, NAME) \ fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME); +#endif +#ifndef IDENT_ASM_OP #define IDENT_ASM_OP "\t.ident\t" +#endif #undef SET_ASM_OP #define SET_ASM_OP "\t.set\t" @@ -194,8 +197,9 @@ #define ASCII_DATA_ASM_OP "\t.ascii\t" /* Support a read-only data section. */ +#ifndef READONLY_DATA_SECTION_ASM_OP #define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata" - +#endif /* On svr4, we *do* have support for the .init and .fini sections, and we can put stuff in there to be executed before and after `main'. We let crtstuff.c and other files know this by defining the following symbols. @@ -281,7 +285,7 @@ #endif /* Write the extra assembler code needed to declare an object properly. */ - +#ifndef ASM_DECLARE_OBJECT_NAME #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ do \ { \ @@ -301,7 +305,7 @@ ASM_OUTPUT_LABEL (FILE, NAME); \ } \ while (0) - +#endif /* Output the size directive for a decl in rest_of_decl_compilation in the case where we did not do so before the initializer. Once we find the error_mark_node, we know that the value of === contrib/gcc/config/mips/elf.h ================================================================== --- contrib/gcc/config/mips/elf.h (revision 180961) +++ contrib/gcc/config/mips/elf.h (local) @@ -51,4 +51,7 @@ #define NO_IMPLICIT_EXTERN_C 1 +#ifdef HANDLE_PRAGMA_PACK_PUSH_POP +#undef HANDLE_PRAGMA_PACK_PUSH_POP +#endif #define HANDLE_PRAGMA_PACK_PUSH_POP 1 === contrib/gcc/config/mips/_tilib.c ================================================================== --- contrib/gcc/config/mips/_tilib.c (revision 180961) +++ contrib/gcc/config/mips/_tilib.c (local) @@ -0,0 +1,158 @@ +/* A few TImode functions needed for TFmode emulated arithmetic. + Copyright 2002, 2003 Free Software Foundation, Inc. + Contributed by Alexandre Oliva + +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 2, 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 COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +#include "tconfig.h" +#include "coretypes.h" +#include "tm.h" + +#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64 + +typedef int TItype __attribute__ ((mode (TI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef int SItype __attribute__ ((mode (SI))); + +typedef unsigned int UDItype __attribute__ ((mode (DI))); + +typedef union +{ + struct TIstruct { +#if LIBGCC2_WORDS_BIG_ENDIAN + DItype high, low; +#else + DItype low, high; +#endif + } s; + TItype ll; +} TIunion; + +TItype __negti2 (TItype); +TItype __ashlti3 (TItype, int); +#if 0 +TItype __ashrti3 (TItype, int); +#endif +TItype __lshrti3 (TItype, int); + +TItype +__negti2 (TItype u) +{ + TIunion w; + TIunion uu; + + uu.ll = u; + + w.s.low = -uu.s.low; + w.s.high = -uu.s.high - ((UDItype) w.s.low > 0); + + return w.ll; +} + +TItype +__ashlti3 (TItype u, int b) +{ + TIunion w; + int bm; + TIunion uu; + + if (b == 0) + return u; + + uu.ll = u; + + bm = (sizeof (DItype) * BITS_PER_UNIT) - b; + if (bm <= 0) + { + w.s.low = 0; + w.s.high = (UDItype) uu.s.low << -bm; + } + else + { + UDItype carries = (UDItype) uu.s.low >> bm; + + w.s.low = (UDItype) uu.s.low << b; + w.s.high = ((UDItype) uu.s.high << b) | carries; + } + + return w.ll; +} + +#if 0 +TItype +__ashrti3 (TItype u, int b) +{ + TIunion w; + int bm; + TIunion uu; + + if (b == 0) + return u; + + uu.ll = u; + + bm = (sizeof (DItype) * BITS_PER_UNIT) - b; + if (bm <= 0) + { + /* w.s.high = 1..1 or 0..0 */ + w.s.high = uu.s.high >> (sizeof (DItype) * BITS_PER_UNIT - 1); + w.s.low = uu.s.high >> -bm; + } + else + { + UDItype carries = (UDItype) uu.s.high << bm; + + w.s.high = uu.s.high >> b; + w.s.low = ((UDItype) uu.s.low >> b) | carries; + } + + return w.ll; +} +#endif + +TItype +__lshrti3 (TItype u, int b) +{ + TIunion w; + int bm; + TIunion uu; + + if (b == 0) + return u; + + uu.ll = u; + + bm = (sizeof (DItype) * BITS_PER_UNIT) - b; + if (bm <= 0) + { + w.s.high = 0; + w.s.low = (UDItype) uu.s.high >> -bm; + } + else + { + UDItype carries = (UDItype) uu.s.high << bm; + + w.s.high = (UDItype) uu.s.high >> b; + w.s.low = ((UDItype) uu.s.low >> b) | carries; + } + + return w.ll; +} + +#endif /* N32 or N64 */ === contrib/gcc/config/mips/cross64.h ================================================================== --- contrib/gcc/config/mips/cross64.h (revision 180961) +++ contrib/gcc/config/mips/cross64.h (local) @@ -0,0 +1,34 @@ +/* Configuration for an Irix 5 host and Irix 6 target using SGI's cross64 + package. */ + +#define STANDARD_INCLUDE_DIR "/usr/cross64/usr/include" +#undef MD_EXEC_PREFIX +#define MD_EXEC_PREFIX "/usr/cross64/usr/bin/" +#undef MD_STARTFILE_PREFIX +#define MD_STARTFILE_PREFIX "/usr/cross64/usr/lib/lib64/" + +/* Must add TOOLROOT to the environment, or else the assembler will not + work. */ +#define INIT_ENVIRONMENT \ + "TOOLROOT=/usr/cross64" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{mips1:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \ + %{mips2:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \ + %{!mips1:%{!mips2:%{pg:/usr/cross64/usr/lib64/mips4/gcrt1.o} \ + %{!pg:%{p:/usr/cross64/usr/lib64/mips4/mcrt1.o \ + /usr/cross64/usr/lib64/mips4/libprof1.a} \ + %{!p:/usr/cross64/usr/lib64/mips4/crt1.o}}}}" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + "%{mips1:crtn.o%s}%{mips2:crtn.o%s}%{!mips1:%{!mips2:/usr/cross64/usr/lib64/mips4/crtn.o}}" + +#undef LINK_SPEC +#define LINK_SPEC "\ +-64 -_SYSTYPE_SVR4 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \ +%{bestGnum} %{shared} %{non_shared} \ +%{call_shared} %{no_archive} %{exact_version} \ +%{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \ +%{!mips1:%{!mips2:-L/usr/cross64/usr/lib64/mips4 -L/usr/cross64/usr/lib64}}" === contrib/gcc/config/mips/elf64.h ================================================================== --- contrib/gcc/config/mips/elf64.h (revision 180961) +++ contrib/gcc/config/mips/elf64.h (local) @@ -0,0 +1,116 @@ +/* Definitions of target machine for GNU compiler. MIPS R4000 version with + GOFAST floating point library. + Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2004 + Free Software Foundation, Inc. + +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 2, 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 COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Biggest alignment supported by the object file format of this + machine. Use this macro to limit the alignment which can be + specified using the `__attribute__ ((aligned (N)))' construct. If + not defined, the default value is `BIGGEST_ALIGNMENT'. */ + +#undef MAX_OFILE_ALIGNMENT +#define MAX_OFILE_ALIGNMENT (32768*8) + +/* Switch into a generic section. */ +#undef TARGET_ASM_NAMED_SECTION +#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section + +/* The following macro defines the format used to output the second + operand of the .type assembler directive. Different svr4 assemblers + expect various different forms for this operand. The one given here + is just a default. You may need to override it in your machine- + specific tm.h file (depending upon the particulars of your assembler). */ + +#define TYPE_OPERAND_FMT "@%s" + +/* Define the strings used for the special svr4 .type and .size directives. + These strings generally do not vary from one system running svr4 to + another, but if a given system (e.g. m88k running svr) needs to use + different pseudo-op names for these, they may be overridden in the + file which includes this one. */ + +#undef TYPE_ASM_OP +#undef SIZE_ASM_OP +#define TYPE_ASM_OP "\t.type\t" +#define SIZE_ASM_OP "\t.size\t" + +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name + +#undef ASM_FINISH_DECLARE_OBJECT +#define ASM_FINISH_DECLARE_OBJECT mips_finish_declare_object + +#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ + do { fputc ( '\t', FILE); \ + assemble_name (FILE, LABEL1); \ + fputs ( " = ", FILE); \ + assemble_name (FILE, LABEL2); \ + fputc ( '\n', FILE); \ + } while (0) + +/* Note about .weak vs. .weakext + The mips native assemblers support .weakext, but not .weak. + mips-elf gas supports .weak, but not .weakext. + mips-elf gas has been changed to support both .weak and .weakext, + but until that support is generally available, the 'if' below + should serve. */ + +#undef ASM_WEAKEN_LABEL +#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0) +#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \ + do { \ + if (TARGET_GAS) \ + fputs ("\t.weak\t", FILE); \ + else \ + fputs ("\t.weakext\t", FILE); \ + assemble_name (FILE, NAME); \ + if (VALUE) \ + { \ + fputc (' ', FILE); \ + assemble_name (FILE, VALUE); \ + } \ + fputc ('\n', FILE); \ + } while (0) + +#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) + +/* On elf, we *do* have support for the .init and .fini sections, and we + can put stuff in there to be executed before and after `main'. We let + crtstuff.c and other files know this by defining the following symbols. + The definitions say how to change sections to the .init and .fini + sections. This is the same for all known elf assemblers. */ + +#undef INIT_SECTION_ASM_OP +#define INIT_SECTION_ASM_OP "\t.section\t.init" +#undef FINI_SECTION_ASM_OP +#define FINI_SECTION_ASM_OP "\t.section\t.fini" + +/* Don't set the target flags, this is done by the linker script */ +#undef LIB_SPEC +#define LIB_SPEC "" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "crti%O%s crtbegin%O%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend%O%s crtn%O%s" + +/* We support #pragma. */ +#define HANDLE_SYSV_PRAGMA 1 === contrib/gcc/config/mips/freebsd.h ================================================================== --- contrib/gcc/config/mips/freebsd.h (revision 180961) +++ contrib/gcc/config/mips/freebsd.h (local) @@ -0,0 +1,199 @@ +/* Definitions of target machine for GNU compiler, for MIPS FreeBSD systems. + Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + +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 2, 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 COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Default to the mips32 ISA */ +#undef DRIVER_SELF_SPECS +#define DRIVER_SELF_SPECS \ + "%{!march=*: -march=mips32}" + +/* Define default target values. */ + +#undef MACHINE_TYPE +#if TARGET_ENDIAN_DEFAULT != 0 +#define MACHINE_TYPE "FreeBSD/mipseb ELF" +#else +#define MACHINE_TYPE "FreeBSD/mipsel ELF" +#endif + +#define MIPS_ABI_DEFAUL ABI_32 + +#ifdef LIB_SPEC +#undef LIB_SPEC +#define LIB_SPEC FBSD_LIB_SPEC +#endif /* LIB_SPEC */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC FBSD_STARTFILE_SPEC + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC FBSD_ENDFILE_SPEC + +/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD. + Specifically, they define too many namespace-invasive macros. Override + them here. Note this is structured for easy comparison to the version + in mips.h. + + FIXME: This probably isn't the best solution. But in the absence + of something better, it will have to do, for now. */ +/* XXX cognet: need to find out which one we need for FreeBSD. */ + +#undef TARGET_CPU_CPP_BUILTINS +#define TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + builtin_assert ("cpu=mips"); \ + builtin_define ("__mips__"); \ + builtin_define ("_mips"); \ + \ + /* No _R3000 or _R4000. */ \ + if (TARGET_64BIT) \ + builtin_define ("__mips64"); \ + \ + if (TARGET_FLOAT64) \ + builtin_define ("__mips_fpr=64"); \ + else \ + builtin_define ("__mips_fpr=32"); \ + \ + if (TARGET_MIPS16) \ + builtin_define ("__mips16"); \ + \ + MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ + MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ + \ + if (ISA_MIPS1) \ + builtin_define ("__mips=1"); \ + else if (ISA_MIPS2) \ + builtin_define ("__mips=2"); \ + else if (ISA_MIPS3) \ + builtin_define ("__mips=3"); \ + else if (ISA_MIPS4) \ + builtin_define ("__mips=4"); \ + else if (ISA_MIPS32) \ + { \ + builtin_define ("__mips=32"); \ + builtin_define ("__mips_isa_rev=1"); \ + } \ + else if (ISA_MIPS32R2) \ + { \ + builtin_define ("__mips=32"); \ + builtin_define ("__mips_isa_rev=2"); \ + } \ + else if (ISA_MIPS64) \ + { \ + builtin_define ("__mips=64"); \ + builtin_define ("__mips_isa_rev=1"); \ + } \ + \ + if (TARGET_HARD_FLOAT) \ + builtin_define ("__mips_hard_float"); \ + else if (TARGET_SOFT_FLOAT) \ + builtin_define ("__mips_soft_float"); \ + \ + if (TARGET_SINGLE_FLOAT) \ + builtin_define ("__mips_single_float"); \ + \ + if (TARGET_BIG_ENDIAN) \ + builtin_define ("__MIPSEB__"); \ + else \ + builtin_define ("__MIPSEL__"); \ + \ + if (TARGET_ABICALLS) \ + builtin_define ("__ABICALLS__"); \ + \ + /* No language dialect defines. */ \ + \ + /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \ + } \ + while (0) + + +/* Clean up after the generic MIPS/ELF configuration. */ +#undef MD_EXEC_PREFIX +#undef MD_STARTFILE_PREFIX + +/* Extra specs we need. */ +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER} + +/* Provide a SUBTARGET_CPP_SPEC appropriate for FreeBSD. */ + +#undef SUBTARGET_CPP_SPEC +#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC + +/* Provide a LINK_SPEC appropriate for a NetBSD/mips target. + This is a copy of LINK_SPEC from tweaked for + the MIPS target. */ + +#undef LINK_SPEC +#define LINK_SPEC " \ + %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \ + %{Wl,*:%*} \ + %{v:-V} \ + %{assert*} %{R*} %{rpath*} %{defsym*} \ + %{shared:-Bshareable %{h*} %{soname*}} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ + %{static:-Bstatic}} \ + %{symbolic:-Bsymbolic}" + +#undef SUBTARGET_ASM_SPEC +#define SUBTARGET_ASM_SPEC \ + "%{!mno-abicalls: \ + %{!fno-PIC:%{!fno-pic:-KPIC}}}" + + +/* -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 + + +/* This defines which switch letters take arguments. -G is a MIPS + special. */ + +#undef SWITCH_TAKES_ARG +#define SWITCH_TAKES_ARG(CHAR) \ + (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ + || (CHAR) == 'R' \ + || (CHAR) == 'G') + + +#undef ASM_FINAL_SPEC +#undef SET_ASM_OP + +/* Make gcc agree with */ + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +#undef WINT_TYPE +#define WINT_TYPE "int" + +/* Needed for ELF (inspired by netbsd-elf). */ +#undef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "." === contrib/gcc/config/mips/iris5gas.h ================================================================== --- contrib/gcc/config/mips/iris5gas.h (revision 180961) +++ contrib/gcc/config/mips/iris5gas.h (local) @@ -0,0 +1,83 @@ +/* Definitions of target machine for GNU compiler. IRIX version 5 with gas. + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + + 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 2, 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 COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Reenable debugging. */ +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG + +/* GNU as does handle DWARF2 directives. */ +#undef DWARF2_UNWIND_INFO +#define DWARF2_UNWIND_INFO 1 + +/* Override iris5.h version to invoke [cd]tors and register eh frame + information. */ +#undef LINK_SPEC +#define LINK_SPEC "\ +%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \ +%{bestGnum} %{shared} %{non_shared} \ +%{call_shared} %{no_archive} %{exact_version} \ +%{static: -non_shared} \ +%{!static: \ + %{!shared:%{!non_shared:%{!call_shared: -call_shared -no_unresolved}}}} \ +%{rpath} -init __do_global_ctors -fini __do_global_dtors \ +%{shared:-hidden_symbol __do_global_ctors,__do_global_ctors_1,__do_global_dtors} \ +-_SYSTYPE_SVR4" + +/* Override iris5.h versions to include crtbegin.o and crtend.o. */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%(irix_startfile_spec) crtbegin.o%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s %(irix_endfile_spec)" + +/* Irix 5 does not have some strange restrictions that Irix 3 had. */ +#undef SET_FILE_NUMBER +#define SET_FILE_NUMBER() ++num_source_filenames +#undef LABEL_AFTER_LOC +#define LABEL_AFTER_LOC(STREAM) + +/* We need to use .esize and .etype instead of .size and .type to + avoid conflicting with ELF directives. These are only recognized + by gas, anyhow, not the native assembler. */ +#undef PUT_SDB_SIZE +#define PUT_SDB_SIZE(a) \ +do { \ + fprintf (asm_out_file, "\t.esize\t" HOST_WIDE_INT_PRINT_DEC ";", \ + (HOST_WIDE_INT) (a)); \ +} while (0) + +#undef PUT_SDB_TYPE +#define PUT_SDB_TYPE(a) \ +do { \ + fprintf (asm_out_file, "\t.etype\t0x%x;", (a)); \ +} while (0) + +/* Add -g to mips.h default to avoid confusing gas with local symbols + generated from stabs info. */ +#undef NM_FLAGS +#define NM_FLAGS "-Bng" + +/* Disable SHF_MERGE support. Even if gas supports it, the IRIX ld does not + without a special elspec(5) file. + + FIXME: Only do this if not using GNU ld. */ +#undef HAVE_GAS_SHF_MERGE +#define HAVE_GAS_SHF_MERGE 0 === contrib/gcc/config/mips/iris5gld.h ================================================================== --- contrib/gcc/config/mips/iris5gld.h (revision 180961) +++ contrib/gcc/config/mips/iris5gld.h (local) @@ -0,0 +1,42 @@ +/* Definitions of target machine for GNU compiler. IRIX 5 with GNU ld. + Copyright (C) 2004 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 LINK_SPEC +#define LINK_SPEC "\ +%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \ +%{bestGnum} %{shared} %{non_shared} \ +%{call_shared} %{no_archive} %{exact_version} \ +%{static: -non_shared} \ +%{!static: \ + %{!shared: %{!non_shared: %{!call_shared: -call_shared}}}} \ +%{rpath} -init __gcc_init -fini __gcc_fini \ +-melf32bsmip" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%(irix_startfile_spec) irix-crti.o%s crtbegin.o%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s irix-crtn.o%s %(irix_endfile_spec)" + +/* The GNU linker supports one-only sections. */ +#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) + +#define INIT_SECTION_ASM_OP "\t.section\t.init,0x1,0x6,4,4" +#define FINI_SECTION_ASM_OP "\t.section\t.fini,0x1,0x6,4,4" === contrib/gcc/config/mips/iris6gas.h ================================================================== --- contrib/gcc/config/mips/iris6gas.h (revision 180961) +++ contrib/gcc/config/mips/iris6gas.h (local) @@ -0,0 +1,48 @@ +/* Definitions for MIPS running IRIX 6 using GNU AS + Copyright (C) 2003, 2004 + Free Software Foundation, Inc. + +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 2, 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 COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Definitions of target machine for GNU compiler. IRIX 6 with GNU as. */ + +/* Override iris6.h version to always use -init/-fini. + + FIXME: integrate those use separate spec/define for this? */ +#undef LINK_SPEC +#define LINK_SPEC "\ +%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \ +%{bestGnum} %{shared} %{non_shared} \ +%{call_shared} %{no_archive} %{exact_version} %{w} \ +%{!shared: %{!non_shared: %{!call_shared:%{!r: -call_shared -no_unresolved}}}} \ +%{rpath} -init __do_global_ctors -fini __do_global_dtors \ +%{shared:-hidden_symbol __do_global_ctors,__do_global_ctors_1,__do_global_dtors} \ +-_SYSTYPE_SVR4 -woff 131 \ +%{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}" + +/* Disable SHF_MERGE support. Even if gas supports it, the IRIX 6 O32 ld + does not without a special elspec(5) file. + + FIXME: Only do this if not using GNU ld. */ +#if HAVE_GAS_SHF_MERGE +#undef HAVE_GAS_SHF_MERGE +#define HAVE_GAS_SHF_MERGE (mips_abi != ABI_32) +#endif /* HAVE_GAS_SHF_MERGE */ + +/* There's no need to perform collecting with GNU as. */ +#undef COLLECT_PARSE_FLAG === contrib/gcc/config/mips/iris6gld.h ================================================================== --- contrib/gcc/config/mips/iris6gld.h (revision 180961) +++ contrib/gcc/config/mips/iris6gld.h (local) @@ -0,0 +1,60 @@ +/* Definitions of target machine for GNU compiler. Iris version 6 with + GNU ld. + Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc. + Written by Mark Mitchell . + +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 2, 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 COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#undef LIB_SPEC +#define LIB_SPEC \ + "%{mabi=n32: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \ + -L/usr/lib32} \ + %{mabi=64: %{mips4:-L/usr/lib64/mips4} %{!mips4:-L/usr/lib64/mips3} \ + -L/usr/lib64} \ + %{!mabi*: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \ + -L/usr/lib32} \ + %{!shared: \ + %{p:libprof1.a%s}%{pg:libprof1.a%s} -lc}" + +/* Use the default libgcc spec. */ +#undef LIBGCC_SPEC + +/* ??? If no mabi=X option give, but a mipsX option is, then should depend + on the mipsX option. */ +#undef LINK_SPEC +#define LINK_SPEC "\ +%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \ +%{bestGnum} %{shared} %{non_shared} \ +%{call_shared} %{no_archive} %{exact_version} \ +%{static: -non_shared} \ +%{!static: \ + %{!shared: %{!non_shared: %{!call_shared: -call_shared}}}} \ +%{rpath} -init __gcc_init -fini __gcc_fini \ +%{mabi=32: -melf32bsmip}%{mabi=n32: -melf32bmipn32}%{mabi=64: -melf64bmip}%{!mabi*: -melf32bmipn32}" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%(irix_startfile_spec) irix-crti.o%s crtbegin.o%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s irix-crtn.o%s %(irix_endfile_spec)" + +/* The GNU linker supports one-only sections. */ +#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) + +#define INIT_SECTION_ASM_OP "\t.section\t.init,0x1,0x6,4,4" +#define FINI_SECTION_ASM_OP "\t.section\t.fini,0x1,0x6,4,4" === contrib/gcc/config/mips/t-cross64 ================================================================== --- contrib/gcc/config/mips/t-cross64 (revision 180961) +++ contrib/gcc/config/mips/t-cross64 (local) @@ -0,0 +1,12 @@ +SYSTEM_HEADER_DIR = /usr/cross64/usr/include + +AR = /usr/cross64/usr/bin/ar + +# The rest of the file is identical to t-iris6. + +MULTILIB_OPTIONS=mips1/mips2/mips3/mips4 +MULTILIB_DIRNAMES= +MULTILIB_MATCHES= + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib === contrib/gcc/config/mips/t-iris5-6 ================================================================== --- contrib/gcc/config/mips/t-iris5-6 (revision 180961) +++ contrib/gcc/config/mips/t-iris5-6 (local) @@ -0,0 +1,34 @@ +# Build a shared libgcc library. +SHLIB_EXT = .so +SHLIB_SOLINK = @shlib_base_name@.so +SHLIB_SONAME = @shlib_so_name@.so.1 +SHLIB_NAME = @shlib_dir@@shlib_so_name@.so.1 +SHLIB_MAP = @shlib_map_file@ +SHLIB_OBJS = @shlib_objs@ +SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@ + +SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ + -Wl,-soname,$(SHLIB_SONAME) \ + -o $(SHLIB_NAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \ + rm -f $(SHLIB_SOLINK) && \ + if [ -f $(SHLIB_NAME) ]; then \ + mv -f $(SHLIB_NAME) $(SHLIB_NAME).backup; \ + else true; fi && \ + mv $(SHLIB_NAME).tmp $(SHLIB_NAME) && \ + $(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK) +# ??? Irix 6.5 seems to eat the option fine (if we somehow remove the +# -hidden_symbol option, which is documented to be ignored in conjunction +# with -exports_file), but fails to actually hide any symbols. +# -Wl,-exports_file,$(SHLIB_MAP) + +# $(slibdir) double quoted to protect it from expansion while building +# libgcc.mk. We want this delayed until actual install time. +SHLIB_INSTALL = \ + $$(SHELL) $$(srcdir)/mkinstalldirs $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \ + $(INSTALL_DATA) $(SHLIB_NAME) \ + $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \ + rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \ + $(LN_S) $(SHLIB_SONAME) \ + $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK) +SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk +SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver === contrib/gcc/config/mips/t-iris5-as ================================================================== --- contrib/gcc/config/mips/t-iris5-as (revision 180961) +++ contrib/gcc/config/mips/t-iris5-as (local) @@ -0,0 +1,11 @@ +# omit -g, gcc doesn't support the o32 mdebug debugging format and warns about +# every invocation with -g* +# add -save-temps to avoid comparison failure due to embedded temp file names +BOOT_CFLAGS = -O2 -save-temps + +# omit -g1 +LIBGCC2_DEBUG_CFLAGS = + +# omit -g +FORCE_DEBUG_ADAFLAGS = +GNATLIBCFLAGS = -O2 === contrib/gcc/config/mips/t-iris5-gas ================================================================== --- contrib/gcc/config/mips/t-iris5-gas (revision 180961) +++ contrib/gcc/config/mips/t-iris5-gas (local) @@ -0,0 +1,5 @@ +# For svr4 we build crtbegin.o and crtend.o which serve to add begin and +# end labels to the .ctors and .dtors section when we link using gcc. + +EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o +CRTSTUFF_T_CFLAGS=-g1 === contrib/gcc/config/mips/t-irix-gld ================================================================== --- contrib/gcc/config/mips/t-irix-gld (revision 180961) +++ contrib/gcc/config/mips/t-irix-gld (local) @@ -0,0 +1,9 @@ +$(T)irix-crti.o: $(srcdir)/config/mips/irix-crti.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $@ -x assembler-with-cpp $< + +$(T)irix-crtn.o: $(srcdir)/config/mips/irix-crtn.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $@ -x assembler-with-cpp $< + +EXTRA_MULTILIB_PARTS += irix-crti.o irix-crtn.o === gnu/lib/libgcc/Makefile ================================================================== --- gnu/lib/libgcc/Makefile (revision 180961) +++ gnu/lib/libgcc/Makefile (local) @@ -173,8 +173,8 @@ # # Floating point emulation functions # -.if ${TARGET_ARCH} == "armNOT_YET" || ${TARGET_ARCH} == "powerpc" || \ - ${TARGET_ARCH} == "sparc64" +.if ${TARGET_ARCH} == "armNOT_YET" || ${TARGET_ARCH} == "mips" || \ + ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64" FPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DFLOAT DPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES === gnu/lib/libgomp/Makefile ================================================================== --- gnu/lib/libgomp/Makefile (revision 180961) +++ gnu/lib/libgomp/Makefile (local) @@ -24,7 +24,7 @@ # Target-specific OpenMP configuration .if ${MACHINE_ARCH} == arm || ${MACHINE_ARCH} == i386 || \ - ${MACHINE_ARCH} == powerpc + ${MACHINE_ARCH} == mips || ${MACHINE_ARCH} == powerpc OMP_LOCK_ALIGN = 4 OMP_LOCK_KIND= 4 OMP_LOCK_SIZE= 4 === gnu/lib/libgomp/config.h ================================================================== --- gnu/lib/libgomp/config.h (revision 180961) +++ gnu/lib/libgomp/config.h (local) @@ -59,7 +59,7 @@ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if the target supports thread-local storage. */ -#if !defined(__sparc64__) && !defined(__arm__) +#if !defined(__sparc64__) && !defined(__arm__) && !defined(__mips__) #define HAVE_TLS 1 #endif === gnu/usr.bin/cc/Makefile.tgt ================================================================== --- gnu/usr.bin/cc/Makefile.tgt (revision 180961) +++ gnu/usr.bin/cc/Makefile.tgt (local) @@ -9,6 +9,9 @@ .elif ${TARGET_ARCH} == "ia64" TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD GCC_CPU= ia64 +.elif ${TARGET_ARCH} == "mips" +GCC_CPU= mips +TARGET_CPU_DEFAULT= MASK_ABICALLS|MASK_SOFT_FLOAT .elif ${TARGET_ARCH} == "powerpc" GCC_CPU= rs6000 .elif ${TARGET_ARCH} == "sparc64" === gnu/usr.bin/cc/cc_tools/Makefile ================================================================== --- gnu/usr.bin/cc/cc_tools/Makefile (revision 180961) +++ gnu/usr.bin/cc/cc_tools/Makefile (local) @@ -52,11 +52,13 @@ TARGET_INC+= ${GCC_CPU}/aout.h TARGET_INC+= ${GCC_CPU}/freebsd.h TARGET_INC+= ${GCC_CPU}/arm.h +.elif ${TARGET_ARCH} == "mips" +TARGET_INC+= ${GCC_CPU}/elf.h +TARGET_INC+= ${GCC_CPU}/freebsd.h .else TARGET_INC+= ${GCC_CPU}/freebsd.h .endif TARGET_INC+= defaults.h - .for H in ${TARGET_INC} .for D in ${GCCDIR}/config ${GCCDIR} ${.CURDIR} .if exists($D/$H)