]>
Commit | Line | Data |
---|---|---|
512b62fb | 1 | /* Definitions for Intel x86 running BeOS |
4592bdcb | 2 | Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. |
512b62fb JM |
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 | #include <i386/i386.h> /* Base i386 target machine definitions */ | |
22 | #include <i386/att.h> /* Use the i386 AT&T assembler syntax */ | |
23 | #include <svr4.h> /* some common stuff */ | |
24 | ||
25 | #undef TARGET_VERSION | |
26 | #define TARGET_VERSION fprintf (stderr, " (i386 BeOS/ELF)"); | |
27 | ||
28 | /* Change debugging to Dwarf2. */ | |
29 | #undef PREFERRED_DEBUGGING_TYPE | |
30 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
31 | ||
32 | /* The SVR4 ABI for the i386 says that records and unions are returned | |
33 | in memory. */ | |
34 | #undef DEFAULT_PCC_STRUCT_RETURN | |
35 | #define DEFAULT_PCC_STRUCT_RETURN 1 | |
36 | ||
37 | #undef ASM_COMMENT_START | |
38 | #define ASM_COMMENT_START " #" | |
39 | ||
40 | /* This is how to output an element of a case-vector that is relative. | |
41 | This is only used for PIC code. See comments by the `casesi' insn in | |
42 | i386.md for an explanation of the expression this outputs. */ | |
43 | #undef ASM_OUTPUT_ADDR_DIFF_ELT | |
44 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ | |
45 | fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) | |
46 | ||
47 | /* Indicate that jump tables go in the text section. This is | |
48 | necessary when compiling PIC code. */ | |
49 | #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) | |
50 | ||
512b62fb | 51 | #undef DBX_REGISTER_NUMBER |
83774849 | 52 | #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n] |
512b62fb JM |
53 | |
54 | /* Output assembler code to FILE to increment profiler label # LABELNO | |
55 | for profiling a function entry. */ | |
56 | ||
57 | #undef FUNCTION_PROFILER | |
58 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
59 | { \ | |
60 | if (flag_pic) \ | |
61 | { \ | |
62 | fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ | |
63 | LPREFIX, (LABELNO)); \ | |
64 | fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ | |
65 | } \ | |
66 | else \ | |
67 | { \ | |
68 | fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \ | |
69 | fprintf (FILE, "\tcall mcount\n"); \ | |
70 | } \ | |
71 | } | |
72 | ||
73 | #undef SIZE_TYPE | |
74 | #define SIZE_TYPE "long unsigned int" | |
75 | ||
76 | #undef PTRDIFF_TYPE | |
77 | #define PTRDIFF_TYPE "long int" | |
78 | ||
79 | #undef WCHAR_TYPE | |
80 | #define WCHAR_TYPE "short unsigned int" | |
81 | ||
82 | #undef WCHAR_UNSIGNED | |
83 | #define WCHAR_UNSIGNED 1 | |
84 | ||
85 | #undef WCHAR_TYPE_SIZE | |
86 | #define WCHAR_TYPE_SIZE 16 | |
87 | ||
88 | #undef CPP_PREDEFINES | |
89 | #define CPP_PREDEFINES "-D__ELF__ -D__BEOS__ -D__INTEL__ -D_X86_=1 \ | |
90 | -D__stdcall=__attribute__((__stdcall__)) \ | |
91 | -D__cdecl=__attribute__((__cdecl__)) \ | |
92 | -D__declspec(x)=__attribute__((x)) \ | |
93 | -Asystem(beos)" | |
94 | ||
95 | #undef CPP_SPEC | |
96 | #define CPP_SPEC "%(cpp_cpu) %{!no-fPIC:%{!no-fpic:-D__PIC__ -D__pic__}}" | |
97 | ||
98 | /* BeOS uses lots of multichars, so don't warn about them unless the | |
99 | user explicitly asks for the warnings with -Wmultichar. Note that | |
100 | CC1_SPEC is used for both cc1 and cc1plus. */ | |
101 | ||
102 | #undef CC1_SPEC | |
103 | #define CC1_SPEC "%{!no-fpic:%{!fPIC:-fpic}} %{!Wmultichar: -Wno-multichar} %(cc1_cpu) %{profile:-p}" | |
104 | ||
105 | #undef CC1PLUS_SPEC | |
106 | #define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}" | |
107 | ||
108 | /* Provide a LINK_SPEC appropriate for BeOS. Here we provide support | |
109 | for the special GCC options -static and -shared, which allow us to | |
110 | link things in one of these three modes by applying the appropriate | |
111 | combinations of options at link-time. */ | |
112 | ||
113 | /* If ELF is the default format, we should not use /lib/elf. */ | |
114 | ||
115 | #undef LINK_SPEC | |
116 | #define LINK_SPEC "%{!o*:-o %b} -m elf_i386_be -shared -Bsymbolic %{nostart:-e 0}" | |
117 | ||
118 | /* Provide start and end file specs appropriate to glibc. */ | |
119 | ||
120 | /* LIB_SPEC for BeOS */ | |
121 | #undef LIB_SPEC | |
122 | #define LIB_SPEC "-lnet -lroot" | |
123 | ||
124 | /* gcc runtime lib is built into libroot.so on BeOS */ | |
125 | /* ??? This is gonna be lovely when the next release of gcc has | |
126 | some new symbol in, so that links start failing. */ | |
127 | #undef LIBGCC_SPEC | |
128 | #define LIBGCC_SPEC "" | |
129 | ||
130 | #undef STARTFILE_SPEC | |
a7a4fd17 | 131 | #define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!nostart:start_dyn.o%s} init_term_dyn.o%s %{p:i386-mcount.o%s}" |
512b62fb JM |
132 | |
133 | #undef ENDFILE_SPEC | |
134 | #define ENDFILE_SPEC "crtend.o%s crtn.o%s" | |
135 | ||
136 | /* Get perform_* macros to build libgcc.a. */ | |
137 | #include "i386/perform.h" | |
138 | ||
139 | /* A C statement (sans semicolon) to output to the stdio stream | |
140 | FILE the assembler definition of uninitialized global DECL named | |
141 | NAME whose size is SIZE bytes and alignment is ALIGN bytes. | |
142 | Try to use asm_output_aligned_bss to implement this macro. */ | |
143 | ||
144 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
145 | asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) | |
146 | ||
147 | /* A C statement to output to the stdio stream FILE an assembler | |
148 | command to advance the location counter to a multiple of 1<<LOG | |
149 | bytes if it is within MAX_SKIP bytes. | |
150 | ||
151 | This is used to align code labels according to Intel recommendations. */ | |
152 | ||
153 | #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN | |
154 | #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ | |
155 | if ((LOG)!=0) \ | |
156 | if ((MAX_SKIP)==0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ | |
157 | else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)) | |
158 | #endif | |
159 | ||
512b62fb JM |
160 | /* For native compiler, use standard BeOS include file search paths |
161 | rooted in /boot/develop/headers. For a cross compiler, don't | |
162 | expect the host to use the BeOS directory scheme, and instead look | |
163 | for the BeOS include files relative to TOOL_INCLUDE_DIR. Yes, we | |
164 | use ANSI string concatenation here (FIXME) */ | |
165 | ||
166 | #ifndef CROSS_COMPILE | |
167 | #undef INCLUDE_DEFAULTS | |
168 | #define INCLUDE_DEFAULTS \ | |
169 | { \ | |
170 | { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },\ | |
171 | { GCC_INCLUDE_DIR, "GCC", 0, 0 },\ | |
172 | { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1}, \ | |
173 | { "/boot/develop/headers/be/add-ons/graphics", 0, 0, 0 },\ | |
174 | { "/boot/develop/headers/be/devel", 0, 0, 0 },\ | |
175 | { "/boot/develop/headers/be/translation", 0, 0, 0 },\ | |
176 | { "/boot/develop/headers/be/mail", 0, 0, 0 },\ | |
177 | { "/boot/develop/headers/gnu", 0, 0, 0 },\ | |
178 | { "/boot/develop/headers/be/drivers", 0, 0, 0 },\ | |
179 | { "/boot/develop/headers/be/opengl", 0, 0, 0 },\ | |
180 | { "/boot/develop/headers/be/game", 0, 0, 0 },\ | |
181 | { "/boot/develop/headers/be/support", 0, 0, 0 },\ | |
182 | { "/boot/develop/headers/be/storage", 0, 0, 0 },\ | |
183 | { "/boot/develop/headers/be/kernel", 0, 0, 0 },\ | |
184 | { "/boot/develop/headers/be/net", 0, 0, 0 },\ | |
185 | { "/boot/develop/headers/be/midi", 0, 0, 0 },\ | |
a7a4fd17 | 186 | { "/boot/develop/headers/be/midi2", 0, 0, 0 },\ |
512b62fb JM |
187 | { "/boot/develop/headers/be/media", 0, 0, 0 },\ |
188 | { "/boot/develop/headers/be/interface", 0, 0, 0 },\ | |
189 | { "/boot/develop/headers/be/device", 0, 0, 0 },\ | |
190 | { "/boot/develop/headers/be/app", 0, 0, 0 },\ | |
512b62fb | 191 | { "/boot/develop/headers/be/precompiled", 0, 0, 0 },\ |
a7a4fd17 FF |
192 | { "/boot/develop/headers/be/add-ons/input_server", 0, 0, 0 },\ |
193 | { "/boot/develop/headers/be/add-ons/net_server", 0, 0, 0 },\ | |
194 | { "/boot/develop/headers/be/add-ons/screen_saver", 0, 0, 0 },\ | |
195 | { "/boot/develop/headers/be/add-ons/tracker", 0, 0, 0 },\ | |
196 | { "/boot/develop/headers/be/be_apps/Deskbar", 0, 0, 0 },\ | |
197 | { "/boot/develop/headers/be/be_apps/NetPositive", 0, 0, 0 },\ | |
198 | { "/boot/develop/headers/be/be_apps/Tracker", 0, 0, 0 },\ | |
199 | { "/boot/develop/headers/be/drivers/tty", 0, 0, 0 },\ | |
200 | { "/boot/develop/headers/be/net/netinet", 0, 0, 0 },\ | |
201 | { "/boot/develop/headers/be/storage", 0, 0, 0 },\ | |
512b62fb | 202 | { "/boot/develop/headers/be", 0, 0, 0 },\ |
a7a4fd17 FF |
203 | { "/boot/develop/headers/cpp", 0, 0, 0 },\ |
204 | { "/boot/develop/headers/posix", 0, 0, 0 },\ | |
512b62fb JM |
205 | { "/boot/develop/headers", 0, 0, 0 }, \ |
206 | { 0, 0, 0, 0 } \ | |
207 | }; | |
208 | #else /* CROSS_COMPILE */ | |
209 | #undef INCLUDE_DEFAULTS | |
210 | #define INCLUDE_DEFAULTS \ | |
211 | { \ | |
212 | { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },\ | |
213 | { GCC_INCLUDE_DIR, "GCC", 0, 0 },\ | |
214 | { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1}, \ | |
215 | { CROSS_INCLUDE_DIR "/be/add-ons/graphics", 0, 0, 0 },\ | |
216 | { CROSS_INCLUDE_DIR "/be/devel", 0, 0, 0 },\ | |
217 | { CROSS_INCLUDE_DIR "/be/translation", 0, 0, 0 },\ | |
218 | { CROSS_INCLUDE_DIR "/be/mail", 0, 0, 0 },\ | |
219 | { CROSS_INCLUDE_DIR "/gnu", 0, 0, 0 },\ | |
220 | { CROSS_INCLUDE_DIR "/be/drivers", 0, 0, 0 },\ | |
221 | { CROSS_INCLUDE_DIR "/be/opengl", 0, 0, 0 },\ | |
222 | { CROSS_INCLUDE_DIR "/be/game", 0, 0, 0 },\ | |
223 | { CROSS_INCLUDE_DIR "/be/support", 0, 0, 0 },\ | |
224 | { CROSS_INCLUDE_DIR "/be/storage", 0, 0, 0 },\ | |
225 | { CROSS_INCLUDE_DIR "/be/kernel", 0, 0, 0 },\ | |
226 | { CROSS_INCLUDE_DIR "/be/net", 0, 0, 0 },\ | |
227 | { CROSS_INCLUDE_DIR "/be/midi", 0, 0, 0 },\ | |
a7a4fd17 | 228 | { CROSS_INCLUDE_DIR "/be/midi2", 0, 0, 0 },\ |
512b62fb JM |
229 | { CROSS_INCLUDE_DIR "/be/media", 0, 0, 0 },\ |
230 | { CROSS_INCLUDE_DIR "/be/interface", 0, 0, 0 },\ | |
231 | { CROSS_INCLUDE_DIR "/be/device", 0, 0, 0 },\ | |
232 | { CROSS_INCLUDE_DIR "/be/app", 0, 0, 0 },\ | |
512b62fb | 233 | { CROSS_INCLUDE_DIR "/be/precompiled", 0, 0, 0 },\ |
a7a4fd17 FF |
234 | { CROSS_INCLUDE_DIR "/be/add-ons/input_server", 0, 0, 0 },\ |
235 | { CROSS_INCLUDE_DIR "/be/add-ons/net_server", 0, 0, 0 },\ | |
236 | { CROSS_INCLUDE_DIR "/be/add-ons/screen_saver", 0, 0, 0 },\ | |
237 | { CROSS_INCLUDE_DIR "/be/add-ons/tracker", 0, 0, 0 },\ | |
238 | { CROSS_INCLUDE_DIR "/be/be_apps/Deskbar", 0, 0, 0 },\ | |
239 | { CROSS_INCLUDE_DIR "/be/be_apps/NetPositive", 0, 0, 0 },\ | |
240 | { CROSS_INCLUDE_DIR "/be/be_apps/Tracker", 0, 0, 0 },\ | |
241 | { CROSS_INCLUDE_DIR "/be/drivers/tty", 0, 0, 0 },\ | |
242 | { CROSS_INCLUDE_DIR "/be/net/netinet", 0, 0, 0 },\ | |
243 | { CROSS_INCLUDE_DIR "/be/storage", 0, 0, 0 },\ | |
512b62fb | 244 | { CROSS_INCLUDE_DIR "/be", 0, 0, 0 },\ |
a7a4fd17 FF |
245 | { CROSS_INCLUDE_DIR "/cpp", 0, 0, 0 },\ |
246 | { CROSS_INCLUDE_DIR "/posix", 0, 0, 0 },\ | |
512b62fb JM |
247 | { CROSS_INCLUDE_DIR , 0, 0, 0 }, \ |
248 | { 0, 0, 0, 0 } \ | |
249 | }; | |
250 | #endif | |
251 | ||
252 | /* Whee. LIBRARY_PATH is Be's LD_LIBRARY_PATH, which of course will | |
253 | cause nasty problems if we override it. */ | |
254 | #define LIBRARY_PATH_ENV "BELIBRARIES" | |
255 | ||
256 | /* BeOS doesn't have a separate math library. */ | |
257 | #define MATH_LIBRARY "" | |
258 | ||
259 | /* BeOS headers are C++-aware (and often use C++). */ | |
260 | #define NO_IMPLICIT_EXTERN_C | |
261 | ||
262 | /* Define this macro if in some cases global symbols from one translation | |
263 | unit may not be bound to undefined symbols in another translation unit | |
264 | without user intervention. For instance, under Microsoft Windows | |
265 | symbols must be explicitly imported from shared libraries (DLLs). */ | |
266 | #define MULTIPLE_SYMBOL_SPACES | |
f766bd46 FF |
267 | |
268 | /* A C statement to output assembler commands which will identify the object | |
269 | file as having been compiled with GNU CC. This isn't needed for BeOS | |
270 | because we use DWARF and DWARF has an DW_AT_producer tag that does the | |
271 | same thing. BeOS debuggers, like bdb, that don't know about this hack | |
272 | can get confused when they find two symbols with the same address, and | |
273 | print the wrong one (gcc2_compiled) in things like backtraces. The most | |
274 | likely ill effect of disabling this is that a BeOS port of gdb would not | |
275 | be able to tell that an executable was compiled with gcc if there was no | |
276 | DWARF info. */ | |
277 | #undef ASM_IDENTIFY_GCC | |
278 | #define ASM_IDENTIFY_GCC(FILE) |