]> gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/win-nt.h
Do not use -V as if it were -v
[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 -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 #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 \
253 if (lookup_attribute ("dllexport", \
254 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
255 { \
256 fprintf (FILE, "\t.globl __imp_"); \
257 assemble_name (FILE, NAME); \
258 fprintf (FILE, "\n__imp_"); \
259 assemble_name (FILE, NAME); \
260 fprintf (FILE, ":\n\t.ulong "); \
261 assemble_name (FILE, NAME); \
262 fprintf (FILE, "\n"); \
263 } \
264 \
265 fprintf (FILE, "\t.section .text\n\t.align 2\n.."); \
266 assemble_name (FILE, NAME); \
267 fprintf (FILE, ":\n"); \
268 fprintf (FILE, "\t.function\t.."); \
269 assemble_name (FILE, NAME); \
270 fprintf (FILE, "\n"); \
271 }
272
273 /* This is how to output an assembler line defining a `double' constant. */
274
275 #undef ASM_OUTPUT_DOUBLE
276 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
277 { \
278 if (REAL_VALUE_ISINF (VALUE) \
279 || REAL_VALUE_ISNAN (VALUE) \
280 || REAL_VALUE_MINUS_ZERO (VALUE)) \
281 { \
282 long t[2]; \
283 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \
284 fprintf (FILE, "\t.ualong 0x%lx\n\t.long 0x%lx\n", \
285 t[0] & 0xffffffff, t[1] & 0xffffffff); \
286 } \
287 else \
288 { \
289 char str[30]; \
290 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
291 fprintf (FILE, "\t.double %s\n", str); \
292 } \
293 }
294
295 /* This is how to output an assembler line defining a `float' constant. */
296
297 #undef ASM_OUTPUT_FLOAT
298 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
299 { \
300 if (REAL_VALUE_ISINF (VALUE) \
301 || REAL_VALUE_ISNAN (VALUE) \
302 || REAL_VALUE_MINUS_ZERO (VALUE)) \
303 { \
304 long t; \
305 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
306 fprintf (FILE, "\t.ualong 0x%lx\n", t & 0xffffffff); \
307 } \
308 else \
309 { \
310 char str[30]; \
311 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
312 fprintf (FILE, "\t.float %s\n", str); \
313 } \
314 }
315
316 /* Output before instructions. */
317 #undef TEXT_SECTION_ASM_OP
318 #define TEXT_SECTION_ASM_OP "\t.text"
319
320 /* Output before writable data. */
321 #undef DATA_SECTION_ASM_OP
322 #define DATA_SECTION_ASM_OP "\t.data"
323
324 /* Text to write out after a CALL that may be replaced by glue code by
325 the loader. The motorola asm demands that, for dll support, a .znop
326 be issued after a bl instruction, and the symbol on the .znop is the
327 symbol on the bl instruction */
328
329 #undef RS6000_CALL_GLUE
330 #define RS6000_CALL_GLUE "nop #\tFIXME: only works for non-dll calls."
331
332 #define RS6000_CALL_GLUE2 ".znop "
333
334 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
335
336 /* Output something to declare an external symbol to the assembler. Most
337 assemblers don't need this. */
338
339 #undef ASM_OUTPUT_EXTERNAL
340
341 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
342 { \
343 char *_name; \
344 rtx _symref = XEXP (DECL_RTL (DECL), 0); \
345 if ((TREE_CODE (DECL) == VAR_DECL \
346 || TREE_CODE (DECL) == FUNCTION_DECL) \
347 && (NAME)[0] != '*' \
348 && (NAME)[strlen (NAME) - 1] != ']') \
349 { \
350 _name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
351 strcpy (_name, XSTR (_symref, 0)); \
352 XSTR (_symref, 0) = _name; \
353 } \
354 else \
355 _name = XSTR (_symref, 0); \
356 \
357 if (DECL_FUNCTION_CODE (DECL) == 0) \
358 { \
359 fputs ("\t.extern ", FILE); \
360 assemble_name (FILE, _name); \
361 putc ('\n', FILE); \
362 if (TREE_CODE (DECL) == FUNCTION_DECL) \
363 { \
364 fputs ("\t.extern ..", FILE); \
365 assemble_name (FILE, _name); \
366 putc ('\n', FILE); \
367 } \
368 } \
369 }
370
371 /* Similar, but for libcall. We only have to worry about the function name,
372 not that of the descriptor. */
373
374 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
375
376 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
377 { fprintf (FILE, "\t.extern .."); \
378 assemble_name (FILE, XSTR (FUN, 0)); \
379 fprintf (FILE, "\n"); \
380 }
381
382
383 /* Eliminate AIX style constant pool processing */
384 #undef LEGITIMATE_CONSTANT_POOL_BASE_P
385 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) 0
386
387 #undef LEGITIMATE_CONSTANT_POOL_ADDRESS_P
388 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) 0
389
390 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
391
392 #undef ASM_IDENTIFY_GCC
393 #define ASM_IDENTIFY_GCC(x)
394
395 #undef HAS_INIT_SECTION
396 #define HAS_INIT_SECTION
This page took 0.057299 seconds and 6 git commands to generate.