]> gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/win-nt.h
PowerPC Windows NT support
[gcc.git] / gcc / config / rs6000 / win-nt.h
1 /* Definitions of target machine for GNU compiler, for PowerPC
2 running Windows/NT.
3 Copyright (C) 1995 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 /* Say this is Windows/NT for the other config files. */
24 #define WINDOWS_NT 1
25 #define COFF_WITH_PE 1
26
27 /* Default ABI to compile code for */
28 #define DEFAULT_ABI ABI_NT
29
30 #include "rs6000/powerpc.h"
31
32 /* Pseudo target that we can test in the md file. */
33 #undef TARGET_WINDOWS_NT
34 #define TARGET_WINDOWS_NT 1
35
36 #undef CPP_PREDEFINES
37 #define CPP_PREDEFINES "-DWIN32 -D_WIN32 \
38 -DWINNT -D__STDC__=0 -DALMOST_STDC \
39 -D_POWER -DPPC -Asystem(winnt) -Acpu(powerpc) -Amachine(powerpc)"
40
41 #if 0
42 #include "winnt/win-nt.h"
43 #endif
44
45 #undef LIB_SPEC
46 #define LIB_SPEC "%{mwindows:-subsystem:windows -entry:WinMainCRTStartup \
47 USER32.LIB GDI32.LIB COMDLG32.LIB WINSPOOL.LIB} \
48 %{!mwindows:-subsystem:console -entry:mainCRTStartup} \
49 %{mcrtmt:LIBCMT.LIB KERNEL32.LIB} %{!mcrtmt:LIBC.LIB KERNEL32.LIB} \
50 %{v}"
51
52 #undef LINK_SPEC
53 #define LINK_SPEC "%{V} %{v:%{!V:-V}}"
54
55 /* Allow switches specified in LIB_SPEC, but don't do anything with them
56 in the compiler. */
57 #undef SUBTARGET_SWITCHES
58 #define SUBTARGET_SWITCHES \
59 { "windows", 0 }, \
60 { "crtmt", 0 },
61
62 #undef XCOFF_DEBUGGING_INFO
63
64 /* this is pure coff, not xcoff */
65 #define SDB_DEBUGGING_INFO
66 #define DBX_DEBUGGING_INFO
67
68 #undef SDB_DELIM
69 #define SDB_DELIM ";"
70
71 #undef PREFERRED_DEBUGGING_TYPE
72 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
73
74 #undef PROCESSOR_DEFAULT
75 #define PROCESSOR_DEFAULT PROCESSOR_POWERPC
76
77 /* NT always runs little endian */
78 #undef BYTES_BIG_ENDIAN
79 #define BYTES_BIG_ENDIAN 0
80
81 #undef WORDS_BIG_ENDIAN
82 #define WORDS_BIG_ENDIAN 0
83
84 /* Define cutoff for using external functions to save floating point.
85 Currently on NT, always use inline stores */
86 #undef FP_SAVE_INLINE
87 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
88
89 /* Note, little endian systems trap on unaligned addresses, so never
90 turn off strict alignment in that case. */
91
92 #undef STRICT_ALIGNMENT
93 #define STRICT_ALIGNMENT 1
94
95 /* Align stack to 16 byte boundaries */
96 #undef STACK_BOUNDARY
97 #define STACK_BOUNDARY 128
98
99 /* No data type wants to be aligned rounder than this. */
100 #undef BIGGEST_ALIGNMENT
101 #define BIGGEST_ALIGNMENT 128
102
103 #undef TARGET_VERSION
104 #define TARGET_VERSION fprintf (stderr, " (PowerPC PE)");
105
106 #undef TARGET_DEFAULT
107 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)
108
109 #undef PROCESSOR_DEFAULT
110 #define PROCESSOR_DEFAULT PROCESSOR_PPC601
111
112 /* Address to save the TOC register */
113 #undef RS6000_SAVE_TOC
114 #define RS6000_SAVE_TOC plus_constant (virtual_incoming_args_rtx, -RS6000_SAVE_AREA - 8)
115
116 /* Windows NT specifies that r13 is reserved to the OS, so it is not available
117 to the normal user. */
118
119 #undef FIXED_R13
120 #define FIXED_R13 1
121
122 \f
123 /* Output .file and comments listing what options there are */
124 #undef ASM_FILE_START
125 #define ASM_FILE_START(FILE) \
126 { \
127 ASM_OUTPUT_OPTIONS (FILE); \
128 output_file_directive (FILE, main_input_filename); \
129 }
130
131 /* Define the extra sections we need. We define three: one is the read-only
132 data section which is used for constants. This is a csect whose name is
133 derived from the name of the input file. The second is for initialized
134 global variables. This is a csect whose name is that of the variable.
135 The third is the TOC. */
136
137 #undef SELECT_SECTION
138
139 #undef READONLY_DATA_SECTION
140 #undef EXTRA_SECTIONS
141 #define EXTRA_SECTIONS toc, bss
142
143 /* Define the routines to implement these extra sections. */
144
145 #undef EXTRA_SECTION_FUNCTIONS
146 #define EXTRA_SECTION_FUNCTIONS \
147 \
148 void \
149 toc_section () \
150 { \
151 }
152
153
154 #undef SELECT_RTX_SECTION
155 #undef ASM_DECLARE_FUNCTION_NAME
156
157 \f
158 /* This says how to output an assembler line
159 to define a global common symbol. */
160
161 #undef ASM_OUTPUT_ALIGNED_COMMON
162 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \
163 do { fputs ("\t.comm \t", (FILE)); \
164 assemble_name ((FILE), (NAME)); \
165 if ( (SIZE) > 4) \
166 fprintf ((FILE), ",%d,%d\n", (SIZE), 3); \
167 else \
168 fprintf( (FILE), ",%d\n", (SIZE)); \
169 } while (0)
170
171 #undef ASM_OUTPUT_ALIGNED_LOCAL
172
173 /* This says how to output an assembler line
174 to define a global common symbol. */
175
176 #undef ASM_OUTPUT_COMMON
177 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
178 do { fputs ("\t.comm \t", (FILE)); \
179 assemble_name ((FILE), (NAME)); \
180 fprintf ((FILE), ",%d\n", (SIZE)); } while (0)
181
182 /* This says how to output an assembler line
183 to define a local common symbol. */
184
185 #undef ASM_OUTPUT_LOCAL
186 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
187 do { fputs ("\t.lcomm \t", (FILE)); \
188 assemble_name ((FILE), (NAME)); \
189 fprintf ((FILE), ",%d\n", (SIZE)); \
190 } while (0)
191
192
193 /* Stuff to force fit us into the Motorola PPC assembler */
194
195 #if 0
196 #undef ASM_FILE_START
197 #define ASM_FILE_START(FILE) \
198 { \
199 output_file_directive (FILE, main_input_filename); \
200 fprintf (FILE, "\n#\tDirective section\n"); \
201 fprintf (FILE, "\t.section\t.drectve,\"iR\"\n"); \
202 fprintf (FILE, "\t.byte\t\"-defaultlib:LIBC\" \n"); \
203 fprintf (FILE, "\t.previous\n\n"); \
204 }
205 #endif
206
207 #undef ASM_FILE_START
208 #define ASM_FILE_START(FILE) \
209 { \
210 ASM_OUTPUT_OPTIONS (FILE); \
211 output_file_directive (FILE, main_input_filename); \
212 data_section (); \
213 }
214
215 #undef ASM_FILE_END
216
217 #undef ASM_OUTPUT_FUNCTION_PREFIX
218 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
219 { \
220 fprintf (FILE, "\n#\tFunction: '.."); \
221 assemble_name (FILE, NAME); \
222 fprintf (FILE, "'\n"); \
223 fprintf (FILE, "#\tText in section: <%s>\n\n","default"); \
224 fprintf (FILE, "#\tSetup MS Structured-Exception-Handling\n"); \
225 fprintf (FILE, "\t.pdata\n"); \
226 fprintf (FILE, "\t.align 2\n"); \
227 fprintf (FILE, "\t.ualong .."); \
228 assemble_name (FILE, NAME); \
229 fprintf (FILE, ","); \
230 assemble_name (FILE, NAME); \
231 fprintf (FILE, ".e,0,0,"); \
232 assemble_name (FILE, NAME); \
233 fprintf (FILE, ".b\n\n"); \
234 fprintf (FILE, "#\tSwitch to the relocation section\n"); \
235 fprintf (FILE, "\t.reldata\n"); \
236 }
237
238
239 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
240 { \
241 if (TREE_PUBLIC (DECL)) \
242 { \
243 fprintf (FILE, "\t.globl .."); \
244 assemble_name (FILE, NAME); \
245 fprintf (FILE, "\n"); \
246 } \
247 assemble_name (FILE, NAME); \
248 fprintf (FILE, ":\n"); \
249 fprintf (FILE, "\t.ualong .."); \
250 assemble_name (FILE, NAME); \
251 fprintf (FILE, ",.toc\n"); \
252 fprintf (FILE, "\t.section .text\n\t.align 2\n.."); \
253 assemble_name (FILE, NAME); \
254 fprintf (FILE, ":\n"); \
255 fprintf (FILE, "\t.function\t.."); \
256 assemble_name (FILE, NAME); \
257 fprintf (FILE, "\n"); \
258 }
259
260 /* This is how to output an assembler line defining a `double' constant. */
261
262 #undef ASM_OUTPUT_DOUBLE
263 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
264 { \
265 if (REAL_VALUE_ISINF (VALUE) \
266 || REAL_VALUE_ISNAN (VALUE) \
267 || REAL_VALUE_MINUS_ZERO (VALUE)) \
268 { \
269 long t[2]; \
270 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
271 fprintf (FILE, "\t.ualong 0x%lx\n\t.long 0x%lx\n", \
272 t[0] & 0xffffffff, t[1] & 0xffffffff); \
273 } \
274 else \
275 { \
276 char str[30]; \
277 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
278 fprintf (FILE, "\t.double %s\n", str); \
279 } \
280 }
281
282 /* This is how to output an assembler line defining a `float' constant. */
283
284 #undef ASM_OUTPUT_FLOAT
285 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
286 { \
287 if (REAL_VALUE_ISINF (VALUE) \
288 || REAL_VALUE_ISNAN (VALUE) \
289 || REAL_VALUE_MINUS_ZERO (VALUE)) \
290 { \
291 long t; \
292 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
293 fprintf (FILE, "\t.ualong 0x%lx\n", t & 0xffffffff); \
294 } \
295 else \
296 { \
297 char str[30]; \
298 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
299 fprintf (FILE, "\t.float %s\n", str); \
300 } \
301 }
302
303 /* Output before instructions. */
304 #undef TEXT_SECTION_ASM_OP
305 #define TEXT_SECTION_ASM_OP "\t.text"
306
307 /* Output before writable data. */
308 #undef DATA_SECTION_ASM_OP
309 #define DATA_SECTION_ASM_OP "\t.data"
310
311 /* Text to write out after a CALL that may be replaced by glue code by
312 the loader. The motorola asm demands that, for dll support, a .znop
313 be issued after a bl instruction, and the symbol on the .znop is the
314 symbol on the bl instruction */
315
316 #undef RS6000_CALL_GLUE
317 #define RS6000_CALL_GLUE "nop #\tFIXME: only works for non-dll calls."
318
319 #define RS6000_CALL_GLUE2 ".znop "
320
321 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
322
323 /* Output something to declare an external symbol to the assembler. Most
324 assemblers don't need this. */
325
326 #undef ASM_OUTPUT_EXTERNAL
327
328 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
329 { rtx _symref = XEXP (DECL_RTL (DECL), 0); \
330 if ((TREE_CODE (DECL) == VAR_DECL \
331 || TREE_CODE (DECL) == FUNCTION_DECL) \
332 && (NAME)[0] != '*' \
333 && (NAME)[strlen (NAME) - 1] != ']') \
334 { \
335 char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
336 strcpy (_name, XSTR (_symref, 0)); \
337 XSTR (_symref, 0) = _name; \
338 } \
339 fprintf (FILE, "\t.extern "); \
340 assemble_name (FILE, XSTR (_symref, 0)); \
341 if (TREE_CODE (DECL) == FUNCTION_DECL) \
342 { \
343 fprintf (FILE, "\n\t.extern .."); \
344 assemble_name (FILE, XSTR (_symref, 0)); \
345 } \
346 fprintf (FILE, "\n"); \
347 }
348
349 /* Similar, but for libcall. We only have to worry about the function name,
350 not that of the descriptor. */
351
352 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
353
354 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
355 { fprintf (FILE, "\t.extern .."); \
356 assemble_name (FILE, XSTR (FUN, 0)); \
357 fprintf (FILE, "\n"); \
358 }
359
360
361 /* Eliminate AIX style constant pool processing */
362 #undef LEGITIMATE_CONSTANT_POOL_BASE_P
363 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) 0
364
365 #undef LEGITIMATE_CONSTANT_POOL_ADDRESS_P
366 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) 0
367
368 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
369
370 #undef ASM_IDENTIFY_GCC
371 #define ASM_IDENTIFY_GCC(x)
372
373 #undef HAS_INIT_SECTION
374 #define HAS_INIT_SECTION
This page took 0.058669 seconds and 6 git commands to generate.