]> gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/win-nt.h
Daily bump.
[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, 1996, 1997, 1998 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 #define CPP_DEFAULT_SPEC "-D_ARCH_PPC"
31
32 #define ASM_DEFAULT_SPEC "-mppc"
33
34 /* Pseudo target that we can test in the md file. */
35 #define TARGET_WINDOWS_NT 1
36
37 #include "rs6000/rs6000.h"
38
39 #undef TARGET_DEFAULT
40 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
41
42 #undef PROCESSOR_DEFAULT
43 #define PROCESSOR_DEFAULT PROCESSOR_POWERPC
44
45 #undef CPP_PREDEFINES
46 #define CPP_PREDEFINES "-DWIN32 -D_WIN32 \
47 -DWINNT -D__STDC__=0 -DALMOST_STDC \
48 -D_POWER -D_ARCH_PPC -D__PPC__ -Asystem(winnt) -Acpu(powerpc) -Amachine(powerpc)"
49
50 #if 0
51 #include "winnt/win-nt.h"
52 #endif
53
54 #undef LIB_SPEC
55 #define LIB_SPEC "%{mwindows:-subsystem:windows -entry:WinMainCRTStartup \
56 USER32.LIB GDI32.LIB COMDLG32.LIB WINSPOOL.LIB} \
57 %{!mwindows:-subsystem console -e mainCRTStartup} \
58 %{mcrtmt:LIBCMT.LIB KERNEL32.LIB} %{!mcrtmt:-lkernel32 -lcygwin} \
59 %{v}"
60
61 #undef LINK_SPEC
62 #define LINK_SPEC "%{v:-V}"
63
64 /* Allow switches specified in LIB_SPEC, but don't do anything with them
65 in the compiler. */
66 #undef SUBTARGET_SWITCHES
67 #define SUBTARGET_SWITCHES \
68 { "windows", 0 }, \
69 { "crtmt", 0 },
70
71 #undef XCOFF_DEBUGGING_INFO
72
73 /* this is pure coff, not xcoff */
74 #define SDB_DEBUGGING_INFO
75 #define DBX_DEBUGGING_INFO
76
77 #undef SDB_DELIM
78 #define SDB_DELIM ";"
79
80 #undef PREFERRED_DEBUGGING_TYPE
81 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
82
83 /* NT always runs little endian */
84 #undef BYTES_BIG_ENDIAN
85 #define BYTES_BIG_ENDIAN 0
86
87 #undef WORDS_BIG_ENDIAN
88 #define WORDS_BIG_ENDIAN 0
89
90 /* Define cutoff for using external functions to save floating point.
91 Currently on NT, always use inline stores */
92 #undef FP_SAVE_INLINE
93 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
94
95 /* Note, little endian systems trap on unaligned addresses, so never
96 turn off strict alignment in that case. */
97
98 #undef STRICT_ALIGNMENT
99 #define STRICT_ALIGNMENT 1
100
101 /* Align stack to 16 byte boundaries */
102 #undef STACK_BOUNDARY
103 #define STACK_BOUNDARY 128
104
105 /* No data type wants to be aligned rounder than this. */
106 #undef BIGGEST_ALIGNMENT
107 #define BIGGEST_ALIGNMENT 128
108
109 /* NT aligns internal doubles in structures on dword boundaries. */
110 #undef BIGGEST_FIELD_ALIGNMENT
111 #define BIGGEST_FIELD_ALIGNMENT 64
112
113 #undef ADJUST_FIELD_ALIGN
114 #undef ROUND_TYPE_ALIGN
115
116 #undef TARGET_VERSION
117 #define TARGET_VERSION fprintf (stderr, " (PowerPC PE)");
118
119 #undef TARGET_DEFAULT
120 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)
121
122 /* MEM representing address to save the TOC register */
123 #undef RS6000_SAVE_TOC
124 #define RS6000_SAVE_TOC gen_rtx_MEM (Pmode, \
125 plus_constant (virtual_incoming_args_rtx,
126 -RS6000_SAVE_AREA - 8))
127
128 /* Windows NT specifies that r13 is reserved to the OS, so it is not available
129 to the normal user. */
130
131 #undef FIXED_R13
132 #define FIXED_R13 1
133 \f
134 /* This says how to output an assembler line
135 to define a global common symbol. */
136
137 #undef ASM_OUTPUT_ALIGNED_COMMON
138 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \
139 do { fputs ("\t.comm \t", (FILE)); \
140 assemble_name ((FILE), (NAME)); \
141 if ( (SIZE) > 4) \
142 fprintf ((FILE), ",%d,%d\n", (SIZE), 3); \
143 else \
144 fprintf( (FILE), ",%d\n", (SIZE)); \
145 } while (0)
146
147 #undef ASM_OUTPUT_ALIGNED_LOCAL
148
149 /* This says how to output an assembler line
150 to define a global common symbol. */
151
152 #undef ASM_OUTPUT_COMMON
153 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
154 do { fputs ("\t.comm \t", (FILE)); \
155 assemble_name ((FILE), (NAME)); \
156 fprintf ((FILE), ",%d\n", (SIZE)); } while (0)
157
158 /* This says how to output an assembler line
159 to define an aligned local common symbol. */
160
161 #undef ASM_OUTPUT_ALIGNED_LOCAL
162 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
163 do { \
164 bss_section (); \
165 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
166 ASM_OUTPUT_LABEL (FILE, NAME); \
167 ASM_OUTPUT_SKIP (FILE, SIZE); \
168 } while (0)
169
170 /* Describe how to emit uninitialized external linkage items */
171 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
172 do { \
173 ASM_GLOBALIZE_LABEL (FILE, NAME); \
174 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
175 } while (0)
176
177 /* This says out to put a global symbol in the BSS section */
178 #undef ASM_OUTPUT_ALIGNED_BSS
179 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
180 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
181
182
183 /* Stuff to force fit us into the Motorola PPC assembler */
184
185 #undef ASM_FILE_START
186 #define ASM_FILE_START(FILE) \
187 do { \
188 output_file_directive ((FILE), main_input_filename); \
189 rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
190 data_section (); \
191 } while (0)
192
193 #undef ASM_FILE_END
194
195 #undef ASM_DECLARE_FUNCTION_NAME
196 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
197 { \
198 tree exception_args; \
199 int i; \
200 \
201 if (TREE_PUBLIC (DECL)) \
202 { \
203 fprintf (FILE, "\t.globl .."); \
204 assemble_name (FILE, NAME); \
205 fprintf (FILE, "\n"); \
206 } \
207 \
208 fprintf (FILE, "\n#\tFunction: '.."); \
209 assemble_name (FILE, NAME); \
210 fputs ("'\n", FILE); \
211 fputs ("#\tText in section: <default>\n\n", FILE); \
212 fputs ("#\tSetup MS Structured-Exception-Handling\n", FILE); \
213 fputs ("\t.pdata\n", FILE); \
214 fputs ("\t.align 2\n", FILE); \
215 fputs ("\t.ualong ..", FILE); \
216 assemble_name (FILE, NAME); \
217 fputs (",", FILE); \
218 assemble_name (FILE, NAME); \
219 fputs (".e,", FILE); \
220 exception_args = lookup_attribute ("exception", \
221 TYPE_ATTRIBUTES (TREE_TYPE (DECL))); \
222 \
223 if (exception_args) \
224 exception_args = TREE_VALUE (exception_args); \
225 \
226 for (i = 0; i < 2; i++) \
227 { \
228 if (!exception_args) \
229 fputs ("0,", FILE); \
230 else \
231 { \
232 tree field = TREE_VALUE (exception_args); \
233 exception_args = TREE_PURPOSE (exception_args); \
234 if (TREE_CODE (field) == STRING_CST) \
235 fprintf (FILE, "%.*s,", TREE_STRING_LENGTH (field), \
236 TREE_STRING_POINTER (field)); \
237 else if (TREE_CODE (field) == IDENTIFIER_NODE) \
238 fprintf (FILE, "%.*s,", IDENTIFIER_LENGTH (field), \
239 IDENTIFIER_POINTER (field)); \
240 else \
241 abort (); \
242 } \
243 } \
244 \
245 assemble_name (FILE, NAME); \
246 fprintf (FILE, ".b\n\n"); \
247 fprintf (FILE, "#\tSwitch to the relocation section\n"); \
248 fprintf (FILE, "\t.reldata\n"); \
249 assemble_name (FILE, NAME); \
250 fprintf (FILE, ":\n"); \
251 fprintf (FILE, "\t.ualong .."); \
252 assemble_name (FILE, NAME); \
253 fprintf (FILE, ",.toc\n"); \
254 \
255 if (lookup_attribute ("dllexport", \
256 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
257 { \
258 fprintf (FILE, "\t.globl __imp_"); \
259 assemble_name (FILE, NAME); \
260 fprintf (FILE, "\n__imp_"); \
261 assemble_name (FILE, NAME); \
262 fprintf (FILE, ":\n\t.ulong "); \
263 assemble_name (FILE, NAME); \
264 fprintf (FILE, "\n"); \
265 } \
266 \
267 fprintf (FILE, "\t.section .text\n\t.align 2\n.."); \
268 assemble_name (FILE, NAME); \
269 fprintf (FILE, ":\n"); \
270 fprintf (FILE, "\t.function\t.."); \
271 assemble_name (FILE, NAME); \
272 fprintf (FILE, "\n"); \
273 }
274
275 /* This is how to output an assembler line defining a `double' constant. */
276
277 #undef ASM_OUTPUT_DOUBLE
278 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
279 { \
280 if (REAL_VALUE_ISINF (VALUE) \
281 || REAL_VALUE_ISNAN (VALUE) \
282 || REAL_VALUE_MINUS_ZERO (VALUE)) \
283 { \
284 long t[2]; \
285 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
286 fprintf (FILE, "\t.ualong 0x%lx\n\t.long 0x%lx\n", \
287 t[0] & 0xffffffff, t[1] & 0xffffffff); \
288 } \
289 else \
290 { \
291 char str[30]; \
292 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
293 fprintf (FILE, "\t.double %s\n", str); \
294 } \
295 }
296
297 /* This is how to output an assembler line defining a `float' constant. */
298
299 #undef ASM_OUTPUT_FLOAT
300 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
301 { \
302 if (REAL_VALUE_ISINF (VALUE) \
303 || REAL_VALUE_ISNAN (VALUE) \
304 || REAL_VALUE_MINUS_ZERO (VALUE)) \
305 { \
306 long t; \
307 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
308 fprintf (FILE, "\t.ualong 0x%lx\n", t & 0xffffffff); \
309 } \
310 else \
311 { \
312 char str[30]; \
313 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
314 fprintf (FILE, "\t.float %s\n", str); \
315 } \
316 }
317
318 /* Output before instructions. */
319 #undef TEXT_SECTION_ASM_OP
320 #define TEXT_SECTION_ASM_OP "\t.text"
321
322 /* Output before writable data. */
323 #undef DATA_SECTION_ASM_OP
324 #define DATA_SECTION_ASM_OP "\t.data"
325
326 /* Output to the bss section. */
327 #undef BSS_SECTION_ASM_OP
328 #define BSS_SECTION_ASM_OP "\t.section .bss"
329
330 /* Define the extra sections we need. We define a dummy TOC section,
331 plus sections to hold the list of static constructors (.ctors) and
332 destructors (.dtors). */
333
334 #undef READONLY_DATA_SECTION
335 #undef EXTRA_SECTIONS
336 #define EXTRA_SECTIONS in_toc, in_ctors, in_dtors
337
338 /* Define the routines to implement these extra sections. */
339
340 #undef EXTRA_SECTION_FUNCTIONS
341 #define EXTRA_SECTION_FUNCTIONS \
342 CTORS_SECTION_FUNCTION \
343 DTORS_SECTION_FUNCTION \
344 TOC_SECTION_FUNCTION \
345
346 #define TOC_SECTION_FUNCTION \
347 void \
348 toc_section () \
349 { \
350 }
351
352 #define CTORS_SECTION_ASM_OP ".section\t.ctors"
353 #define CTORS_SECTION_FUNCTION \
354 void \
355 ctors_section () \
356 { \
357 if (in_section != in_ctors) \
358 { \
359 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
360 in_section = in_ctors; \
361 } \
362 }
363
364 #define DTORS_SECTION_ASM_OP ".section\t.dtors"
365 #define DTORS_SECTION_FUNCTION \
366 void \
367 dtors_section () \
368 { \
369 if (in_section != in_dtors) \
370 { \
371 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
372 in_section = in_dtors; \
373 } \
374 }
375
376 #undef SELECT_SECTION
377 #undef SELECT_RTX_SECTION
378
379 /* Make sure __main gets called */
380 #define INVOKE__main 1
381
382 /* A C statement (sans semicolon) to output an element in the table of
383 global constructors. */
384 #undef ASM_OUTPUT_CONSTRUCTOR
385 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
386 do { \
387 ctors_section (); \
388 fprintf (FILE, "\t.ualong "); \
389 assemble_name (FILE, NAME); \
390 fprintf (FILE, "\n"); \
391 } while (0)
392
393 /* A C statement (sans semicolon) to output an element in the table of
394 global destructors. */
395 #undef ASM_OUTPUT_DESTRUCTOR
396 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
397 do { \
398 dtors_section (); \
399 fprintf (FILE, "\t.ualong "); \
400 assemble_name (FILE, NAME); \
401 fprintf (FILE, "\n"); \
402 } while (0)
403
404
405 /* Text to write out after a CALL that may be replaced by glue code by
406 the loader. The motorola asm demands that, for dll support, a .znop
407 be issued after a bl instruction, and the symbol on the .znop is the
408 symbol on the bl instruction */
409
410 #undef RS6000_CALL_GLUE
411 #define RS6000_CALL_GLUE "nop #\tFIXME: only works for non-dll calls."
412
413 #define RS6000_CALL_GLUE2 ".znop "
414
415 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
416
417 /* Output something to declare an external symbol to the assembler. Most
418 assemblers don't need this. */
419
420 #undef ASM_OUTPUT_EXTERNAL
421
422 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
423 { \
424 char *_name; \
425 rtx _symref = XEXP (DECL_RTL (DECL), 0); \
426 if ((TREE_CODE (DECL) == VAR_DECL \
427 || TREE_CODE (DECL) == FUNCTION_DECL) \
428 && (NAME)[strlen (NAME) - 1] != ']') \
429 { \
430 _name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
431 strcpy (_name, XSTR (_symref, 0)); \
432 XSTR (_symref, 0) = _name; \
433 } \
434 else \
435 _name = XSTR (_symref, 0); \
436 \
437 if (DECL_FUNCTION_CODE (DECL) == 0) \
438 { \
439 fputs ("\t.extern ", FILE); \
440 assemble_name (FILE, _name); \
441 putc ('\n', FILE); \
442 if (TREE_CODE (DECL) == FUNCTION_DECL) \
443 { \
444 fputs ("\t.extern ..", FILE); \
445 assemble_name (FILE, _name); \
446 putc ('\n', FILE); \
447 } \
448 } \
449 }
450
451 /* Similar, but for libcall. We only have to worry about the function name,
452 not that of the descriptor. */
453
454 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
455
456 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
457 { fprintf (FILE, "\t.extern .."); \
458 assemble_name (FILE, XSTR (FUN, 0)); \
459 fprintf (FILE, "\n"); \
460 }
461
462 /* The prefix to add to user-visible assembler symbols. */
463
464 #define USER_LABEL_PREFIX ".."
465
466 /* Eliminate AIX style constant pool processing */
467 #undef LEGITIMATE_CONSTANT_POOL_BASE_P
468 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) 0
469
470 #undef LEGITIMATE_CONSTANT_POOL_ADDRESS_P
471 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) 0
472
473 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
474
475 #undef ASM_IDENTIFY_GCC
476 #define ASM_IDENTIFY_GCC(x)
477
478 /* Output assembler code for a block containing the constant parts
479 of a trampoline, leaving space for the variable parts.
480
481 The trampoline should set the static chain pointer to value placed
482 into the trampoline and should branch to the specified routine. */
483 #define TRAMPOLINE_TEMPLATE(FILE) rs6000_trampoline_template (FILE)
This page took 0.060674 seconds and 5 git commands to generate.