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)
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
31 /* The whole configuration system should be fixed; we really shouldn't
32 * include this file at all.
34 * But at least let's not pretend we're Microsoft C version 8 running
37 #define CPP_PREDEFINES "-Dunix -Di386 -DWIN32 -D_WIN32 \
38 -DWINNT -D_M_IX86=300 -D_X86_=1 -D__STDC__=0 -DALMOST_STDC -D_MSC_VER=800 \
39 -D__stdcall=__attribute__((__stdcall__)) \
40 -D__cdecl=__attribute__((__cdecl__)) \
41 -D_cdecl=__attribute__((__cdecl__)) \
42 -Asystem(unix) -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
44 #define CPP_PREDEFINES "-DSDCC"
46 #define SIZE_TYPE "unsigned int"
47 #define PTRDIFF_TYPE "int"
48 #define WCHAR_UNSIGNED 1
49 #define WCHAR_TYPE_SIZE 16
50 #define WCHAR_TYPE "short unsigned int"
51 #undef LONG_DOUBLE_TYPE_SIZE
52 #define LONG_DOUBLE_TYPE_SIZE 64
56 #define EXTRA_SECTIONS in_ctor, in_dtor
58 #undef EXTRA_SECTION_FUNCTIONS
59 #define EXTRA_SECTION_FUNCTIONS \
60 CTOR_SECTION_FUNCTION \
63 #define CTOR_SECTION_FUNCTION \
67 if (in_section != in_ctor) \
69 fprintf (asm_out_file, "\t.section .ctor\n"); \
70 in_section = in_ctor; \
74 #define DTOR_SECTION_FUNCTION \
78 if (in_section != in_dtor) \
80 fprintf (asm_out_file, "\t.section .dtor\n"); \
81 in_section = in_dtor; \
85 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
88 fprintf (FILE, "%s\t", ASM_LONG); \
89 assemble_name (FILE, NAME); \
90 fprintf (FILE, "\n"); \
93 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
96 fprintf (FILE, "%s\t", ASM_LONG); \
97 assemble_name (FILE, NAME); \
98 fprintf (FILE, "\n"); \
101 /* Define this macro if references to a symbol must be treated
102 differently depending on something about the variable or
103 function named by the symbol (such as what section it is in).
105 On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol
106 so that we may access it directly in the GOT.
108 On i386 running Windows NT, modify the assembler name with a suffix
109 consisting of an atsign (@) followed by string of digits that represents
110 the number of bytes of arguments passed to the function, if it has the
111 attribute STDCALL. */
113 #ifdef ENCODE_SECTION_INFO
114 #undef ENCODE_SECTION_INFO
115 #define ENCODE_SECTION_INFO(DECL) \
120 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
121 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
122 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
123 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
124 || ! TREE_PUBLIC (DECL)); \
126 if (TREE_CODE (DECL) == FUNCTION_DECL) \
127 if (lookup_attribute ("stdcall", \
128 TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \
129 XEXP (DECL_RTL (DECL), 0) = \
130 gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \
135 /* The global __fltused is necessary to cause the printf/scanf routines
136 for outputting/inputting floating point numbers to be loaded. Since this
137 is kind of hard to detect, we just do it all the time. */
139 #ifdef ASM_FILE_START
140 #undef ASM_FILE_START
142 #define ASM_FILE_START(FILE) \
143 do { fprintf (FILE, "\t.file\t"); \
144 output_quoted_string (FILE, dump_base_name); \
145 fprintf (FILE, "\n"); \
146 fprintf (FILE, ".global\t__fltused\n"); \
149 /* if the switch "-mwindows" is passed to ld, then specify to the Microsoft
150 linker the proper switches and libraries to build a graphical program */
153 #define LIB_SPEC "%{mwindows:-subsystem windows -e _WinMainCRTStartup \
154 USER32.LIB%s GDI32.LIB%s COMDLG32.LIB%s WINSPOOL.LIB%s} \
155 %{!mwindows:-subsystem console -e _mainCRTStartup} \
156 %{mcrtmt:LIBCMT.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \
157 %{!mcrtmt:LIBC.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \
160 #include "winnt/win-nt.h"