]> gcc.gnu.org Git - gcc.git/blob - gcc/config/rs6000/win-nt.h
Define ASM_OUTPUT_ALIGNED_BSS
[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 #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
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 an aligned local common symbol. */
184
185 #undef ASM_OUTPUT_ALIGNED_LOCAL
186 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
187 do { \
188 bss_section (); \
189 ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \
190 ASM_OUTPUT_LABEL (FILE, NAME); \
191 ASM_OUTPUT_SKIP (FILE, SIZE); \
192 } while (0)
193
194 /* Describe how to emit unitialized external linkage items */
195 #define ASM_OUTPUT_ALIGNED_BSS(FILE, NAME, SIZE, ALIGN) \
196 do { \
197 ASM_GLOBALIZE_LABEL (FILE, NAME); \
198 ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \
199 } while (0)
200
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))
205
206
207 /* Stuff to force fit us into the Motorola PPC assembler */
208
209 #if 0
210 #undef ASM_FILE_START
211 #define ASM_FILE_START(FILE) \
212 { \
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"); \
218 }
219 #endif
220
221 #undef ASM_FILE_START
222 #define ASM_FILE_START(FILE) \
223 { \
224 ASM_OUTPUT_OPTIONS (FILE); \
225 output_file_directive (FILE, main_input_filename); \
226 data_section (); \
227 }
228
229 #undef ASM_FILE_END
230
231 #undef ASM_OUTPUT_FUNCTION_PREFIX
232 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
233 { \
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"); \
250 }
251
252
253 #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
254 { \
255 if (TREE_PUBLIC (DECL)) \
256 { \
257 fprintf (FILE, "\t.globl .."); \
258 assemble_name (FILE, NAME); \
259 fprintf (FILE, "\n"); \
260 } \
261 assemble_name (FILE, NAME); \
262 fprintf (FILE, ":\n"); \
263 fprintf (FILE, "\t.ualong .."); \
264 assemble_name (FILE, NAME); \
265 fprintf (FILE, ",.toc\n"); \
266 \
267 if (lookup_attribute ("dllexport", \
268 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
269 { \
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"); \
277 } \
278 \
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"); \
285 }
286
287 /* This is how to output an assembler line defining a `double' constant. */
288
289 #undef ASM_OUTPUT_DOUBLE
290 #define ASM_OUTPUT_DOUBLE(FILE, VALUE) \
291 { \
292 if (REAL_VALUE_ISINF (VALUE) \
293 || REAL_VALUE_ISNAN (VALUE) \
294 || REAL_VALUE_MINUS_ZERO (VALUE)) \
295 { \
296 long t[2]; \
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); \
300 } \
301 else \
302 { \
303 char str[30]; \
304 REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \
305 fprintf (FILE, "\t.double %s\n", str); \
306 } \
307 }
308
309 /* This is how to output an assembler line defining a `float' constant. */
310
311 #undef ASM_OUTPUT_FLOAT
312 #define ASM_OUTPUT_FLOAT(FILE, VALUE) \
313 { \
314 if (REAL_VALUE_ISINF (VALUE) \
315 || REAL_VALUE_ISNAN (VALUE) \
316 || REAL_VALUE_MINUS_ZERO (VALUE)) \
317 { \
318 long t; \
319 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \
320 fprintf (FILE, "\t.ualong 0x%lx\n", t & 0xffffffff); \
321 } \
322 else \
323 { \
324 char str[30]; \
325 REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \
326 fprintf (FILE, "\t.float %s\n", str); \
327 } \
328 }
329
330 /* Output before instructions. */
331 #undef TEXT_SECTION_ASM_OP
332 #define TEXT_SECTION_ASM_OP "\t.text"
333
334 /* Output before writable data. */
335 #undef DATA_SECTION_ASM_OP
336 #define DATA_SECTION_ASM_OP "\t.data"
337
338 /* Output to the bss section. */
339 #undef BSS_SECTION_ASM_OP
340 #define BSS_SECTION_ASM_OP "\t.section .bss"
341
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 */
346
347 #undef RS6000_CALL_GLUE
348 #define RS6000_CALL_GLUE "nop #\tFIXME: only works for non-dll calls."
349
350 #define RS6000_CALL_GLUE2 ".znop "
351
352 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
353
354 /* Output something to declare an external symbol to the assembler. Most
355 assemblers don't need this. */
356
357 #undef ASM_OUTPUT_EXTERNAL
358
359 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
360 { \
361 char *_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] != ']') \
366 { \
367 _name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
368 strcpy (_name, XSTR (_symref, 0)); \
369 XSTR (_symref, 0) = _name; \
370 } \
371 else \
372 _name = XSTR (_symref, 0); \
373 \
374 if (DECL_FUNCTION_CODE (DECL) == 0) \
375 { \
376 fputs ("\t.extern ", FILE); \
377 assemble_name (FILE, _name); \
378 putc ('\n', FILE); \
379 if (TREE_CODE (DECL) == FUNCTION_DECL) \
380 { \
381 fputs ("\t.extern ..", FILE); \
382 assemble_name (FILE, _name); \
383 putc ('\n', FILE); \
384 } \
385 } \
386 }
387
388 /* Similar, but for libcall. We only have to worry about the function name,
389 not that of the descriptor. */
390
391 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
392
393 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
394 { fprintf (FILE, "\t.extern .."); \
395 assemble_name (FILE, XSTR (FUN, 0)); \
396 fprintf (FILE, "\n"); \
397 }
398
399
400 /* Eliminate AIX style constant pool processing */
401 #undef LEGITIMATE_CONSTANT_POOL_BASE_P
402 #define LEGITIMATE_CONSTANT_POOL_BASE_P(X) 0
403
404 #undef LEGITIMATE_CONSTANT_POOL_ADDRESS_P
405 #define LEGITIMATE_CONSTANT_POOL_ADDRESS_P(X) 0
406
407 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY
408
409 #undef ASM_IDENTIFY_GCC
410 #define ASM_IDENTIFY_GCC(x)
411
412 #undef HAS_INIT_SECTION
413 #define HAS_INIT_SECTION
This page took 0.055408 seconds and 6 git commands to generate.