* configure: Regenerated.
[official-gcc.git] / gcc / config / i386 / cygming.h
blob8455a67b7a5e6e07e36d4a9e5aa8076803a40eae
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, 2002, 2003,
4 2004, 2005, 2007, 2008, 2009, 2010, 2011
5 Free Software Foundation, Inc.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
23 #define DBX_DEBUGGING_INFO 1
24 #define SDB_DEBUGGING_INFO 1
25 #if TARGET_64BIT_DEFAULT || defined (HAVE_GAS_PE_SECREL32_RELOC)
26 #define DWARF2_DEBUGGING_INFO 1
27 #endif
29 #undef PREFERRED_DEBUGGING_TYPE
30 #if (DWARF2_DEBUGGING_INFO)
31 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
32 #else
33 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
34 #endif
36 #undef TARGET_SEH
37 #define TARGET_SEH (TARGET_64BIT_MS_ABI && flag_unwind_tables)
39 /* Win64 with SEH cannot represent DRAP stack frames. Disable its use.
40 Force the use of different mechanisms to allocate aligned local data. */
41 #undef MAX_STACK_ALIGNMENT
42 #define MAX_STACK_ALIGNMENT (TARGET_SEH ? 128 : MAX_OFILE_ALIGNMENT)
44 /* Support hooks for SEH. */
45 #undef TARGET_ASM_UNWIND_EMIT
46 #define TARGET_ASM_UNWIND_EMIT i386_pe_seh_unwind_emit
47 #undef TARGET_ASM_UNWIND_EMIT_BEFORE_INSN
48 #define TARGET_ASM_UNWIND_EMIT_BEFORE_INSN false
49 #undef TARGET_ASM_FUNCTION_END_PROLOGUE
50 #define TARGET_ASM_FUNCTION_END_PROLOGUE i386_pe_seh_end_prologue
51 #undef TARGET_ASM_EMIT_EXCEPT_PERSONALITY
52 #define TARGET_ASM_EMIT_EXCEPT_PERSONALITY i386_pe_seh_emit_except_personality
53 #undef TARGET_ASM_INIT_SECTIONS
54 #define TARGET_ASM_INIT_SECTIONS i386_pe_seh_init_sections
55 #define SUBTARGET_ASM_UNWIND_INIT i386_pe_seh_init
57 #undef DEFAULT_ABI
58 #define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI)
60 #if ! defined (USE_MINGW64_LEADING_UNDERSCORES)
61 #undef USER_LABEL_PREFIX
62 #define USER_LABEL_PREFIX (TARGET_64BIT ? "" : "_")
64 #undef LOCAL_LABEL_PREFIX
65 #define LOCAL_LABEL_PREFIX (TARGET_64BIT ? "." : "")
67 #undef ASM_GENERATE_INTERNAL_LABEL
68 #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
69 sprintf ((BUF), "*%s%s%ld", LOCAL_LABEL_PREFIX, \
70 (PREFIX), (long)(NUMBER))
72 #undef LPREFIX
73 #define LPREFIX (TARGET_64BIT ? ".L" : "L")
75 #endif
77 #undef DBX_REGISTER_NUMBER
78 #define DBX_REGISTER_NUMBER(n) \
79 (TARGET_64BIT ? dbx64_register_map[n] \
80 : (write_symbols == DWARF2_DEBUG \
81 ? svr4_dbx_register_map[n] : dbx_register_map[n]))
83 /* Map gcc register number to DWARF 2 CFA column number. For 32 bit
84 target, always use the svr4_dbx_register_map for DWARF .eh_frame
85 even if we don't use DWARF .debug_frame. */
86 #undef DWARF_FRAME_REGNUM
87 #define DWARF_FRAME_REGNUM(n) \
88 (TARGET_64BIT ? dbx64_register_map[(n)] \
89 : svr4_dbx_register_map[(n)])
91 /* The 64-bit MS_ABI changes the set of call-used registers. */
92 #undef DWARF_FRAME_REGISTERS
93 #define DWARF_FRAME_REGISTERS (TARGET_64BIT ? 33 : 17)
95 #ifdef HAVE_GAS_PE_SECREL32_RELOC
96 /* Use section relative relocations for debugging offsets. Unlike
97 other targets that fake this by putting the section VMA at 0, PE
98 won't allow it. */
99 #define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION) \
100 do { \
101 switch (SIZE) \
103 case 4: \
104 fputs ("\t.secrel32\t", FILE); \
105 assemble_name (FILE, LABEL); \
106 break; \
107 case 8: \
108 /* This is a hack. There is no 64-bit section relative \
109 relocation. However, the COFF format also does not \
110 support 64-bit file offsets; 64-bit applications are \
111 limited to 32-bits of code+data in any one module. \
112 Fake the 64-bit offset by zero-extending it. */ \
113 fputs ("\t.secrel32\t", FILE); \
114 assemble_name (FILE, LABEL); \
115 fputs ("\n\t.long\t0", FILE); \
116 break; \
117 default: \
118 gcc_unreachable (); \
120 } while (0)
121 #endif
123 #define TARGET_EXECUTABLE_SUFFIX ".exe"
125 #define TARGET_OS_CPP_BUILTINS() \
126 do \
128 if (!TARGET_64BIT) \
129 builtin_define ("_X86_=1"); \
130 if (TARGET_SEH) \
131 builtin_define ("__SEH__"); \
132 builtin_assert ("system=winnt"); \
133 builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
134 builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
135 builtin_define ("__thiscall=__attribute__((__thiscall__))"); \
136 builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
137 if (!flag_iso) \
139 builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
140 builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
141 builtin_define ("_thiscall=__attribute__((__thiscall__))"); \
142 builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
144 /* Even though linkonce works with static libs, this is needed \
145 to compare typeinfo symbols across dll boundaries. */ \
146 builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
147 builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
148 EXTRA_OS_CPP_BUILTINS (); \
150 while (0)
152 /* Get tree.c to declare a target-specific specialization of
153 merge_decl_attributes. */
154 #define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
156 /* This macro defines names of additional specifications to put in the specs
157 that can be used in various specifications like CC1_SPEC. Its definition
158 is an initializer with a subgrouping for each command option.
160 Each subgrouping contains a string constant, that defines the
161 specification name, and a string constant that used by the GCC driver
162 program.
164 Do not define this macro if it does not need to do anything. */
166 #undef SUBTARGET_EXTRA_SPECS
167 #define SUBTARGET_EXTRA_SPECS \
168 { "mingw_include_path", DEFAULT_TARGET_MACHINE }
170 #undef MATH_LIBRARY
171 #define MATH_LIBRARY ""
173 #define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
174 #define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")
176 #define WCHAR_TYPE_SIZE 16
177 #define WCHAR_TYPE "short unsigned int"
179 /* Windows64 continues to use a 32-bit long type. */
180 #undef LONG_TYPE_SIZE
181 #define LONG_TYPE_SIZE 32
183 #define drectve_section() \
184 (fprintf (asm_out_file, "\t.section .drectve\n"), \
185 in_section = NULL)
187 /* Older versions of gas don't handle 'r' as data.
188 Explicitly set data flag with 'd'. */
189 #define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\""
191 /* Don't allow flag_pic to propagate since gas may produce invalid code
192 otherwise. */
194 #undef SUBTARGET_OVERRIDE_OPTIONS
195 #define SUBTARGET_OVERRIDE_OPTIONS \
196 do { \
197 if (TARGET_64BIT && flag_pic != 1) \
199 if (flag_pic > 1) \
200 warning (0, \
201 "-fPIC ignored for target (all code is position independent)"\
202 ); \
203 flag_pic = 1; \
205 else if (!TARGET_64BIT && flag_pic) \
207 warning (0, "-f%s ignored for target (all code is position independent)",\
208 (flag_pic > 1) ? "PIC" : "pic"); \
209 flag_pic = 0; \
211 } while (0)
213 /* Define this macro if references to a symbol must be treated
214 differently depending on something about the variable or
215 function named by the symbol (such as what section it is in).
217 On i386 running Windows NT, modify the assembler name with a suffix
218 consisting of an atsign (@) followed by string of digits that represents
219 the number of bytes of arguments passed to the function, if it has the
220 attribute STDCALL.
222 In addition, we must mark dll symbols specially. Definitions of
223 dllexport'd objects install some info in the .drectve section.
224 References to dllimport'd objects are fetched indirectly via
225 _imp__. If both are declared, dllexport overrides. This is also
226 needed to implement one-only vtables: they go into their own
227 section and we need to set DECL_SECTION_NAME so we do that here.
228 Note that we can be called twice on the same decl. */
230 #define SUBTARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
232 /* Local and global relocs can be placed always into readonly memory
233 for PE-COFF targets. */
234 #undef TARGET_ASM_RELOC_RW_MASK
235 #define TARGET_ASM_RELOC_RW_MASK i386_pe_reloc_rw_mask
237 /* Output a common block. */
238 #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
239 #define ASM_OUTPUT_ALIGNED_DECL_COMMON \
240 i386_pe_asm_output_aligned_decl_common
242 /* Output the label for an initialized variable. */
243 #undef ASM_DECLARE_OBJECT_NAME
244 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
245 do { \
246 i386_pe_maybe_record_exported_symbol (DECL, NAME, 1); \
247 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
248 } while (0)
250 /* Output a reference to a label. Fastcall function symbols
251 keep their '@' prefix, while other symbols are prefixed
252 with user_label_prefix. */
253 #undef ASM_OUTPUT_LABELREF
254 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
255 do { \
256 if ((NAME)[0] != FASTCALL_PREFIX) \
257 fputs (user_label_prefix, (STREAM)); \
258 fputs ((NAME), (STREAM)); \
259 } while (0)
261 /* This does much the same in memory rather than to a stream. */
262 #undef TARGET_MANGLE_ASSEMBLER_NAME
263 #define TARGET_MANGLE_ASSEMBLER_NAME i386_pe_mangle_assembler_name
266 /* Emit code to check the stack when allocating more than 4000
267 bytes in one go. */
268 #define CHECK_STACK_LIMIT 4000
270 #undef STACK_BOUNDARY
271 #define STACK_BOUNDARY (TARGET_64BIT && ix86_abi == MS_ABI ? 128 : BITS_PER_WORD)
273 /* By default, target has a 80387, uses IEEE compatible arithmetic,
274 returns float values in the 387 and needs stack probes.
275 We also align doubles to 64-bits for MSVC default compatibility. */
277 #undef TARGET_SUBTARGET_DEFAULT
278 #define TARGET_SUBTARGET_DEFAULT \
279 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \
280 | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE)
282 #undef TARGET_SUBTARGET64_DEFAULT
283 #define TARGET_SUBTARGET64_DEFAULT \
284 MASK_128BIT_LONG_DOUBLE
286 /* This is how to output an assembler line
287 that says to advance the location counter
288 to a multiple of 2**LOG bytes. */
290 #undef ASM_OUTPUT_ALIGN
291 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
292 if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
294 /* Windows uses explicit import from shared libraries. */
295 #define MULTIPLE_SYMBOL_SPACES 1
297 #define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
298 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
300 #define SUPPORTS_ONE_ONLY 1
302 /* Switch into a generic section. */
303 #define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
305 /* Select attributes for named sections. */
306 #define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
308 /* Write the extra assembler code needed to declare a function
309 properly. If we are generating SDB debugging information, this
310 will happen automatically, so we only need to handle other cases. */
311 #undef ASM_DECLARE_FUNCTION_NAME
312 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
313 i386_pe_start_function (FILE, NAME, DECL)
315 #undef ASM_DECLARE_FUNCTION_SIZE
316 #define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \
317 i386_pe_end_function (FILE, NAME, DECL)
319 /* Add an external function to the list of functions to be declared at
320 the end of the file. */
321 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
322 do \
324 if (TREE_CODE (DECL) == FUNCTION_DECL) \
325 i386_pe_record_external_function ((DECL), (NAME)); \
327 while (0)
329 /* Declare the type properly for any external libcall. */
330 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
331 i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
333 /* This says out to put a global symbol in the BSS section. */
334 #undef ASM_OUTPUT_ALIGNED_BSS
335 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
336 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
338 /* Put all *tf routines in libgcc. */
339 #undef LIBGCC2_HAS_TF_MODE
340 #define LIBGCC2_HAS_TF_MODE 1
341 #define LIBGCC2_TF_CEXT q
342 #define TF_SIZE 113
344 /* Output function declarations at the end of the file. */
345 #undef TARGET_ASM_FILE_END
346 #define TARGET_ASM_FILE_END i386_pe_file_end
348 #undef ASM_COMMENT_START
349 #define ASM_COMMENT_START " #"
351 #ifndef DWARF2_UNWIND_INFO
352 /* If configured with --disable-sjlj-exceptions, use DWARF2, else
353 default to SJLJ. */
354 #if (defined (CONFIG_SJLJ_EXCEPTIONS) && !CONFIG_SJLJ_EXCEPTIONS)
355 /* The logic of this #if must be kept synchronised with the logic
356 for selecting the tmake_eh_file fragment in config.gcc. */
357 #define DWARF2_UNWIND_INFO 1
358 /* If multilib is selected break build as sjlj is required. */
359 #if defined (TARGET_BI_ARCH)
360 #error For 64-bit windows and 32-bit based multilib version of gcc just SJLJ exceptions are supported.
361 #endif
362 #else
363 #define DWARF2_UNWIND_INFO 0
364 #endif
365 #endif
367 /* Don't assume anything about the header files. */
368 #define NO_IMPLICIT_EXTERN_C
370 #undef PROFILE_HOOK
371 #define PROFILE_HOOK(LABEL) \
372 if (MAIN_NAME_P (DECL_NAME (current_function_decl))) \
374 emit_call_insn (gen_rtx_CALL (VOIDmode, \
375 gen_rtx_MEM (FUNCTION_MODE, \
376 gen_rtx_SYMBOL_REF (Pmode, "_monstartup")), \
377 const0_rtx)); \
380 /* Java Native Interface (JNI) methods on Win32 are invoked using the
381 stdcall calling convention. */
382 #undef MODIFY_JNI_METHOD_CALL
383 #define MODIFY_JNI_METHOD_CALL(MDECL) \
384 build_type_attribute_variant ((MDECL), \
385 build_tree_list (get_identifier ("stdcall"), \
386 NULL))
388 /* For Win32 ABI compatibility */
389 #undef DEFAULT_PCC_STRUCT_RETURN
390 #define DEFAULT_PCC_STRUCT_RETURN 0
392 /* MSVC returns aggregate types of up to 8 bytes via registers.
393 See i386.c:ix86_return_in_memory. */
394 #undef MS_AGGREGATE_RETURN
395 #define MS_AGGREGATE_RETURN 1
397 /* Biggest alignment supported by the object file format of this
398 machine. Use this macro to limit the alignment which can be
399 specified using the `__attribute__ ((aligned (N)))' construct. If
400 not defined, the default value is `BIGGEST_ALIGNMENT'. */
401 /* IMAGE_SCN_ALIGN_8192BYTES is the largest section alignment flag
402 specified in the PECOFF60 spec. Native MS compiler also limits
403 user-specified alignment to 8192 bytes. */
404 #undef MAX_OFILE_ALIGNMENT
405 #define MAX_OFILE_ALIGNMENT (8192 * 8)
407 /* BIGGEST_FIELD_ALIGNMENT macro is used directly by libobjc, There, we
408 align internal doubles in structures on dword boundaries. Otherwise,
409 support vector modes using ADJUST_FIELD_ALIGN, defined in i386.h. */
410 #ifdef IN_TARGET_LIBS
411 #undef BIGGEST_FIELD_ALIGNMENT
412 #define BIGGEST_FIELD_ALIGNMENT 64
413 #endif
415 /* A bit-field declared as `int' forces `int' alignment for the struct. */
416 #undef PCC_BITFIELD_TYPE_MATTERS
417 #define PCC_BITFIELD_TYPE_MATTERS 1
418 #define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
420 /* Enable alias attribute support. */
421 #ifndef SET_ASM_OP
422 #define SET_ASM_OP "\t.set\t"
423 #endif
425 /* This implements the `alias' attribute, keeping any stdcall or
426 fastcall decoration. */
427 #undef ASM_OUTPUT_DEF_FROM_DECLS
428 #define ASM_OUTPUT_DEF_FROM_DECLS(STREAM, DECL, TARGET) \
429 do \
431 const char *alias \
432 = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
433 i386_pe_maybe_record_exported_symbol (DECL, alias, 0); \
434 if (TREE_CODE (DECL) == FUNCTION_DECL) \
435 i386_pe_declare_function_type (STREAM, alias, \
436 TREE_PUBLIC (DECL)); \
437 ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET)); \
438 } while (0)
440 /* GNU as supports weak symbols on PECOFF. */
441 #ifdef HAVE_GAS_WEAK
442 #define ASM_WEAKEN_LABEL(FILE, NAME) \
443 do \
445 fputs ("\t.weak\t", (FILE)); \
446 assemble_name ((FILE), (NAME)); \
447 fputc ('\n', (FILE)); \
449 while (0)
450 #endif /* HAVE_GAS_WEAK */
452 /* FIXME: SUPPORTS_WEAK && TARGET_HAVE_NAMED_SECTIONS is true,
453 but for .jcr section to work we also need crtbegin and crtend
454 objects. */
455 #define TARGET_USE_JCR_SECTION 1
457 /* Decide whether it is safe to use a local alias for a virtual function
458 when constructing thunks. */
459 #undef TARGET_USE_LOCAL_THUNK_ALIAS_P
460 #define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL))
462 #define SUBTARGET_ATTRIBUTE_TABLE \
463 { "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute, \
464 false }
465 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
466 affects_type_identity } */
468 /* mcount() does not need a counter variable. */
469 #undef NO_PROFILE_COUNTERS
470 #define NO_PROFILE_COUNTERS 1
472 #define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P i386_pe_valid_dllimport_attribute_p
473 #define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION i386_pe_adjust_class_at_definition
474 #define TARGET_MANGLE_DECL_ASSEMBLER_NAME i386_pe_mangle_decl_assembler_name
476 #undef TARGET_ASM_ASSEMBLE_VISIBILITY
477 #define TARGET_ASM_ASSEMBLE_VISIBILITY i386_pe_assemble_visibility
479 /* Static stack checking is supported by means of probes. */
480 #define STACK_CHECK_STATIC_BUILTIN 1