Initial revision
[official-gcc.git] / gcc / config / i386 / win-nt.h
blob60c0bb6a1f68ce2422dc64dfc9f860145d62a463
1 /* Operating system specific defines to be used when targeting GCC for
2 Windows NT 3.x on an i386.
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
4 Contributed by Douglas B. Rupp (drupp@cs.washington.edu).
6 This file is part of GNU CC.
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.
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.
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. */
23 #define YES_UNDERSCORES
25 #include "i386/gas.h"
27 #ifdef CPP_PREDEFINES
28 #undef CPP_PREDEFINES
29 #endif
30 #define CPP_PREDEFINES "-Dunix -Di386 -DWIN32 -D_WIN32 \
31 -DWINNT -D_M_IX86=300 -D_X86_=1 -D__STDC__=0 -DALMOST_STDC -D_MSC_VER=800 \
32 -D__stdcall=__attribute__((__stdcall__)) \
33 -D__cdecl=__attribute__((__cdecl__)) \
34 -D_cdecl=__attribute__((__cdecl__)) \
35 -Asystem(unix) -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
37 #define SIZE_TYPE "unsigned int"
38 #define PTRDIFF_TYPE "int"
39 #define WCHAR_UNSIGNED 1
40 #define WCHAR_TYPE_SIZE 16
41 #define WCHAR_TYPE "short unsigned int"
42 #undef LONG_DOUBLE_TYPE_SIZE
43 #define LONG_DOUBLE_TYPE_SIZE 64
44 #define HAVE_ATEXIT 1
46 #undef EXTRA_SECTIONS
47 #define EXTRA_SECTIONS in_ctor, in_dtor
49 #undef EXTRA_SECTION_FUNCTIONS
50 #define EXTRA_SECTION_FUNCTIONS \
51 CTOR_SECTION_FUNCTION \
52 DTOR_SECTION_FUNCTION
54 #define CTOR_SECTION_FUNCTION \
55 void \
56 ctor_section () \
57 { \
58 if (in_section != in_ctor) \
59 { \
60 fprintf (asm_out_file, "\t.section .ctor\n"); \
61 in_section = in_ctor; \
62 } \
65 #define DTOR_SECTION_FUNCTION \
66 void \
67 dtor_section () \
68 { \
69 if (in_section != in_dtor) \
70 { \
71 fprintf (asm_out_file, "\t.section .dtor\n"); \
72 in_section = in_dtor; \
73 } \
76 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
77 do { \
78 ctor_section (); \
79 fprintf (FILE, "%s\t", ASM_LONG); \
80 assemble_name (FILE, NAME); \
81 fprintf (FILE, "\n"); \
82 } while (0)
84 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
85 do { \
86 dtor_section (); \
87 fprintf (FILE, "%s\t", ASM_LONG); \
88 assemble_name (FILE, NAME); \
89 fprintf (FILE, "\n"); \
90 } while (0)
92 /* Define this macro if references to a symbol must be treated
93 differently depending on something about the variable or
94 function named by the symbol (such as what section it is in).
96 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
97 so that we may access it directly in the GOT.
99 On i386 running Windows NT, modify the assembler name with a suffix
100 consisting of an atsign (@) followed by string of digits that represents
101 the number of bytes of arguments passed to the function, if it has the
102 attribute STDCALL. */
104 #ifdef ENCODE_SECTION_INFO
105 #undef ENCODE_SECTION_INFO
106 #define ENCODE_SECTION_INFO(DECL) \
107 do \
109 if (flag_pic) \
111 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
112 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
113 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
114 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
115 || ! TREE_PUBLIC (DECL)); \
117 if (TREE_CODE (DECL) == FUNCTION_DECL) \
118 if (lookup_attribute ("stdcall", \
119 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
120 XEXP (DECL_RTL (DECL), 0) = \
121 gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \
123 while (0)
124 #endif
126 /* The global __fltused is necessary to cause the printf/scanf routines
127 for outputting/inputting floating point numbers to be loaded. Since this
128 is kind of hard to detect, we just do it all the time. */
130 #ifdef ASM_FILE_START
131 #undef ASM_FILE_START
132 #endif
133 #define ASM_FILE_START(FILE) \
134 do { fprintf (FILE, "\t.file\t"); \
135 output_quoted_string (FILE, dump_base_name); \
136 fprintf (FILE, "\n"); \
137 fprintf (FILE, ".global\t__fltused\n"); \
138 } while (0)
140 /* if the switch "-mwindows" is passed to ld, then specify to the Microsoft
141 linker the proper switches and libraries to build a graphical program */
143 #undef LIB_SPEC
144 #define LIB_SPEC "%{mwindows:-subsystem windows -e _WinMainCRTStartup \
145 USER32.LIB%s GDI32.LIB%s COMDLG32.LIB%s WINSPOOL.LIB%s} \
146 %{!mwindows:-subsystem console -e _mainCRTStartup} \
147 %{mcrtmt:LIBCMT.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \
148 %{!mcrtmt:LIBC.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \
149 %{v}"
151 #include "winnt/win-nt.h"