OSDN Git Service

* config/mips/linux.h (SUBTARGET_CPP_SPEC): Default ABI is 32; change
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / linux.h
1 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
2    Copyright (C) 1998, 1999, 2000, 2001 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, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 #undef TARGET_VERSION
22 #if TARGET_ENDIAN_DEFAULT == 0
23 #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)");
24 #else
25 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
26 #endif
27
28 #undef MD_EXEC_PREFIX
29 #undef MD_STARTFILE_PREFIX
30
31 /* Output at beginning of assembler file.  */
32 /* The .file command should always begin the output.  */
33 #undef ASM_FILE_START
34 #define ASM_FILE_START(FILE)                                            \
35   do {                                                                  \
36         mips_asm_file_start (FILE);                                     \
37         fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
38   } while (0)
39
40
41 /* Required to keep collect2.c happy */
42 #undef OBJECT_FORMAT_COFF
43
44 /* If we don't set MASK_ABICALLS, we can't default to PIC. */
45 #undef TARGET_DEFAULT
46 #define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS)
47
48
49 /* Handle #pragma weak and #pragma pack.  */
50 #define HANDLE_SYSV_PRAGMA 1
51
52 /* Use more efficient ``thunks'' to implement C++ vtables. */
53 #undef DEFAULT_VTABLE_THUNKS
54 #define DEFAULT_VTABLE_THUNKS 1
55
56 /* Don't assume anything about the header files.  */
57 #define NO_IMPLICIT_EXTERN_C
58
59 /* Generate calls to memcpy, etc., not bcopy, etc.  */
60 #define TARGET_MEM_FUNCTIONS
61
62 /* Specify predefined symbols in preprocessor.  */
63 #undef CPP_PREDEFINES
64 #if TARGET_ENDIAN_DEFAULT == 0
65 #define CPP_PREDEFINES "-DMIPSEL -D_MIPSEL -Dunix -Dmips -D_mips \
66 -DR3000 -D_R3000 -Dlinux -Asystem=posix -Acpu=mips \
67 -Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
68 #else
69 #define CPP_PREDEFINES "-DMIPSEB -D_MIPSEB -Dunix -Dmips -D_mips \
70 -DR3000 -D_R3000 -Dlinux -Asystem=posix -Acpu=mips \
71 -Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
72 #endif
73
74 #undef SUBTARGET_CPP_SIZE_SPEC
75 #define SUBTARGET_CPP_SIZE_SPEC "\
76 %{mabi=32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
77 %{mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
78 %{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
79 %{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"
80
81 /* We must make -mips3 do what -mlong64 used to do.  */
82 /* ??? If no mipsX option given, but a mabi=X option is, then should set
83    _MIPS_ISA based on the mabi=X option.  */
84 /* ??? If no mabi=X option give, but a mipsX option is, then should set
85    _MIPS_SIM based on the mipsX option.  */
86 /* ??? Same for _MIPS_SZINT.  */
87 /* ??? Same for _MIPS_SZPTR.  */
88 /* ??? Same for __SIZE_TYPE and __PTRDIFF_TYPE.  */
89 #undef SUBTARGET_CPP_SPEC
90 #define SUBTARGET_CPP_SPEC "\
91 %{mfp32: -D_MIPS_FPSET=16} \
92 %{mfp64: -D_MIPS_FPSET=32} \
93 %{!mfp*: -D_MIPS_FPSET=32} \
94 %{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
95 %{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
96 %{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
97 %{mips4: -D_MIPS_ISA=_MIPS_ISA_MIPS4} \
98 %{!mips*: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
99 %{mabi=32: -D_MIPS_SIM=_MIPS_SIM_ABI32} \
100 %{mabi=n32: -D_ABIN32=2 -D_MIPS_SIM=_ABIN32} \
101 %{mabi=64: -D_ABI64=3 -D_MIPS_SIM=_ABI64} \
102 %{!mabi*: -D_MIPS_SIM=_MIPS_SIM_ABI32}  \
103 %{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \
104 %{mabi=32: -D_MIPS_SZLONG=32} \
105 %{mabi=n32: -D_MIPS_SZLONG=32} \
106 %{mabi=64: -D_MIPS_SZLONG=64} \
107 %{!mabi*: -D_MIPS_SZLONG=32} \
108 %{mabi=32: -D_MIPS_SZPTR=32} \
109 %{mabi=n32: -D_MIPS_SZPTR=32} \
110 %{mabi=64: -D_MIPS_SZPTR=64} \
111 %{!mabi*: -D_MIPS_SZPTR=32} \
112 %{!mips*: -U__mips -D__mips} \
113 %{mabi=32: -U__mips64} \
114 %{mabi=n32: -D__mips64} \
115 %{mabi=64: -U__mips64} \
116 %{!mabi*: -U__mips64} \
117 %{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \
118 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \
119 %{pthread:-D_REENTRANT}"
120
121 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
122    the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
123    provides part of the support for getting C++ file-scope static
124    object constructed before entering `main'. */
125
126 #undef  STARTFILE_SPEC
127 #define STARTFILE_SPEC \
128   "%{!shared: \
129      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
130    crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
131
132 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux.  Here we tack on
133    the GNU/Linux magical crtend.o file (see crtstuff.c) which
134    provides part of the support for getting C++ file-scope static
135    object constructed before entering `main', followed by a normal
136    GNU/Linux "finalizer" file, `crtn.o'.  */
137
138 #undef  ENDFILE_SPEC
139 #define ENDFILE_SPEC \
140   "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
141
142 /* From iris5.h */
143 /* -G is incompatible with -KPIC which is the default, so only allow objects
144    in the small data section if the user explicitly asks for it.  */
145 #undef MIPS_DEFAULT_GVALUE
146 #define MIPS_DEFAULT_GVALUE 0
147
148 #undef LIB_SPEC
149 /* Taken from sparc/linux.h.  */
150 #define LIB_SPEC \
151   "%{shared: -lc} \
152    %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
153      %{profile:-lc_p} %{!profile: -lc}}"
154
155 /* Borrowed from sparc/linux.h */
156 #undef LINK_SPEC
157 #define LINK_SPEC \
158  "%(endian_spec) \
159   %{shared:-shared} \
160   %{!shared: \
161     %{!ibcs: \
162       %{!static: \
163         %{rdynamic:-export-dynamic} \
164         %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
165         %{static:-static}}}"
166
167
168 #undef SUBTARGET_ASM_SPEC
169 #define SUBTARGET_ASM_SPEC "\
170 %{mabi=64: -64} \
171 %{!fno-PIC:%{!fno-pic:-KPIC}} \
172 %{fno-PIC:-non_shared} %{fno-pic:-non_shared}"