]>
gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/win-nt.h
1 /* Definitions of target machine for GNU compiler, for PowerPC
3 Copyright (C) 1995 Free Software Foundation, Inc.
4 Contributed by Cygnus Support.
6 This file is part of GNU CC.
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)
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.
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. */
23 /* Say this is Windows/NT for the other config files. */
25 #define COFF_WITH_PE 1
27 /* Default ABI to compile code for */
28 #define DEFAULT_ABI ABI_NT
30 #include "rs6000/powerpc.h"
32 /* Pseudo target that we can test in the md file. */
33 #undef TARGET_WINDOWS_NT
34 #define TARGET_WINDOWS_NT 1
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)"
42 #include "winnt/win-nt.h"
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} \
53 #define LINK_SPEC "%{v:-V}"
55 /* Allow switches specified in LIB_SPEC, but don't do anything with them
57 #undef SUBTARGET_SWITCHES
58 #define SUBTARGET_SWITCHES \
62 #undef XCOFF_DEBUGGING_INFO
64 /* this is pure coff, not xcoff */
65 #define SDB_DEBUGGING_INFO
66 #define DBX_DEBUGGING_INFO
71 #undef PREFERRED_DEBUGGING_TYPE
72 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
74 #undef PROCESSOR_DEFAULT
75 #define PROCESSOR_DEFAULT PROCESSOR_POWERPC
77 /* NT always runs little endian */
78 #undef BYTES_BIG_ENDIAN
79 #define BYTES_BIG_ENDIAN 0
81 #undef WORDS_BIG_ENDIAN
82 #define WORDS_BIG_ENDIAN 0
84 /* Define cutoff for using external functions to save floating point.
85 Currently on NT, always use inline stores */
87 #define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
89 /* Note, little endian systems trap on unaligned addresses, so never
90 turn off strict alignment in that case. */
92 #undef STRICT_ALIGNMENT
93 #define STRICT_ALIGNMENT 1
95 /* Align stack to 16 byte boundaries */
97 #define STACK_BOUNDARY 128
99 /* No data type wants to be aligned rounder than this. */
100 #undef BIGGEST_ALIGNMENT
101 #define BIGGEST_ALIGNMENT 128
103 /* NT aligns internal doubles in structures on dword boundaries. */
104 #undef BIGGEST_FIELD_ALIGNMENT
105 #define BIGGEST_FIELD_ALIGNMENT 64
107 #undef ADJUST_FIELD_ALIGN
108 #undef ROUND_TYPE_ALIGN
110 #undef TARGET_VERSION
111 #define TARGET_VERSION fprintf (stderr, " (PowerPC PE)");
113 #undef TARGET_DEFAULT
114 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)
116 #undef PROCESSOR_DEFAULT
117 #define PROCESSOR_DEFAULT PROCESSOR_PPC601
119 /* Address to save the TOC register */
120 #undef RS6000_SAVE_TOC
121 #define RS6000_SAVE_TOC plus_constant (virtual_incoming_args_rtx, -RS6000_SAVE_AREA - 8)
123 /* Windows NT specifies that r13 is reserved to the OS, so it is not available
124 to the normal user. */
130 /* Output .file and comments listing what options there are */
131 #undef ASM_FILE_START
132 #define ASM_FILE_START(FILE) \
134 ASM_OUTPUT_OPTIONS (FILE); \
135 output_file_directive (FILE, main_input_filename); \
139 /* This says how to output an assembler line
140 to define a global common symbol. */
142 #undef ASM_OUTPUT_ALIGNED_COMMON
143 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \
144 do { fputs ("\t.comm \t", (FILE)); \
145 assemble_name ((FILE), (NAME)); \
147 fprintf ((FILE), ",%d,%d\n", (SIZE), 3); \
149 fprintf( (FILE), ",%d\n", (SIZE)); \
152 #undef ASM_OUTPUT_ALIGNED_LOCAL
154 /* This says how to output an assembler line
155 to define a global common symbol. */
157 #undef ASM_OUTPUT_COMMON
158 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
159 do { fputs ("\t.comm \t", (FILE)); \
160 assemble_name ((FILE), (NAME)); \
161 fprintf ((FILE), ",%d\n", (SIZE)); } while (0)
163 /* This says how to output an assembler line
164 to define an aligned local common symbol. */
166 #undef ASM_OUTPUT_ALIGNED_LOCAL
167 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
170 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
171 ASM_OUTPUT_LABEL (FILE, NAME); \
172 ASM_OUTPUT_SKIP (FILE, SIZE); \
175 /* Describe how to emit unitialized external linkage items */
176 #define ASM_OUTPUT_ALIGNED_BSS(FILE, NAME, SIZE, ALIGN) \
178 ASM_GLOBALIZE_LABEL (FILE, NAME); \
179 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
182 /* This says out to put a global symbol in the BSS section */
183 #undef ASM_OUTPUT_ALIGNED_BSS
184 #define ASM_OUTPUT_ALIGNED_BSS(FILE, NAME, SIZE, ALIGN) \
185 asm_output_aligned_bss ((FILE), (NAME), (SIZE), (ALIGN))
188 /* Stuff to force fit us into the Motorola PPC assembler */
191 #undef ASM_FILE_START
192 #define ASM_FILE_START(FILE) \
194 output_file_directive (FILE, main_input_filename); \
195 fprintf (FILE, "\n#\tDirective section\n"); \
196 fprintf (FILE, "\t.section\t.drectve,\"iR\"\n"); \
197 fprintf (FILE, "\t.byte\t\"-defaultlib:LIBC\" \n"); \
198 fprintf (FILE, "\t.previous\n\n"); \
202 #undef ASM_FILE_START
203 #define ASM_FILE_START(FILE) \
205 ASM_OUTPUT_OPTIONS (FILE); \
206 output_file_directive (FILE, main_input_filename); \
212 #undef ASM_DECLARE_FUNCTION_NAME
213 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
215 tree exception_args; \
218 if (TREE_PUBLIC (DECL)) \
220 fprintf (FILE, "\t.globl .."); \
221 assemble_name (FILE, NAME); \
222 fprintf (FILE, "\n"); \
224 assemble_name (FILE, NAME); \
225 fprintf (FILE, ":\n"); \
226 fprintf (FILE, "\t.ualong .."); \
227 assemble_name (FILE, NAME); \
228 fprintf (FILE, ",.toc\n"); \
230 fprintf (FILE, "\n#\tFunction: '.."); \
231 assemble_name (FILE, NAME); \
232 fputs ("'\n", FILE); \
233 fputs ("#\tText in section: <default>\n\n", FILE); \
234 fputs ("#\tSetup MS Structured-Exception-Handling\n", FILE); \
235 fputs ("\t.pdata\n", FILE); \
236 fputs ("\t.align 2\n", FILE); \
237 fputs ("\t.ualong ..", FILE); \
238 assemble_name (FILE, NAME); \
240 assemble_name (FILE, NAME); \
241 fputs (".e,", FILE); \
242 exception_args = lookup_attribute ("exception", \
243 TYPE_ATTRIBUTES (TREE_TYPE (DECL))); \
245 if (exception_args) \
246 exception_args = TREE_VALUE (exception_args); \
248 for (i = 0; i < 2; i++) \
250 if (!exception_args) \
251 fputs ("0,", FILE); \
254 tree field = TREE_VALUE (exception_args); \
255 exception_args = TREE_PURPOSE (exception_args); \
256 if (TREE_CODE (field) == STRING_CST) \
257 fprintf (FILE, "%.*s,", TREE_STRING_LENGTH (field), \
258 TREE_STRING_POINTER (field)); \
259 else if (TREE_CODE (field) == IDENTIFIER_NODE) \
260 fprintf (FILE, "%.*s,", IDENTIFIER_LENGTH (field), \
261 IDENTIFIER_POINTER (field)); \
267 assemble_name (FILE, NAME); \
268 fprintf (FILE, ".b\n\n"); \
269 fprintf (FILE, "#\tSwitch to the relocation section\n"); \
270 fprintf (FILE, "\t.reldata\n"); \
272 if (lookup_attribute ("dllexport", \
273 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
275 fprintf (FILE, "\t.globl __imp_"); \
276 assemble_name (FILE, NAME); \
277 fprintf (FILE, "\n__imp_"); \
278 assemble_name (FILE, NAME); \
279 fprintf (FILE, ":\n\t.ulong "); \
280 assemble_name (FILE, NAME); \
281 fprintf (FILE, "\n"); \
284 fprintf (FILE, "\t.section .text\n\t.align 2\n.."); \
285 assemble_name (FILE, NAME); \
286 fprintf (FILE, ":\n"); \
287 fprintf (FILE, "\t.function\t.."); \
288 assemble_name (FILE, NAME); \
289 fprintf (FILE, "\n"); \
292 /* This is how to output an assembler line defining a `double' constant. */
294 #undef ASM_OUTPUT_DOUBLE
295 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
297 if (REAL_VALUE_ISINF (VALUE) \
298 || REAL_VALUE_ISNAN (VALUE) \
299 || REAL_VALUE_MINUS_ZERO (VALUE)) \
302 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
303 fprintf (FILE, "\t.ualong 0x%lx\n\t.long 0x%lx\n", \
304 t[0] & 0xffffffff, t[1] & 0xffffffff); \
309 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
310 fprintf (FILE, "\t.double %s\n", str); \
314 /* This is how to output an assembler line defining a `float' constant. */
316 #undef ASM_OUTPUT_FLOAT
317 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
319 if (REAL_VALUE_ISINF (VALUE) \
320 || REAL_VALUE_ISNAN (VALUE) \
321 || REAL_VALUE_MINUS_ZERO (VALUE)) \
324 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
325 fprintf (FILE, "\t.ualong 0x%lx\n", t & 0xffffffff); \
330 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
331 fprintf (FILE, "\t.float %s\n", str); \
335 /* Output before instructions. */
336 #undef TEXT_SECTION_ASM_OP
337 #define TEXT_SECTION_ASM_OP "\t.text"
339 /* Output before writable data. */
340 #undef DATA_SECTION_ASM_OP
341 #define DATA_SECTION_ASM_OP "\t.data"
343 /* Output to the bss section. */
344 #undef BSS_SECTION_ASM_OP
345 #define BSS_SECTION_ASM_OP "\t.section .bss"
347 /* Define the extra sections we need. We define a dummy TOC section,
348 plus sections to hold the list of static constructors (.ctors) and
349 destructors (.dtors). */
351 #undef READONLY_DATA_SECTION
352 #undef EXTRA_SECTIONS
353 #define EXTRA_SECTIONS in_toc, in_ctors, in_dtors
355 /* Define the routines to implement these extra sections. */
357 #undef EXTRA_SECTION_FUNCTIONS
358 #define EXTRA_SECTION_FUNCTIONS \
359 CTORS_SECTION_FUNCTION \
360 DTORS_SECTION_FUNCTION \
361 TOC_SECTION_FUNCTION \
363 #define TOC_SECTION_FUNCTION \
369 #define CTORS_SECTION_ASM_OP ".section\t.ctors"
370 #define CTORS_SECTION_FUNCTION \
374 if (in_section != in_ctors) \
376 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
377 in_section = in_ctors; \
381 #define DTORS_SECTION_ASM_OP ".section\t.dtors"
382 #define DTORS_SECTION_FUNCTION \
386 if (in_section != in_dtors) \
388 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
389 in_section = in_dtors; \
393 #undef SELECT_SECTION
394 #undef SELECT_RTX_SECTION
396 /* Make sure __main gets called */
397 #define INVOKE__main 1
399 /* A C statement (sans semicolon) to output an element in the table of
400 global constructors. */
401 #undef ASM_OUTPUT_CONSTRUCTOR
402 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
405 fprintf (FILE, "\t.ualong "); \
406 assemble_name (FILE, NAME); \
407 fprintf (FILE, "\n"); \
410 /* A C statement (sans semicolon) to output an element in the table of
411 global destructors. */
412 #undef ASM_OUTPUT_DESTRUCTOR
413 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
416 fprintf (FILE, "\t.ualong "); \
417 assemble_name (FILE, NAME); \
418 fprintf (FILE, "\n"); \
422 /* Text to write out after a CALL that may be replaced by glue code by
423 the loader. The motorola asm demands that, for dll support, a .znop
424 be issued after a bl instruction, and the symbol on the .znop is the
425 symbol on the bl instruction */
427 #undef RS6000_CALL_GLUE
428 #define RS6000_CALL_GLUE "nop #\tFIXME: only works for non-dll calls."
430 #define RS6000_CALL_GLUE2 ".znop "
432 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
434 /* Output something to declare an external symbol to the assembler. Most
435 assemblers don't need this. */
437 #undef ASM_OUTPUT_EXTERNAL
439 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
442 rtx _symref = XEXP (DECL_RTL (DECL), 0); \
443 if ((TREE_CODE (DECL) == VAR_DECL \
444 || TREE_CODE (DECL) == FUNCTION_DECL) \
445 && (NAME)[strlen (NAME) - 1] != ']') \
447 _name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
448 strcpy (_name, XSTR (_symref, 0)); \
449 XSTR (_symref, 0) = _name; \
452 _name = XSTR (_symref, 0); \
454 if (DECL_FUNCTION_CODE (DECL) == 0) \
456 fputs ("\t.extern ", FILE); \
457 assemble_name (FILE, _name); \
459 if (TREE_CODE (DECL) == FUNCTION_DECL) \
461 fputs ("\t.extern ..", FILE); \
462 assemble_name (FILE, _name); \
468 /* Similar, but for libcall. We only have to worry about the function name,
469 not that of the descriptor. */
471 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
473 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
474 { fprintf (FILE, "\t.extern .."); \
475 assemble_name (FILE, XSTR (FUN, 0)); \
476 fprintf (FILE, "\n"); \
480 /* Eliminate AIX style constant pool processing */
481 #undef LEGITIMATE_CONSTANT_POOL_BASE_P
482 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) 0
484 #undef LEGITIMATE_CONSTANT_POOL_ADDRESS_P
485 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) 0
487 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
489 #undef ASM_IDENTIFY_GCC
490 #define ASM_IDENTIFY_GCC(x)
492 #undef HAS_INIT_SECTION
493 #define HAS_INIT_SECTION
This page took 0.063339 seconds and 6 git commands to generate.