1 /* Operating system specific defines to be used when targeting GCC for
2 hosting on Windows NT 3.x, using a Unix style C library and tools,
3 as distinct from winnt.h, which is used to build GCC for use with a
4 windows style library and tool set and uses the Microsoft tools.
5 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
6 Free Software Foundation, Inc.
8 This file is part of GNU CC.
10 GNU CC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 GNU CC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GNU CC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
25 #define YES_UNDERSCORES
27 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
28 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
30 #define DBX_DEBUGGING_INFO
31 #define SDB_DEBUGGING_INFO
32 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
37 /* Augment TARGET_SWITCHES with the cygwin/win32 options. */
38 #define MASK_WIN32 0x40000000 /* Use -lming32 interface */
39 #define MASK_CYGWIN 0x20000000 /* Use -lcygwin interface */
40 #define MASK_WINDOWS 0x10000000 /* Use windows interface */
41 #define MASK_DLL 0x08000000 /* Use dll interface */
42 #define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */
44 #define TARGET_WIN32 (target_flags & MASK_WIN32)
45 #define TARGET_CYGWIN (target_flags & MASK_CYGWIN)
46 #define TARGET_WINDOWS (target_flags & MASK_WINDOWS)
47 #define TARGET_DLL (target_flags & MASK_DLL)
48 #define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT)
50 #undef SUBTARGET_SWITCHES
51 #define SUBTARGET_SWITCHES \
52 { "win32", MASK_WIN32, \
53 N_("Use Mingw32 interface") }, \
54 { "cygwin", MASK_CYGWIN, \
55 N_("Use Cygwin interface") }, \
56 { "windows", MASK_WINDOWS, \
57 N_("Use bare Windows interface") }, \
59 N_("Generate code for a DLL") }, \
60 { "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, \
61 N_("Ignore dllimport for functions") }, \
62 { "no-nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, "" },
66 #define CPP_PREDEFINES "-D_WIN32 -DWINNT -D_X86_=1 \
67 -D__stdcall=__attribute__((__stdcall__)) \
68 -D__cdecl=__attribute__((__cdecl__)) \
73 #define STARTFILE_SPEC "%{mdll:dllcrt0%O%s} %{!mdll: %{!mcygwin:mcrt0%O%s} \
74 %{mcygwin:crt0%O%s} %{pg:gcrt0%O%s}}"
77 #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
78 %{!mcygwin:-iwithprefixbefore include/mingw32 -D__MINGW32__} \
79 %{mcygwin:-D__CYGWIN32__ -D__CYGWIN__}"
81 /* We have to dynamic link to get to the system DLLs. All of libc, libm and
82 the Unix stuff is in cygwin.dll. The import library is called
83 'libcygwin.a'. For Windows applications, include more libraries, but
84 always include kernel32. We'd like to specific subsystem windows to
85 ld, but that doesn't work just yet. */
88 #define LIB_SPEC "%{pg:-lgmon} \
89 %{!mcygwin:-lmingw32 -lmoldname -lmsvcrt -lcrtdll} \
90 %{mcygwin:-lcygwin} %{mwindows:-luser32 -lgdi32 -lcomdlg32} \
91 -lkernel32 -ladvapi32 -lshell32"
93 #define LINK_SPEC "%{mwindows:--subsystem windows} \
94 %{mdll:--dll -e _DllMainCRTStartup@12}"
96 #define SIZE_TYPE "unsigned int"
97 #define PTRDIFF_TYPE "int"
98 #define WCHAR_UNSIGNED 1
99 #define WCHAR_TYPE_SIZE 16
100 #define WCHAR_TYPE "short unsigned int"
101 /* Currently we do not have the atexit() function,
102 so take that from libgcc2.c */
104 #define NEED_ATEXIT 1
106 /* Define this macro if references to a symbol must be treated
107 differently depending on something about the variable or
108 function named by the symbol (such as what section it is in).
110 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
111 so that we may access it directly in the GOT.
113 On i386 running Windows NT, modify the assembler name with a suffix
114 consisting of an atsign (@) followed by string of digits that represents
115 the number of bytes of arguments passed to the function, if it has the
116 attribute STDCALL. */
118 #ifdef ENCODE_SECTION_INFO
119 #undef ENCODE_SECTION_INFO
120 #define ENCODE_SECTION_INFO(DECL) \
125 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
126 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
127 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
128 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
129 || ! TREE_PUBLIC (DECL)); \
131 if (TREE_CODE (DECL) == FUNCTION_DECL) \
132 if (lookup_attribute ("stdcall", \
133 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
134 XEXP (DECL_RTL (DECL), 0) = \
135 gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \
140 /* This macro gets just the user-specified name
141 out of the string in a SYMBOL_REF. Discard
142 trailing @[NUM] encoded by ENCODE_SECTION_INFO.
143 Do we need the stripping of leading '*'? */
144 #undef STRIP_NAME_ENCODING
145 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
148 const char *const _name = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'));\
149 for (_p = _name; *_p && *_p != '@'; ++_p) \
153 int _len = _p - _name; \
154 char *_new_name = (char *) alloca (_len + 1); \
155 strncpy (_new_name, _name, _len); \
156 _new_name[_len] = '\0'; \
164 /* Emit code to check the stack when allocating more that 4000
167 #define CHECK_STACK_LIMIT 4000
169 /* By default, target has a 80387, uses IEEE compatible arithmetic,
170 and returns float values in the 387 and needs stack probes */
171 #undef TARGET_SUBTARGET_DEFAULT
173 #define TARGET_SUBTARGET_DEFAULT \
174 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE)
176 /* This is how to output an assembler line
177 that says to advance the location counter
178 to a multiple of 2**LOG bytes. */
180 #undef ASM_OUTPUT_ALIGN
181 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
182 if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
184 /* Define this macro if in some cases global symbols from one translation
185 unit may not be bound to undefined symbols in another translation unit
186 without user intervention. For instance, under Microsoft Windows
187 symbols must be explicitly imported from shared libraries (DLLs). */
188 #define MULTIPLE_SYMBOL_SPACES
190 extern void i386_pe_unique_section ();
191 #define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC)
193 #define SUPPORTS_ONE_ONLY 1
195 /* Switch into a generic section. */
196 #define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
198 /* Select attributes for named sections. */
199 #define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
201 #undef ASM_COMMENT_START
202 #define ASM_COMMENT_START " #"
204 /* Don't assume anything about the header files. */
205 #define NO_IMPLICIT_EXTERN_C
207 #define SUBTARGET_PROLOGUE \
209 && MAIN_NAME_P (DECL_NAME (current_function_decl)) \
212 xops[0] = gen_rtx_MEM (FUNCTION_MODE, \
213 gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \
214 emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \