1/* Definitions of target machine for GNU compiler.  Iris version 5.
2   Copyright (C) 1993, 1995, 1996, 1998 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING.  If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA.  */
20
21#ifndef TARGET_DEFAULT
22#define	TARGET_DEFAULT	MASK_ABICALLS
23#endif
24#define ABICALLS_ASM_OP ".option pic2"
25
26#include "mips/iris3.h"
27#include "mips/mips.h"
28#include "mips/iris4.h"
29
30/* Irix 5 doesn't use COFF, so disable special COFF handling in collect2.c.  */
31#undef OBJECT_FORMAT_COFF
32
33/* ??? This is correct, but not very useful, because there is no file that
34   uses this macro.  */
35/* ??? The best way to handle global constructors under ELF is to use .init
36   and .fini sections.  Unfortunately, there is apparently no way to get
37   the Irix 5.x (x <= 2) assembler to create these sections.  So we instead
38   use collect.  The linker can create these sections via -init and -fini
39   options, but using this would require modifying how crtstuff works, and
40   I will leave that for another time (or someone else).  */
41#define OBJECT_FORMAT_ELF
42#define HAS_INIT_SECTION
43#define LD_INIT_SWITCH "-init"
44#define LD_FINI_SWITCH "-fini"
45
46/* Specify wchar_t types.  */
47#undef	WCHAR_TYPE
48#undef	WCHAR_TYPE_SIZE
49#undef	MAX_WCHAR_TYPE_SIZE
50
51#define WCHAR_TYPE	"long int"
52#define WCHAR_TYPE_SIZE	LONG_TYPE_SIZE
53#define MAX_WCHAR_TYPE_SIZE	MAX_LONG_TYPE_SIZE
54
55#define WORD_SWITCH_TAKES_ARG(STR)			\
56 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
57  || !strcmp (STR, "rpath"))
58
59#undef SUBTARGET_CC1_SPEC
60#define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
61
62/* ??? _MIPS_SIM and _MIPS_SZPTR should eventually depend on options when
63   options for them exist.  */
64
65#undef CPP_PREDEFINES
66#define CPP_PREDEFINES \
67 "-Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 \
68  -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ \
69  -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 \
70  -Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(sgi)"
71
72#undef SUBTARGET_CPP_SPEC
73#define SUBTARGET_CPP_SPEC "\
74%{!ansi:-D__EXTENSIONS__ -D_SGI_SOURCE -D_LONGLONG} \
75%{!mfp64: -D_MIPS_FPSET=16}%{mfp64: -D_MIPS_FPSET=32} \
76%{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
77%{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
78%{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
79%{!mips1: %{!mips2: %{!mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS1}}} \
80%{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \
81%{!mlong64: -D_MIPS_SZLONG=32}%{mlong64: -D_MIPS_SZLONG=64}"
82
83#undef LINK_SPEC
84#define LINK_SPEC "\
85%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
86%{bestGnum} %{shared} %{non_shared} \
87%{call_shared} %{no_archive} %{exact_version} \
88%{static: -non_shared} \
89%{!static: \
90  %{!shared:%{!non_shared:%{!call_shared: -call_shared -no_unresolved}}}} \
91%{rpath} \
92-_SYSTYPE_SVR4"
93
94/* We now support shared libraries.  */
95#undef STARTFILE_SPEC
96#define STARTFILE_SPEC "\
97%{!static: \
98  %{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}} \
99%{static: \
100  %{pg:gcrt1.o%s} \
101  %{!pg:%{p:/usr/lib/nonshared/mcrt1.o%s libprof1.a%s} \
102  %{!p:/usr/lib/nonshared/crt1.o%s}}}"
103
104#undef LIB_SPEC
105#define LIB_SPEC "%{!shared:%{p:-lprof1} %{pg:-lprof1} -lc}"
106
107#undef ENDFILE_SPEC
108#define ENDFILE_SPEC "%{!shared:crtn.o%s}"
109
110/* We do not want to run mips-tfile!  */
111#undef ASM_FINAL_SPEC
112
113/* The system header files are C++ aware. */
114/* ??? Unfortunately, most but not all of the headers are C++ aware.
115   Specifically, curses.h is not, and as a consequence, defining this
116   used to prevent libg++ building.  This is no longer the case so
117   define it again to prevent other problems, e.g. with getopt in
118   unistd.h.  We still need some way to fix just those files that need
119   fixing.  */
120#define NO_IMPLICIT_EXTERN_C 1
121
122/* We don't support debugging info for now. */
123#undef DBX_DEBUGGING_INFO
124#undef SDB_DEBUGGING_INFO
125#undef MIPS_DEBUGGING_INFO
126#undef PREFERRED_DEBUGGING_TYPE
127
128/* Likewise, the assembler doesn't handle DWARF2 directives.  */
129#define DWARF2_UNWIND_INFO 0
130
131#undef MACHINE_TYPE
132#define MACHINE_TYPE "SGI running IRIX 5.x"
133
134 /* Dollar signs are OK in Irix5 but not in Irix3.  */
135#undef DOLLARS_IN_IDENTIFIERS
136#undef NO_DOLLAR_IN_LABEL
137
138/* -G is incompatible with -KPIC which is the default, so only allow objects
139   in the small data section if the user explicitly asks for it.  */
140#undef MIPS_DEFAULT_GVALUE
141#define MIPS_DEFAULT_GVALUE 0
142
143/* In Irix 5, we must output a `.global name .text' directive for every used
144   but undefined function.  If we don't, the linker may perform an optimization
145   (skipping over the insns that set $gp) when it is unsafe.  This is used
146   indirectly by ASM_OUTPUT_EXTERNAL.  */
147#define ASM_OUTPUT_UNDEF_FUNCTION(FILE, NAME)	\
148do {						\
149  fputs ("\t.globl ", FILE);			\
150  assemble_name (FILE, NAME);			\
151  fputs (" .text\n", FILE);			\
152} while (0)
153
154/* Also do this for libcalls.  */
155#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)	\
156  mips_output_external_libcall (FILE, XSTR (FUN, 0))
157
158/* This does for functions what ASM_DECLARE_OBJECT_NAME does for variables.
159   This is used indirectly by ASM_OUTPUT_EXTERNAL.  */
160#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)	\
161do {							\
162  tree name_tree = get_identifier (NAME);		\
163  TREE_ASM_WRITTEN (name_tree) = 1;			\
164} while (0)
165