]> gcc.gnu.org Git - gcc.git/blame - gcc/config/i386/cygwin.h
glimits.h (USHRT_MAX): Use unsigned suffix if int can not hold it.
[gcc.git] / gcc / config / i386 / cygwin.h
CommitLineData
3a2c1cd8 1/* Operating system specific defines to be used when targeting GCC for
db009825 2 hosting on Windows32, using a Unix style C library and tools.
000b5f54 3 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
4592bdcb 4 Free Software Foundation, Inc.
3a2c1cd8
MM
5
6This file is part of GNU CC.
7
8GNU CC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2, or (at your option)
11any later version.
12
13GNU CC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU CC; see the file COPYING. If not, write to
20the Free Software Foundation, 59 Temple Place - Suite 330,
21Boston, MA 02111-1307, USA. */
22
3a2c1cd8
MM
23#define YES_UNDERSCORES
24
73061e0f
JW
25#define DBX_DEBUGGING_INFO
26#define SDB_DEBUGGING_INFO
27#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
3a2c1cd8 28
45936a85
DD
29#define TARGET_EXECUTABLE_SUFFIX ".exe"
30
79f96374 31#include <stdio.h>
73061e0f
JW
32#include "i386/gas.h"
33#include "dbxcoff.h"
3a2c1cd8 34
040688bd
GN
35/* Augment TARGET_SWITCHES with the cygwin/no-cygwin options. */
36#define MASK_WIN32 0x40000000 /* Use -lming32 interface */
37#define MASK_CYGWIN 0x20000000 /* Use -lcygwin interface */
38#define MASK_WINDOWS 0x10000000 /* Use windows interface */
39#define MASK_DLL 0x08000000 /* Use dll interface */
40#define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */
41
42#define TARGET_WIN32 (target_flags & MASK_WIN32)
43#define TARGET_CYGWIN (target_flags & MASK_CYGWIN)
44#define TARGET_WINDOWS (target_flags & MASK_WINDOWS)
45#define TARGET_DLL (target_flags & MASK_DLL)
46#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT)
47
48#undef SUBTARGET_SWITCHES
49#define SUBTARGET_SWITCHES \
047142d3
PT
50{ "cygwin", MASK_CYGWIN, \
51 N_("Use the Cygwin interface") }, \
52{ "no-cygwin", MASK_WIN32, \
53 N_("Use the Mingw32 interface") }, \
54{ "windows", MASK_WINDOWS, N_("Create GUI application") }, \
03fb4780 55{ "no-win32", -MASK_WIN32, N_("Don't set Windows defines") },\
f6fc3552 56{ "win32", 0, N_("Set Windows defines") }, \
047142d3
PT
57{ "console", -MASK_WINDOWS, \
58 N_("Create console application") }, \
59{ "dll", MASK_DLL, N_("Generate code for a DLL") }, \
60{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, \
61 N_("Ignore dllimport for functions") }, \
f22a97d2 62{ "no-nop-fun-dllimport", -MASK_NOP_FUN_DLLIMPORT, "" }, \
047142d3 63{ "threads", 0, N_("Use Mingw-specific thread support") },
040688bd 64
3a2c1cd8 65#undef CPP_PREDEFINES
03fb4780 66#define CPP_PREDEFINES "-D_X86_=1 -Asystem=winnt"
3a2c1cd8 67
f6fc3552 68#ifdef CROSS_COMPILE
45677496 69#define CYGWIN_INCLUDES "-idirafter " CYGWIN_CROSS_DIR "/include"
9a33d505
CF
70#define W32API_INC "-idirafter " CYGWIN_CROSS_DIR "/include/w32api"
71#define W32API_LIB "-L" CYGWIN_CROSS_DIR "/lib/w32api/"
4e190cf3
CF
72#define CYGWIN_LIB CYGWIN_CROSS_DIR "/lib"
73#define MINGW_LIBS "-L" CYGWIN_CROSS_DIR "/lib/mingw"
936ee790
CF
74#define MINGW_INCLUDES "-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++-3 "\
75 "-isystem " CYGWIN_CROSS_DIR "/include/mingw/g++ "\
76 "-idirafter " CYGWIN_CROSS_DIR "/include/mingw"
f6fc3552 77#else
4e190cf3 78#define CYGWIN_INCLUDES "-isystem /usr/local/include -idirafter /usr/include"
9a33d505
CF
79#define W32API_INC "-idirafter /usr/include/w32api"
80#define W32API_LIB "-L/usr/lib/w32api/"
4e190cf3
CF
81#define CYGWIN_LIB "/usr/lib"
82#define MINGW_LIBS "-L/usr/local/lib/mingw -L/usr/lib/mingw"
936ee790
CF
83#define MINGW_INCLUDES "-isystem /usr/include/mingw/g++-3 "\
84 "-isystem /usr/include/mingw/g++ "\
85 "-isystem /usr/local/include/mingw" \
86 "-idirafter /usr/include/mingw"
4e190cf3
CF
87#endif
88
9a33d505
CF
89/* Support the __declspec keyword by turning them into attributes.
90 We currently only support: dllimport and dllexport.
91 Note that the current way we do this may result in a collision with
92 predefined attributes later on. This can be solved by using one attribute,
93 say __declspec__, and passing args to it. The problem with that approach
94 is that args are not accumulated: each new appearance would clobber any
95 existing args. */
4e190cf3
CF
96
97#undef CPP_SPEC
f6fc3552
CF
98#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
99 -D__stdcall=__attribute__((__stdcall__)) \
100 -D__cdecl=__attribute__((__cdecl__)) \
101 %{!ansi:-D_stdcall=__attribute__((__stdcall__)) \
102 -D_cdecl=__attribute__((__cdecl__))} \
103 -D__declspec(x)=__attribute__((x)) \
104 -D__i386__ -D__i386 \
9a33d505
CF
105 %{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \
106 %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{mthreads:-D_MT} "\
107 MINGW_INCLUDES "} \
108 %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix "\
109 CYGWIN_INCLUDES "}\
9e24b950 110 %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT}\
9a33d505
CF
111 %{!mno-win32:" W32API_INC "}\
112"
113
114#undef STARTFILE_SPEC
2baa5453 115#define STARTFILE_SPEC "\
9a33d505
CF
116 %{shared|mdll: %{mno-cygwin:" MINGW_LIBS " mingw/dllcrt2%O%s}}\
117 %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:" MINGW_LIBS " mingw/crt2%O%s}\
118 %{pg:gcrt0%O%s}}}\
936ee790 119"
ffb6cec0 120
9a33d505
CF
121/* Normally, -lgcc is not needed since everything in it is in the DLL, but we
122 want to allow things to be added to it when installing new versions of
123 GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
124 by calling the init function from the prologue. */
125
126#undef LIBGCC_SPEC
127#define LIBGCC_SPEC "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc %{mno-cygwin:-lmoldname -lmsvcrt}"
128
ffb6cec0
SC
129/* This macro defines names of additional specifications to put in the specs
130 that can be used in various specifications like CC1_SPEC. Its definition
131 is an initializer with a subgrouping for each command option.
132
133 Each subgrouping contains a string constant, that defines the
134 specification name, and a string constant that used by the GNU CC driver
135 program.
136
137 Do not define this macro if it does not need to do anything. */
138
139#undef SUBTARGET_EXTRA_SPECS
140#define SUBTARGET_EXTRA_SPECS \
141 { "mingw_include_path", DEFAULT_TARGET_MACHINE }
956d6950 142
f5089633
RK
143/* We have to dynamic link to get to the system DLLs. All of libc, libm and
144 the Unix stuff is in cygwin.dll. The import library is called
145 'libcygwin.a'. For Windows applications, include more libraries, but
146 always include kernel32. We'd like to specific subsystem windows to
147 ld, but that doesn't work just yet. */
3a2c1cd8
MM
148
149#undef LIB_SPEC
2baa5453
CF
150#define LIB_SPEC "\
151 %{pg:-lgmon} \
03fb4780
CF
152 %{!mno-cygwin:-lcygwin} \
153 %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
154 %{mwindows:-lgdi32 -lcomdlg32} \
155 -luser32 -lkernel32 -ladvapi32 -lshell32"
3a2c1cd8 156
2baa5453
CF
157#define LINK_SPEC W32API_LIB "\
158 %{mwindows:--subsystem windows} \
03fb4780
CF
159 %{mconsole:--subsystem console} \
160 %{shared: %{mdll: %eshared and mdll are not compatible}} \
161 %{shared: --shared} %{mdll:--dll} \
162 %{static:-Bstatic} %{!static:-Bdynamic} \
163 %{shared|mdll: -e \
164 %{mno-cygwin:_DllMainCRTStartup@12} \
9a33d505
CF
165 %{!mno-cygwin:__cygwin_dll_entry@12}}\
166 --dll-search-prefix=cyg"
26d1d6ad 167
03fb4780
CF
168#undef MATH_LIBRARY
169#define MATH_LIBRARY ""
3a2c1cd8
MM
170
171#define SIZE_TYPE "unsigned int"
172#define PTRDIFF_TYPE "int"
173#define WCHAR_UNSIGNED 1
174#define WCHAR_TYPE_SIZE 16
175#define WCHAR_TYPE "short unsigned int"
040688bd 176
27da1b4d 177\f
c678a7f8
NC
178/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
179#define HANDLE_PRAGMA_PACK_PUSH_POP 1
180
27da1b4d
MK
181/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
182 is a valid machine specific attribute for DECL.
183 The attributes in ATTRIBUTES have previously been assigned to DECL. */
03fb4780
CF
184
185union tree_node;
186#define TREE union tree_node *
27da1b4d
MK
187
188#undef VALID_MACHINE_DECL_ATTRIBUTE
189#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
190 i386_pe_valid_decl_attribute_p (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
03fb4780 191extern int i386_pe_valid_decl_attribute_p PARAMS ((TREE, TREE, TREE, TREE));
27da1b4d 192
ac478ac0
JM
193/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
194 is a valid machine specific attribute for TYPE.
195 The attributes in ATTRIBUTES have previously been assigned to TYPE. */
196
197#undef VALID_MACHINE_TYPE_ATTRIBUTE
198#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \
199 i386_pe_valid_type_attribute_p (TYPE, ATTRIBUTES, IDENTIFIER, ARGS)
03fb4780 200extern int i386_pe_valid_type_attribute_p PARAMS ((TREE, TREE, TREE, TREE));
ac478ac0 201
03fb4780 202extern union tree_node *i386_pe_merge_decl_attributes PARAMS ((TREE, TREE));
27da1b4d
MK
203#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \
204 i386_pe_merge_decl_attributes ((OLD), (NEW))
03fb4780 205extern TREE i386_pe_merge_decl_attributes PARAMS ((TREE, TREE));
27da1b4d
MK
206
207/* Used to implement dllexport overriding dllimport semantics. It's also used
208 to handle vtables - the first pass won't do anything because
209 DECL_CONTEXT (DECL) will be 0 so i386_pe_dll{ex,im}port_p will return 0.
210 It's also used to handle dllimport override semantics. */
211#if 0
212#define REDO_SECTION_INFO_P(DECL) \
213 ((DECL_MACHINE_ATTRIBUTES (DECL) != NULL_TREE) \
214 || (TREE_CODE (DECL) == VAR_DECL && DECL_VIRTUAL_P (DECL)))
215#else
216#define REDO_SECTION_INFO_P(DECL) 1
217#endif
218
219\f
3a2c1cd8 220#undef EXTRA_SECTIONS
27da1b4d 221#define EXTRA_SECTIONS in_ctor, in_dtor, in_drectve
3a2c1cd8
MM
222
223#undef EXTRA_SECTION_FUNCTIONS
224#define EXTRA_SECTION_FUNCTIONS \
225 CTOR_SECTION_FUNCTION \
27da1b4d
MK
226 DTOR_SECTION_FUNCTION \
227 DRECTVE_SECTION_FUNCTION \
228 SWITCH_TO_SECTION_FUNCTION
3a2c1cd8
MM
229
230#define CTOR_SECTION_FUNCTION \
231void \
232ctor_section () \
233{ \
234 if (in_section != in_ctor) \
235 { \
236 fprintf (asm_out_file, "\t.section .ctor\n"); \
237 in_section = in_ctor; \
238 } \
239}
79f96374 240void ctor_section PARAMS ((void));
3a2c1cd8
MM
241
242#define DTOR_SECTION_FUNCTION \
243void \
244dtor_section () \
245{ \
246 if (in_section != in_dtor) \
247 { \
248 fprintf (asm_out_file, "\t.section .dtor\n"); \
249 in_section = in_dtor; \
250 } \
251}
79f96374 252void dtor_section PARAMS ((void));
3a2c1cd8 253
27da1b4d
MK
254#define DRECTVE_SECTION_FUNCTION \
255void \
256drectve_section () \
257{ \
258 if (in_section != in_drectve) \
259 { \
260 fprintf (asm_out_file, "%s\n", "\t.section .drectve\n"); \
261 in_section = in_drectve; \
262 } \
263}
79f96374 264void drectve_section PARAMS ((void));
27da1b4d
MK
265
266/* Switch to SECTION (an `enum in_section').
267
268 ??? This facility should be provided by GCC proper.
269 The problem is that we want to temporarily switch sections in
270 ASM_DECLARE_OBJECT_NAME and then switch back to the original section
271 afterwards. */
272#define SWITCH_TO_SECTION_FUNCTION \
79f96374 273void switch_to_section PARAMS ((enum in_section, tree)); \
27da1b4d
MK
274void \
275switch_to_section (section, decl) \
276 enum in_section section; \
277 tree decl; \
278{ \
279 switch (section) \
280 { \
281 case in_text: text_section (); break; \
282 case in_data: data_section (); break; \
283 case in_named: named_section (decl, NULL, 0); break; \
284 case in_ctor: ctor_section (); break; \
285 case in_dtor: dtor_section (); break; \
286 case in_drectve: drectve_section (); break; \
287 default: abort (); break; \
288 } \
289}
290
3a2c1cd8
MM
291#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
292 do { \
293 ctor_section (); \
79b79064 294 fputs (ASM_LONG, FILE); \
3a2c1cd8
MM
295 assemble_name (FILE, NAME); \
296 fprintf (FILE, "\n"); \
297 } while (0)
298
299#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
300 do { \
301 dtor_section (); \
79b79064 302 fputs (ASM_LONG, FILE); \
27da1b4d 303 assemble_name (FILE, NAME); \
3a2c1cd8
MM
304 fprintf (FILE, "\n"); \
305 } while (0)
306
2b9f972f
MK
307/* Don't allow flag_pic to propagate since gas may produce invalid code
308 otherwise. */
309
310#undef SUBTARGET_OVERRIDE_OPTIONS
311#define SUBTARGET_OVERRIDE_OPTIONS \
312do { \
313 if (flag_pic) \
314 { \
315 warning ("-f%s ignored for target (all code is position independent)",\
316 (flag_pic > 1) ? "PIC" : "pic"); \
317 flag_pic = 0; \
318 } \
319} while (0) \
320
3a2c1cd8
MM
321/* Define this macro if references to a symbol must be treated
322 differently depending on something about the variable or
323 function named by the symbol (such as what section it is in).
324
3a2c1cd8
MM
325 On i386 running Windows NT, modify the assembler name with a suffix
326 consisting of an atsign (@) followed by string of digits that represents
327 the number of bytes of arguments passed to the function, if it has the
27da1b4d
MK
328 attribute STDCALL.
329
330 In addition, we must mark dll symbols specially. Definitions of
331 dllexport'd objects install some info in the .drectve section.
332 References to dllimport'd objects are fetched indirectly via
333 _imp__. If both are declared, dllexport overrides. This is also
334 needed to implement one-only vtables: they go into their own
335 section and we need to set DECL_SECTION_NAME so we do that here.
336 Note that we can be called twice on the same decl. */
337
03fb4780 338extern void i386_pe_encode_section_info PARAMS ((TREE));
3a2c1cd8
MM
339
340#ifdef ENCODE_SECTION_INFO
341#undef ENCODE_SECTION_INFO
3a2c1cd8 342#endif
27da1b4d 343#define ENCODE_SECTION_INFO(DECL) i386_pe_encode_section_info (DECL)
3a2c1cd8 344
27da1b4d
MK
345/* Utility used only in this file. */
346#define I386_PE_STRIP_ENCODING(SYM_NAME) \
347 ((SYM_NAME) + ((SYM_NAME)[0] == '@' ? 3 : 0))
e5e809f4 348
27da1b4d
MK
349/* This macro gets just the user-specified name
350 out of the string in a SYMBOL_REF. Discard
351 trailing @[NUM] encoded by ENCODE_SECTION_INFO. */
93006f8c
MK
352#undef STRIP_NAME_ENCODING
353#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
354do { \
ec940faa
KG
355 const char *_p; \
356 const char *_name = I386_PE_STRIP_ENCODING (SYMBOL_NAME); \
93006f8c
MK
357 for (_p = _name; *_p && *_p != '@'; ++_p) \
358 ; \
359 if (*_p == '@') \
360 { \
361 int _len = _p - _name; \
ec940faa
KG
362 char *_new_name = (char *) alloca (_len + 1); \
363 strncpy (_new_name, _name, _len); \
364 _new_name[_len] = '\0'; \
365 (VAR) = _new_name; \
93006f8c
MK
366 } \
367 else \
368 (VAR) = _name; \
369} while (0)
370
27da1b4d
MK
371\f
372/* Output a reference to a label. */
373#undef ASM_OUTPUT_LABELREF
374#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
375 fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, \
936ee790 376 I386_PE_STRIP_ENCODING (NAME)) \
27da1b4d 377
27da1b4d
MK
378/* Output a common block. */
379#undef ASM_OUTPUT_COMMON
380#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
381do { \
382 if (i386_pe_dllexport_name_p (NAME)) \
8e260ba4 383 i386_pe_record_exported_symbol (NAME, 1); \
27da1b4d
MK
384 if (! i386_pe_dllimport_name_p (NAME)) \
385 { \
386 fprintf ((STREAM), "\t.comm\t"); \
387 assemble_name ((STREAM), (NAME)); \
388 fprintf ((STREAM), ", %d\t%s %d\n", \
389 (ROUNDED), ASM_COMMENT_START, (SIZE)); \
390 } \
391} while (0)
392
393/* Output the label for an initialized variable. */
394#undef ASM_DECLARE_OBJECT_NAME
395#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
396do { \
397 if (i386_pe_dllexport_name_p (NAME)) \
8e260ba4 398 i386_pe_record_exported_symbol (NAME, 1); \
27da1b4d
MK
399 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
400} while (0)
401
402\f
1e9b6647 403/* Emit code to check the stack when allocating more that 4000
3a2c1cd8
MM
404 bytes in one go. */
405
1e9b6647 406#define CHECK_STACK_LIMIT 4000
3a2c1cd8
MM
407
408/* By default, target has a 80387, uses IEEE compatible arithmetic,
409 and returns float values in the 387 and needs stack probes */
25f94bb5 410#undef TARGET_SUBTARGET_DEFAULT
3a2c1cd8 411
25f94bb5 412#define TARGET_SUBTARGET_DEFAULT \
3a2c1cd8
MM
413 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE)
414
d5967781
MM
415/* This is how to output an assembler line
416 that says to advance the location counter
417 to a multiple of 2**LOG bytes. */
418
419#undef ASM_OUTPUT_ALIGN
420#define ASM_OUTPUT_ALIGN(FILE,LOG) \
421 if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
b64deb96 422
5b5686f5
JM
423/* Define this macro if in some cases global symbols from one translation
424 unit may not be bound to undefined symbols in another translation unit
425 without user intervention. For instance, under Microsoft Windows
426 symbols must be explicitly imported from shared libraries (DLLs). */
427#define MULTIPLE_SYMBOL_SPACES
428
ad4ff310 429#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
03fb4780 430extern void i386_pe_unique_section PARAMS ((TREE, int));
ad4ff310 431#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC)
b64deb96 432
ad4ff310 433#define SUPPORTS_ONE_ONLY 1
b64deb96
JM
434
435/* A C statement to output something to the assembler file to switch to section
436 NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
437 NULL_TREE. Some target formats do not support arbitrary sections. Do not
438 define this macro in such cases. */
439#undef ASM_OUTPUT_SECTION_NAME
a1612a6c
MK
440#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
441do { \
442 static struct section_info \
443 { \
444 struct section_info *next; \
445 char *name; \
446 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
447 } *sections; \
448 struct section_info *s; \
3cce094d 449 const char *mode; \
a1612a6c
MK
450 enum sect_enum type; \
451 \
452 for (s = sections; s; s = s->next) \
453 if (!strcmp (NAME, s->name)) \
454 break; \
455 \
456 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
457 type = SECT_EXEC, mode = "x"; \
458 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
459 type = SECT_RO, mode = ""; \
460 else \
593d3a34
MK
461 { \
462 type = SECT_RW; \
9a33d505 463 if (DECL && TREE_CODE (DECL) == VAR_DECL \
936ee790
CF
464 && lookup_attribute ("shared", DECL_MACHINE_ATTRIBUTES (DECL))) \
465 mode = "ws"; \
593d3a34 466 else \
936ee790 467 mode = "w"; \
593d3a34 468 } \
a1612a6c
MK
469 \
470 if (s == 0) \
471 { \
472 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
473 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
474 strcpy (s->name, NAME); \
475 s->type = type; \
476 s->next = sections; \
477 sections = s; \
478 fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
479 /* Functions may have been compiled at various levels of \
936ee790
CF
480 optimization so we can't use `same_size' here. Instead, \
481 have the linker pick one. */ \
a1612a6c 482 if ((DECL) && DECL_ONE_ONLY (DECL)) \
936ee790
CF
483 fprintf (STREAM, "\t.linkonce %s\n", \
484 TREE_CODE (DECL) == FUNCTION_DECL \
485 ? "discard" : "same_size"); \
a1612a6c
MK
486 } \
487 else \
488 { \
a1612a6c
MK
489 fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
490 } \
b64deb96 491} while (0)
8f3189a4 492
672a233f
ILT
493/* Write the extra assembler code needed to declare a function
494 properly. If we are generating SDB debugging information, this
495 will happen automatically, so we only need to handle other cases. */
c8d9f965 496#undef ASM_DECLARE_FUNCTION_NAME
672a233f
ILT
497#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
498 do \
499 { \
c8d9f965 500 if (i386_pe_dllexport_name_p (NAME)) \
8e260ba4 501 i386_pe_record_exported_symbol (NAME, 0); \
672a233f
ILT
502 if (write_symbols != SDB_DEBUG) \
503 i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \
504 ASM_OUTPUT_LABEL (FILE, NAME); \
505 } \
506 while (0)
507
508/* Add an external function to the list of functions to be declared at
509 the end of the file. */
510#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
511 do \
512 { \
513 if (TREE_CODE (DECL) == FUNCTION_DECL) \
514 i386_pe_record_external_function (NAME); \
515 } \
516 while (0)
517
518/* Declare the type properly for any external libcall. */
519#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
520 i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
521
0181177d
JL
522/* This says out to put a global symbol in the BSS section. */
523#undef ASM_OUTPUT_ALIGNED_BSS
524#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
525 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
526
672a233f 527/* Output function declarations at the end of the file. */
4cf12e7e 528#undef ASM_FILE_END
672a233f
ILT
529#define ASM_FILE_END(FILE) \
530 i386_pe_asm_file_end (FILE)
531
8f3189a4
JW
532#undef ASM_COMMENT_START
533#define ASM_COMMENT_START " #"
da932f04 534
05853640
MK
535/* Don't assume anything about the header files. */
536#define NO_IMPLICIT_EXTERN_C
672a233f 537
84530511
SC
538#define SUBTARGET_PROLOGUE \
539 if (profile_flag \
5b47282c 540 && MAIN_NAME_P (DECL_NAME (current_function_decl))) \
84530511 541 { \
e075ae69 542 emit_call_insn (gen_rtx (CALL, VOIDmode, \
936ee790 543 gen_rtx_MEM (FUNCTION_MODE, \
e075ae69
RH
544 gen_rtx_SYMBOL_REF (Pmode, "_monstartup")), \
545 const0_rtx)); \
84530511
SC
546 }
547
672a233f
ILT
548/* External function declarations. */
549
79f96374
DB
550extern void i386_pe_record_external_function PARAMS ((const char *));
551extern void i386_pe_declare_function_type PARAMS ((FILE *, const char *, int));
552extern void i386_pe_record_exported_symbol PARAMS ((const char *, int));
553extern void i386_pe_asm_file_end PARAMS ((FILE *));
554extern int i386_pe_dllexport_name_p PARAMS ((const char *));
555extern int i386_pe_dllimport_name_p PARAMS ((const char *));
a2cd38a9
MK
556
557/* For Win32 ABI compatibility */
558#undef DEFAULT_PCC_STRUCT_RETURN
559#define DEFAULT_PCC_STRUCT_RETURN 0
560
3fafc2f6
MK
561/* No data type wants to be aligned rounder than this. */
562#undef BIGGEST_ALIGNMENT
563#define BIGGEST_ALIGNMENT 128
564
565/* A bitfield declared as `int' forces `int' alignment for the struct. */
566#undef PCC_BITFIELDS_TYPE_MATTERS
03fb4780
CF
567#define PCC_BITFIELDS_TYPE_MATTERS 1
568#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
569
3fafc2f6 570
8c84eeed
MK
571/* Enable alias attribute support. */
572#ifndef SET_ASM_OP
71d48a01 573#define SET_ASM_OP "\t.set\t"
8c84eeed
MK
574#endif
575
abffe289
CF
576#undef MD_STARTFILE_PREFIX
577#define MD_STARTFILE_PREFIX "/usr/lib/"
578
03fb4780 579#undef STANDARD_STARTFILE_PREFIX
abffe289 580#define STANDARD_STARTFILE_PREFIX "/usr/lib/mingw/"
03fb4780 581
f6fc3552
CF
582#ifndef CROSS_COMPILE
583#undef LOCAL_INCLUDE_DIR
584#undef TOOL_INCLUDE_DIR
585#undef SYSTEM_INCLUDE_DIR
586#undef STANDARD_INCLUDE_DIR
587#define STANDARD_INCLUDE_DIR 0
588#endif
589
03fb4780
CF
590#undef TREE
591
592#ifndef BUFSIZ
593# undef FILE
594#endif
This page took 2.526691 seconds and 5 git commands to generate.