]> gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/win-nt.h
Make BIGGEST_FIELD_ALIGNMENT 64
[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 -D_ARCH_PPC -D__PPC__ -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 -e mainCRTStartup} \
49 %{mcrtmt:LIBCMT.LIB KERNEL32.LIB} %{!mcrtmt:-lkernel32 -lcygwin} \
50 %{v}"
51
52 #undef LINK_SPEC
53 #define LINK_SPEC "%{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 /* NT aligns internal doubles in structures on dword boundaries. */
104 #undef BIGGEST_FIELD_ALIGNMENT
105 #define BIGGEST_FIELD_ALIGNMENT 64
106
107 #undef TARGET_VERSION
108 #define TARGET_VERSION fprintf (stderr, " (PowerPC PE)");
109
110 #undef TARGET_DEFAULT
111 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)
112
113 #undef PROCESSOR_DEFAULT
114 #define PROCESSOR_DEFAULT PROCESSOR_PPC601
115
116 /* Address to save the TOC register */
117 #undef RS6000_SAVE_TOC
118 #define RS6000_SAVE_TOC plus_constant (virtual_incoming_args_rtx, -RS6000_SAVE_AREA - 8)
119
120 /* Windows NT specifies that r13 is reserved to the OS, so it is not available
121 to the normal user. */
122
123 #undef FIXED_R13
124 #define FIXED_R13 1
125
126 \f
127 /* Output .file and comments listing what options there are */
128 #undef ASM_FILE_START
129 #define ASM_FILE_START(FILE) \
130 { \
131 ASM_OUTPUT_OPTIONS (FILE); \
132 output_file_directive (FILE, main_input_filename); \
133 }
134
135 \f
136 /* This says how to output an assembler line
137 to define a global common symbol. */
138
139 #undef ASM_OUTPUT_ALIGNED_COMMON
140 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \
141 do { fputs ("\t.comm \t", (FILE)); \
142 assemble_name ((FILE), (NAME)); \
143 if ( (SIZE) > 4) \
144 fprintf ((FILE), ",%d,%d\n", (SIZE), 3); \
145 else \
146 fprintf( (FILE), ",%d\n", (SIZE)); \
147 } while (0)
148
149 #undef ASM_OUTPUT_ALIGNED_LOCAL
150
151 /* This says how to output an assembler line
152 to define a global common symbol. */
153
154 #undef ASM_OUTPUT_COMMON
155 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
156 do { fputs ("\t.comm \t", (FILE)); \
157 assemble_name ((FILE), (NAME)); \
158 fprintf ((FILE), ",%d\n", (SIZE)); } while (0)
159
160 /* This says how to output an assembler line
161 to define an aligned local common symbol. */
162
163 #undef ASM_OUTPUT_ALIGNED_LOCAL
164 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
165 do { \
166 bss_section (); \
167 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
168 ASM_OUTPUT_LABEL (FILE, NAME); \
169 ASM_OUTPUT_SKIP (FILE, SIZE); \
170 } while (0)
171
172 /* Describe how to emit unitialized external linkage items */
173 #define ASM_OUTPUT_ALIGNED_BSS(FILE, NAME, SIZE, ALIGN) \
174 do { \
175 ASM_GLOBALIZE_LABEL (FILE, NAME); \
176 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
177 } while (0)
178
179 /* This says out to put a global symbol in the BSS section */
180 #undef ASM_OUTPUT_ALIGNED_BSS
181 #define ASM_OUTPUT_ALIGNED_BSS(FILE, NAME, SIZE, ALIGN) \
182 asm_output_aligned_bss ((FILE), (NAME), (SIZE), (ALIGN))
183
184
185 /* Stuff to force fit us into the Motorola PPC assembler */
186
187 #if 0
188 #undef ASM_FILE_START
189 #define ASM_FILE_START(FILE) \
190 { \
191 output_file_directive (FILE, main_input_filename); \
192 fprintf (FILE, "\n#\tDirective section\n"); \
193 fprintf (FILE, "\t.section\t.drectve,\"iR\"\n"); \
194 fprintf (FILE, "\t.byte\t\"-defaultlib:LIBC\" \n"); \
195 fprintf (FILE, "\t.previous\n\n"); \
196 }
197 #endif
198
199 #undef ASM_FILE_START
200 #define ASM_FILE_START(FILE) \
201 { \
202 ASM_OUTPUT_OPTIONS (FILE); \
203 output_file_directive (FILE, main_input_filename); \
204 data_section (); \
205 }
206
207 #undef ASM_FILE_END
208
209 #undef ASM_DECLARE_FUNCTION_NAME
210 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
211 { \
212 tree exception_args; \
213 int i; \
214 \
215 if (TREE_PUBLIC (DECL)) \
216 { \
217 fprintf (FILE, "\t.globl .."); \
218 assemble_name (FILE, NAME); \
219 fprintf (FILE, "\n"); \
220 } \
221 assemble_name (FILE, NAME); \
222 fprintf (FILE, ":\n"); \
223 fprintf (FILE, "\t.ualong .."); \
224 assemble_name (FILE, NAME); \
225 fprintf (FILE, ",.toc\n"); \
226 \
227 fprintf (FILE, "\n#\tFunction: '.."); \
228 assemble_name (FILE, NAME); \
229 fputs ("'\n", FILE); \
230 fputs ("#\tText in section: <default>\n\n", FILE); \
231 fputs ("#\tSetup MS Structured-Exception-Handling\n", FILE); \
232 fputs ("\t.pdata\n", FILE); \
233 fputs ("\t.align 2\n", FILE); \
234 fputs ("\t.ualong ..", FILE); \
235 assemble_name (FILE, NAME); \
236 fputs (",", FILE); \
237 assemble_name (FILE, NAME); \
238 fputs (".e,", FILE); \
239 exception_args = lookup_attribute ("exception", \
240 TYPE_ATTRIBUTES (TREE_TYPE (DECL))); \
241 \
242 if (exception_args) \
243 exception_args = TREE_VALUE (exception_args); \
244 \
245 for (i = 0; i < 2; i++) \
246 { \
247 if (!exception_args) \
248 fputs ("0,", FILE); \
249 else \
250 { \
251 tree field = TREE_VALUE (exception_args); \
252 exception_args = TREE_PURPOSE (exception_args); \
253 if (TREE_CODE (field) == STRING_CST) \
254 fprintf (FILE, "%.*s,", TREE_STRING_LENGTH (field), \
255 TREE_STRING_POINTER (field)); \
256 else if (TREE_CODE (field) == IDENTIFIER_NODE) \
257 fprintf (FILE, "%.*s,", IDENTIFIER_LENGTH (field), \
258 IDENTIFIER_POINTER (field)); \
259 else \
260 abort (); \
261 } \
262 } \
263 \
264 assemble_name (FILE, NAME); \
265 fprintf (FILE, ".b\n\n"); \
266 fprintf (FILE, "#\tSwitch to the relocation section\n"); \
267 fprintf (FILE, "\t.reldata\n"); \
268 \
269 if (lookup_attribute ("dllexport", \
270 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
271 { \
272 fprintf (FILE, "\t.globl __imp_"); \
273 assemble_name (FILE, NAME); \
274 fprintf (FILE, "\n__imp_"); \
275 assemble_name (FILE, NAME); \
276 fprintf (FILE, ":\n\t.ulong "); \
277 assemble_name (FILE, NAME); \
278 fprintf (FILE, "\n"); \
279 } \
280 \
281 fprintf (FILE, "\t.section .text\n\t.align 2\n.."); \
282 assemble_name (FILE, NAME); \
283 fprintf (FILE, ":\n"); \
284 fprintf (FILE, "\t.function\t.."); \
285 assemble_name (FILE, NAME); \
286 fprintf (FILE, "\n"); \
287 }
288
289 /* This is how to output an assembler line defining a `double' constant. */
290
291 #undef ASM_OUTPUT_DOUBLE
292 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
293 { \
294 if (REAL_VALUE_ISINF (VALUE) \
295 || REAL_VALUE_ISNAN (VALUE) \
296 || REAL_VALUE_MINUS_ZERO (VALUE)) \
297 { \
298 long t[2]; \
299 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
300 fprintf (FILE, "\t.ualong 0x%lx\n\t.long 0x%lx\n", \
301 t[0] & 0xffffffff, t[1] & 0xffffffff); \
302 } \
303 else \
304 { \
305 char str[30]; \
306 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
307 fprintf (FILE, "\t.double %s\n", str); \
308 } \
309 }
310
311 /* This is how to output an assembler line defining a `float' constant. */
312
313 #undef ASM_OUTPUT_FLOAT
314 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
315 { \
316 if (REAL_VALUE_ISINF (VALUE) \
317 || REAL_VALUE_ISNAN (VALUE) \
318 || REAL_VALUE_MINUS_ZERO (VALUE)) \
319 { \
320 long t; \
321 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
322 fprintf (FILE, "\t.ualong 0x%lx\n", t & 0xffffffff); \
323 } \
324 else \
325 { \
326 char str[30]; \
327 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
328 fprintf (FILE, "\t.float %s\n", str); \
329 } \
330 }
331
332 /* Output before instructions. */
333 #undef TEXT_SECTION_ASM_OP
334 #define TEXT_SECTION_ASM_OP "\t.text"
335
336 /* Output before writable data. */
337 #undef DATA_SECTION_ASM_OP
338 #define DATA_SECTION_ASM_OP "\t.data"
339
340 /* Output to the bss section. */
341 #undef BSS_SECTION_ASM_OP
342 #define BSS_SECTION_ASM_OP "\t.section .bss"
343
344 /* Define the extra sections we need. We define a dummy TOC section,
345 plus sections to hold the list of static constructors (.ctors) and
346 destructors (.dtors). */
347
348 #undef READONLY_DATA_SECTION
349 #undef EXTRA_SECTIONS
350 #define EXTRA_SECTIONS in_toc, in_ctors, in_dtors
351
352 /* Define the routines to implement these extra sections. */
353
354 #undef EXTRA_SECTION_FUNCTIONS
355 #define EXTRA_SECTION_FUNCTIONS \
356 CTORS_SECTION_FUNCTION \
357 DTORS_SECTION_FUNCTION \
358 TOC_SECTION_FUNCTION \
359
360 #define TOC_SECTION_FUNCTION \
361 void \
362 toc_section () \
363 { \
364 }
365
366 #define CTORS_SECTION_ASM_OP ".section\t.ctors"
367 #define CTORS_SECTION_FUNCTION \
368 void \
369 ctors_section () \
370 { \
371 if (in_section != in_ctors) \
372 { \
373 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
374 in_section = in_ctors; \
375 } \
376 }
377
378 #define DTORS_SECTION_ASM_OP ".section\t.dtors"
379 #define DTORS_SECTION_FUNCTION \
380 void \
381 dtors_section () \
382 { \
383 if (in_section != in_dtors) \
384 { \
385 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
386 in_section = in_dtors; \
387 } \
388 }
389
390 #undef SELECT_SECTION
391 #undef SELECT_RTX_SECTION
392
393 /* Make sure __main gets called */
394 #define INVOKE__main 1
395
396 /* A C statement (sans semicolon) to output an element in the table of
397 global constructors. */
398 #undef ASM_OUTPUT_CONSTRUCTOR
399 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
400 do { \
401 ctors_section (); \
402 fprintf (FILE, "\t.ualong "); \
403 assemble_name (FILE, NAME); \
404 fprintf (FILE, "\n"); \
405 } while (0)
406
407 /* A C statement (sans semicolon) to output an element in the table of
408 global destructors. */
409 #undef ASM_OUTPUT_DESTRUCTOR
410 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
411 do { \
412 dtors_section (); \
413 fprintf (FILE, "\t.ualong "); \
414 assemble_name (FILE, NAME); \
415 fprintf (FILE, "\n"); \
416 } while (0)
417
418
419 /* Text to write out after a CALL that may be replaced by glue code by
420 the loader. The motorola asm demands that, for dll support, a .znop
421 be issued after a bl instruction, and the symbol on the .znop is the
422 symbol on the bl instruction */
423
424 #undef RS6000_CALL_GLUE
425 #define RS6000_CALL_GLUE "nop #\tFIXME: only works for non-dll calls."
426
427 #define RS6000_CALL_GLUE2 ".znop "
428
429 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
430
431 /* Output something to declare an external symbol to the assembler. Most
432 assemblers don't need this. */
433
434 #undef ASM_OUTPUT_EXTERNAL
435
436 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
437 { \
438 char *_name; \
439 rtx _symref = XEXP (DECL_RTL (DECL), 0); \
440 if ((TREE_CODE (DECL) == VAR_DECL \
441 || TREE_CODE (DECL) == FUNCTION_DECL) \
442 && (NAME)[strlen (NAME) - 1] != ']') \
443 { \
444 _name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
445 strcpy (_name, XSTR (_symref, 0)); \
446 XSTR (_symref, 0) = _name; \
447 } \
448 else \
449 _name = XSTR (_symref, 0); \
450 \
451 if (DECL_FUNCTION_CODE (DECL) == 0) \
452 { \
453 fputs ("\t.extern ", FILE); \
454 assemble_name (FILE, _name); \
455 putc ('\n', FILE); \
456 if (TREE_CODE (DECL) == FUNCTION_DECL) \
457 { \
458 fputs ("\t.extern ..", FILE); \
459 assemble_name (FILE, _name); \
460 putc ('\n', FILE); \
461 } \
462 } \
463 }
464
465 /* Similar, but for libcall. We only have to worry about the function name,
466 not that of the descriptor. */
467
468 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
469
470 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
471 { fprintf (FILE, "\t.extern .."); \
472 assemble_name (FILE, XSTR (FUN, 0)); \
473 fprintf (FILE, "\n"); \
474 }
475
476
477 /* Eliminate AIX style constant pool processing */
478 #undef LEGITIMATE_CONSTANT_POOL_BASE_P
479 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) 0
480
481 #undef LEGITIMATE_CONSTANT_POOL_ADDRESS_P
482 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) 0
483
484 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
485
486 #undef ASM_IDENTIFY_GCC
487 #define ASM_IDENTIFY_GCC(x)
488
489 #undef HAS_INIT_SECTION
490 #define HAS_INIT_SECTION
This page took 0.063106 seconds and 6 git commands to generate.