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, 2002
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 /* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
26 #define HANDLE_PRAGMA_PACK_PUSH_POP 1
28 #define DBX_DEBUGGING_INFO
29 #define SDB_DEBUGGING_INFO
30 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
32 #include "i386/unix.h"
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_TYPE_SIZE 16
99 #define WCHAR_TYPE "short unsigned int"
100 /* Currently we do not have the atexit() function,
101 so take that from libgcc2.c */
103 #define NEED_ATEXIT 1
105 #undef TARGET_ENCODE_SECTION_INFO
106 #define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
108 /* This macro gets just the user-specified name
109 out of the string in a SYMBOL_REF. Discard
110 trailing @[NUM] encoded by targetm.encode_section_info.
111 Do we need the stripping of leading '*'? */
112 #undef STRIP_NAME_ENCODING
113 #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
116 const char *const _name = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'));\
117 for (_p = _name; *_p && *_p != '@'; ++_p) \
121 int _len = _p - _name; \
122 char *_new_name = (char *) alloca (_len + 1); \
123 strncpy (_new_name, _name, _len); \
124 _new_name[_len] = '\0'; \
132 /* Emit code to check the stack when allocating more that 4000
135 #define CHECK_STACK_LIMIT 4000
137 /* By default, target has a 80387, uses IEEE compatible arithmetic,
138 and returns float values in the 387 and needs stack probes */
139 #undef TARGET_SUBTARGET_DEFAULT
141 #define TARGET_SUBTARGET_DEFAULT \
142 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE)
144 /* This is how to output an assembler line
145 that says to advance the location counter
146 to a multiple of 2**LOG bytes. */
148 #undef ASM_OUTPUT_ALIGN
149 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
150 if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
152 /* Define this macro if in some cases global symbols from one translation
153 unit may not be bound to undefined symbols in another translation unit
154 without user intervention. For instance, under Microsoft Windows
155 symbols must be explicitly imported from shared libraries (DLLs). */
156 #define MULTIPLE_SYMBOL_SPACES
158 extern void i386_pe_unique_section PARAMS ((tree, int));
159 #define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
161 #define SUPPORTS_ONE_ONLY 1
163 /* Switch into a generic section. */
164 #define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
166 /* Select attributes for named sections. */
167 #define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
169 #undef ASM_COMMENT_START
170 #define ASM_COMMENT_START " #"
172 /* Don't assume anything about the header files. */
173 #define NO_IMPLICIT_EXTERN_C
175 #define SUBTARGET_PROLOGUE \
176 if (current_function_profile \
177 && MAIN_NAME_P (DECL_NAME (current_function_decl)) \
180 xops[0] = gen_rtx_MEM (FUNCTION_MODE, \
181 gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \
182 emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \