OSDN Git Service

add support for -EL and -EB
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / iris5.h
1 /* Definitions of target machine for GNU compiler.  Iris version 5.
2    Copyright (C) 1993 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19
20 #define TARGET_DEFAULT  MASK_ABICALLS
21 #define ABICALLS_ASM_OP ".option pic2"
22
23 #include "mips/iris4.h"
24
25 /* Irix 5 doesn't use COFF, so disable special COFF handling in collect2.c.  */
26 #undef OBJECT_FORMAT_COFF
27
28 /* ??? This is correct, but not very useful, because there is no file that
29    uses this macro.  */
30 /* ??? The best way to handle global constructors under ELF is to use .init
31    and .fini sections.  Unfortunately, there is apparently no way to get
32    the Irix 5.x (x <= 2) assembler to create these sections.  So we instead
33    use collect.  The linker can create these sections via -init and -fini
34    options, but using this would require modifying how crtstuff works, and
35    I will leave that for another time (or someone else).  */
36 #define OBJECT_FORMAT_ELF
37
38 /* Specify wchar_t types.  */
39 #undef  WCHAR_TYPE
40 #undef  WCHAR_TYPE_SIZE
41 #undef  MAX_WCHAR_TYPE_SIZE
42
43 #define WCHAR_TYPE      "long int"
44 #define WCHAR_TYPE_SIZE LONG_TYPE_SIZE
45 #define MAX_WCHAR_TYPE_SIZE     MAX_LONG_TYPE_SIZE
46
47 /* ??? _MIPS_SIM and _MIPS_SZPTR should eventually depend on options when
48    options for them exist.  */
49
50 #undef CPP_PREDEFINES
51 #define CPP_PREDEFINES \
52  "-Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 \
53   -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ \
54   -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 \
55   -Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(sgi)"
56
57 #undef CPP_SPEC
58 #define CPP_SPEC "\
59 %{!ansi:-D__EXTENSIONS__ -D_SGI_SOURCE -D_LONGLONG} \
60 %{.cc:  -D_LANGUAGE_C_PLUS_PLUS} \
61 %{.cxx: -D_LANGUAGE_C_PLUS_PLUS} \
62 %{.C:   -D_LANGUAGE_C_PLUS_PLUS} \
63 %{.m:   -D_LANGUAGE_OBJECTIVE_C -D_LANGUAGE_C} \
64 %{.S:   -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
65 %{.s:   -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
66 %{!.S:%{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}}\
67 %{!mfp64: -D_MIPS_FPSET=16}%{mfp64: -D_MIPS_FPSET=32} \
68 %{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
69 %{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
70 %{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
71 %{!mips1: %{!mips2: %{!mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS1}}} \
72 %{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \
73 %{!mlong64: -D_MIPS_SZLONG=32}%{mlong64: -D_MIPS_SZLONG=64} \
74 %{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
75 %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
76 %{mips3:-U__mips -D__mips=3} \
77 %{EB:-UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__ -D_MIPSEB -D__MIPSEB -D__MIPSEB__ %{!ansi:-DMIPSEB}} \
78 %{EL:-UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__ -D_MIPSEL -D__MIPSEL -D__MIPSEL__ %{!ansi:-DMIPSEL}}"
79
80 #undef LINK_SPEC
81 #define LINK_SPEC "\
82 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
83 %{bestGnum} %{shared} %{non_shared} \
84 %{call_shared} %{no_archive} %{exact_version} \
85 %{!shared: %{!non_shared: \
86            %{!call_shared: -call_shared -no_unresolved}}} \
87 -_SYSTYPE_SVR4"
88
89 #undef LIB_SPEC
90 #define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"
91
92 /* We do not want to run mips-tfile!  */
93 #undef ASM_FINAL_SPEC
94
95 /* The system header files are C++ aware. */
96 /* ??? Unfortunately, most but not all of the headers are C++ aware.
97    Specifically, curses.h is not, and libg++ won't build because of it
98    if this is defined.  On the other hand, SGI has C++ packages with
99    header files in /usr/include, and they won't work unless this is
100    defined.  We need some way to fix just those files that need fixing.  */
101 /* #define NO_IMPLICIT_EXTERN_C 1 */
102
103 /* We don't support debugging info for now. */
104 #undef DBX_DEBUGGING_INFO
105 #undef SDB_DEBUGGING_INFO
106 #undef MIPS_DEBUGGING_INFO
107
108 #undef MACHINE_TYPE
109 #define MACHINE_TYPE "SGI running IRIX 5.0"
110
111 /* -G is incompatible with -KPIC which is the default, so only allow objects
112    in the small data section if the user explicitly asks for it.  */
113 #undef MIPS_DEFAULT_GVALUE
114 #define MIPS_DEFAULT_GVALUE 0
115
116 /* In Irix 5, we must output a `.global name .text' directive for every used
117    but undefined function.  If we don't, the linker may perform an optimization
118    (skipping over the insns that set $gp) when it is unsafe.  This is used
119    indirectly by ASM_OUTPUT_EXTERNAL.  */
120 #define ASM_OUTPUT_UNDEF_FUNCTION(FILE, NAME)   \
121 do {                                            \
122   fputs ("\t.globl ", FILE);                    \
123   assemble_name (FILE, NAME);                   \
124   fputs (" .text\n", FILE);                     \
125 } while (0)
126
127 /* Also do this for libcalls.  */
128 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  \
129   mips_output_external_libcall (FILE, XSTR (FUN, 0))
130
131 /* This does for functions what ASM_DECLARE_OBJECT_NAME does for variables.
132    This is used indirectly by ASM_OUTPUT_EXTERNAL.  */
133 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)   \
134 do {                                                    \
135   tree name_tree = get_identifier (NAME);               \
136   TREE_ASM_WRITTEN (name_tree) = 1;                     \
137 } while (0)