OSDN Git Service

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