]>
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 #undef TARGET_VERSION
104 #define TARGET_VERSION fprintf (stderr, " (PowerPC PE)");
106 #undef TARGET_DEFAULT
107 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_NO_FP_IN_TOC | MASK_NO_SUM_IN_TOC)
109 #undef PROCESSOR_DEFAULT
110 #define PROCESSOR_DEFAULT PROCESSOR_PPC601
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)
116 /* Windows NT specifies that r13 is reserved to the OS, so it is not available
117 to the normal user. */
123 /* Output .file and comments listing what options there are */
124 #undef ASM_FILE_START
125 #define ASM_FILE_START(FILE) \
127 ASM_OUTPUT_OPTIONS (FILE); \
128 output_file_directive (FILE, main_input_filename); \
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. */
137 #undef SELECT_SECTION
139 #undef READONLY_DATA_SECTION
140 #undef EXTRA_SECTIONS
141 #define EXTRA_SECTIONS toc
143 /* Define the routines to implement these extra sections. */
145 #undef EXTRA_SECTION_FUNCTIONS
146 #define EXTRA_SECTION_FUNCTIONS \
154 #undef SELECT_RTX_SECTION
155 #undef ASM_DECLARE_FUNCTION_NAME
158 /* This says how to output an assembler line
159 to define a global common symbol. */
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)); \
166 fprintf ((FILE), ",%d,%d\n", (SIZE), 3); \
168 fprintf( (FILE), ",%d\n", (SIZE)); \
171 #undef ASM_OUTPUT_ALIGNED_LOCAL
173 /* This says how to output an assembler line
174 to define a global common symbol. */
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)
182 /* This says how to output an assembler line
183 to define an aligned local common symbol. */
185 #undef ASM_OUTPUT_ALIGNED_LOCAL
186 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
189 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
190 ASM_OUTPUT_LABEL (FILE, NAME); \
191 ASM_OUTPUT_SKIP (FILE, SIZE); \
194 /* Describe how to emit unitialized external linkage items */
195 #define ASM_OUTPUT_ALIGNED_BSS(FILE, NAME, SIZE, ALIGN) \
197 ASM_GLOBALIZE_LABEL (FILE, NAME); \
198 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
201 /* This says out to put a global symbol in the BSS section */
202 #undef ASM_OUTPUT_ALIGNED_BSS
203 #define ASM_OUTPUT_ALIGNED_BSS(FILE, NAME, SIZE, ALIGN) \
204 asm_output_aligned_bss ((FILE), (NAME), (SIZE), (ALIGN))
207 /* Stuff to force fit us into the Motorola PPC assembler */
210 #undef ASM_FILE_START
211 #define ASM_FILE_START(FILE) \
213 output_file_directive (FILE, main_input_filename); \
214 fprintf (FILE, "\n#\tDirective section\n"); \
215 fprintf (FILE, "\t.section\t.drectve,\"iR\"\n"); \
216 fprintf (FILE, "\t.byte\t\"-defaultlib:LIBC\" \n"); \
217 fprintf (FILE, "\t.previous\n\n"); \
221 #undef ASM_FILE_START
222 #define ASM_FILE_START(FILE) \
224 ASM_OUTPUT_OPTIONS (FILE); \
225 output_file_directive (FILE, main_input_filename); \
231 #undef ASM_OUTPUT_FUNCTION_PREFIX
232 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
234 fprintf (FILE, "\n#\tFunction: '.."); \
235 assemble_name (FILE, NAME); \
236 fprintf (FILE, "'\n"); \
237 fprintf (FILE, "#\tText in section: <%s>\n\n","default"); \
238 fprintf (FILE, "#\tSetup MS Structured-Exception-Handling\n"); \
239 fprintf (FILE, "\t.pdata\n"); \
240 fprintf (FILE, "\t.align 2\n"); \
241 fprintf (FILE, "\t.ualong .."); \
242 assemble_name (FILE, NAME); \
243 fprintf (FILE, ","); \
244 assemble_name (FILE, NAME); \
245 fprintf (FILE, ".e,0,0,"); \
246 assemble_name (FILE, NAME); \
247 fprintf (FILE, ".b\n\n"); \
248 fprintf (FILE, "#\tSwitch to the relocation section\n"); \
249 fprintf (FILE, "\t.reldata\n"); \
253 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
255 if (TREE_PUBLIC (DECL)) \
257 fprintf (FILE, "\t.globl .."); \
258 assemble_name (FILE, NAME); \
259 fprintf (FILE, "\n"); \
261 assemble_name (FILE, NAME); \
262 fprintf (FILE, ":\n"); \
263 fprintf (FILE, "\t.ualong .."); \
264 assemble_name (FILE, NAME); \
265 fprintf (FILE, ",.toc\n"); \
267 if (lookup_attribute ("dllexport", \
268 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
270 fprintf (FILE, "\t.globl __imp_"); \
271 assemble_name (FILE, NAME); \
272 fprintf (FILE, "\n__imp_"); \
273 assemble_name (FILE, NAME); \
274 fprintf (FILE, ":\n\t.ulong "); \
275 assemble_name (FILE, NAME); \
276 fprintf (FILE, "\n"); \
279 fprintf (FILE, "\t.section .text\n\t.align 2\n.."); \
280 assemble_name (FILE, NAME); \
281 fprintf (FILE, ":\n"); \
282 fprintf (FILE, "\t.function\t.."); \
283 assemble_name (FILE, NAME); \
284 fprintf (FILE, "\n"); \
287 /* This is how to output an assembler line defining a `double' constant. */
289 #undef ASM_OUTPUT_DOUBLE
290 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
292 if (REAL_VALUE_ISINF (VALUE) \
293 || REAL_VALUE_ISNAN (VALUE) \
294 || REAL_VALUE_MINUS_ZERO (VALUE)) \
297 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
298 fprintf (FILE, "\t.ualong 0x%lx\n\t.long 0x%lx\n", \
299 t[0] & 0xffffffff, t[1] & 0xffffffff); \
304 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
305 fprintf (FILE, "\t.double %s\n", str); \
309 /* This is how to output an assembler line defining a `float' constant. */
311 #undef ASM_OUTPUT_FLOAT
312 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
314 if (REAL_VALUE_ISINF (VALUE) \
315 || REAL_VALUE_ISNAN (VALUE) \
316 || REAL_VALUE_MINUS_ZERO (VALUE)) \
319 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
320 fprintf (FILE, "\t.ualong 0x%lx\n", t & 0xffffffff); \
325 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
326 fprintf (FILE, "\t.float %s\n", str); \
330 /* Output before instructions. */
331 #undef TEXT_SECTION_ASM_OP
332 #define TEXT_SECTION_ASM_OP "\t.text"
334 /* Output before writable data. */
335 #undef DATA_SECTION_ASM_OP
336 #define DATA_SECTION_ASM_OP "\t.data"
338 /* Output to the bss section. */
339 #undef BSS_SECTION_ASM_OP
340 #define BSS_SECTION_ASM_OP "\t.section .bss"
342 /* Text to write out after a CALL that may be replaced by glue code by
343 the loader. The motorola asm demands that, for dll support, a .znop
344 be issued after a bl instruction, and the symbol on the .znop is the
345 symbol on the bl instruction */
347 #undef RS6000_CALL_GLUE
348 #define RS6000_CALL_GLUE "nop #\tFIXME: only works for non-dll calls."
350 #define RS6000_CALL_GLUE2 ".znop "
352 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
354 /* Output something to declare an external symbol to the assembler. Most
355 assemblers don't need this. */
357 #undef ASM_OUTPUT_EXTERNAL
359 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
362 rtx _symref = XEXP (DECL_RTL (DECL), 0); \
363 if ((TREE_CODE (DECL) == VAR_DECL \
364 || TREE_CODE (DECL) == FUNCTION_DECL) \
365 && (NAME)[strlen (NAME) - 1] != ']') \
367 _name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
368 strcpy (_name, XSTR (_symref, 0)); \
369 XSTR (_symref, 0) = _name; \
372 _name = XSTR (_symref, 0); \
374 if (DECL_FUNCTION_CODE (DECL) == 0) \
376 fputs ("\t.extern ", FILE); \
377 assemble_name (FILE, _name); \
379 if (TREE_CODE (DECL) == FUNCTION_DECL) \
381 fputs ("\t.extern ..", FILE); \
382 assemble_name (FILE, _name); \
388 /* Similar, but for libcall. We only have to worry about the function name,
389 not that of the descriptor. */
391 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
393 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
394 { fprintf (FILE, "\t.extern .."); \
395 assemble_name (FILE, XSTR (FUN, 0)); \
396 fprintf (FILE, "\n"); \
400 /* Eliminate AIX style constant pool processing */
401 #undef LEGITIMATE_CONSTANT_POOL_BASE_P
402 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) 0
404 #undef LEGITIMATE_CONSTANT_POOL_ADDRESS_P
405 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) 0
407 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
409 #undef ASM_IDENTIFY_GCC
410 #define ASM_IDENTIFY_GCC(x)
412 #undef HAS_INIT_SECTION
413 #define HAS_INIT_SECTION
This page took 0.055408 seconds and 6 git commands to generate.