OSDN Git Service

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