Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4383 Serge 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
5
   Free Software Foundation, Inc.
6
 
7
This file is part of GCC.
8
 
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.
13
 
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.
18
 
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
.  */
22
 
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
28
 
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
35
 
36
#undef TARGET_64BIT_MS_ABI
37
#define TARGET_64BIT_MS_ABI (!cfun ? ix86_abi == MS_ABI : TARGET_64BIT && cfun->machine->call_abi == MS_ABI)
38
 
39
#undef DEFAULT_ABI
40
#define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI)
41
 
42
#if ! defined (USE_MINGW64_LEADING_UNDERSCORES)
43
#undef USER_LABEL_PREFIX
44
#define USER_LABEL_PREFIX (TARGET_64BIT ? "" : "_")
45
 
46
#undef LOCAL_LABEL_PREFIX
47
#define LOCAL_LABEL_PREFIX (TARGET_64BIT ? "." : "")
48
 
49
#undef ASM_GENERATE_INTERNAL_LABEL
50
#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)  \
51
  sprintf ((BUF), "*%s%s%ld", LOCAL_LABEL_PREFIX, \
52
	   (PREFIX), (long)(NUMBER))
53
 
54
#undef LPREFIX
55
#define LPREFIX (TARGET_64BIT ? ".L" : "L")
56
 
57
#endif
58
 
59
#undef DBX_REGISTER_NUMBER
60
#define DBX_REGISTER_NUMBER(n)				\
61
  (TARGET_64BIT ? dbx64_register_map[n]			\
62
   : (write_symbols == DWARF2_DEBUG			\
63
      ? svr4_dbx_register_map[n] : dbx_register_map[n]))
64
 
65
/* Map gcc register number to DWARF 2 CFA column number. For 32 bit
66
   target, always use the svr4_dbx_register_map for DWARF .eh_frame
67
   even if we don't use DWARF .debug_frame. */
68
#undef DWARF_FRAME_REGNUM
69
#define DWARF_FRAME_REGNUM(n)				\
70
  (TARGET_64BIT ? dbx64_register_map[(n)]		\
71
		: svr4_dbx_register_map[(n)])
72
 
73
#ifdef HAVE_GAS_PE_SECREL32_RELOC
74
/* Use section relative relocations for debugging offsets.  Unlike
75
   other targets that fake this by putting the section VMA at 0, PE
76
   won't allow it.  */
77
#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION)	\
78
  do {								\
79
    switch (SIZE)						\
80
      {								\
81
      case 4:							\
82
	fputs ("\t.secrel32\t", FILE);				\
83
	assemble_name (FILE, LABEL);				\
84
	break;							\
85
      case 8:							\
86
	/* This is a hack.  There is no 64-bit section relative	\
87
	   relocation.  However, the COFF format also does not	\
88
	   support 64-bit file offsets; 64-bit applications are	\
89
	   limited to 32-bits of code+data in any one module.	\
90
	   Fake the 64-bit offset by zero-extending it.  */	\
91
	fputs ("\t.secrel32\t", FILE);				\
92
	assemble_name (FILE, LABEL);				\
93
	fputs ("\n\t.long\t0", FILE);				\
94
	break;							\
95
      default:							\
96
	gcc_unreachable ();					\
97
      }								\
98
  } while (0)
99
#endif
100
 
101
#define TARGET_EXECUTABLE_SUFFIX ".exe"
102
 
103
#include 
104
 
105
#define TARGET_OS_CPP_BUILTINS()					\
106
  do									\
107
    {									\
108
	if (!TARGET_64BIT)						\
109
	  builtin_define ("_X86_=1");					\
110
	builtin_assert ("system=winnt");				\
111
	builtin_define ("__stdcall=__attribute__((__stdcall__))");	\
112
	builtin_define ("__fastcall=__attribute__((__fastcall__))");	\
113
	builtin_define ("__cdecl=__attribute__((__cdecl__))");		\
114
	if (!flag_iso)							\
115
	  {								\
116
	    builtin_define ("_stdcall=__attribute__((__stdcall__))");	\
117
	    builtin_define ("_fastcall=__attribute__((__fastcall__))");	\
118
	    builtin_define ("_cdecl=__attribute__((__cdecl__))");	\
119
	  }								\
120
	/* Even though linkonce works with static libs, this is needed 	\
121
	    to compare typeinfo symbols across dll boundaries.  */	\
122
	builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0");		\
123
	builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0");		\
124
	EXTRA_OS_CPP_BUILTINS ();					\
125
  }									\
126
  while (0)
127
 
128
/* Get tree.c to declare a target-specific specialization of
129
   merge_decl_attributes.  */
130
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
131
 
132
/* This macro defines names of additional specifications to put in the specs
133
   that can be used in various specifications like CC1_SPEC.  Its definition
134
   is an initializer with a subgrouping for each command option.
135
 
136
   Each subgrouping contains a string constant, that defines the
137
   specification name, and a string constant that used by the GCC driver
138
   program.
139
 
140
   Do not define this macro if it does not need to do anything.  */
141
 
142
#undef  SUBTARGET_EXTRA_SPECS
143
#define SUBTARGET_EXTRA_SPECS						\
144
  { "mingw_include_path", DEFAULT_TARGET_MACHINE }
145
 
146
#undef MATH_LIBRARY
147
#define MATH_LIBRARY ""
148
 
149
#define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
150
#define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")
151
 
152
#define WCHAR_TYPE_SIZE 16
153
#define WCHAR_TYPE "short unsigned int"
154
 
155
/* Windows64 continues to use a 32-bit long type.  */
156
#undef LONG_TYPE_SIZE
157
#define LONG_TYPE_SIZE 32
158
 
159
/* Enable parsing of #pragma pack(push,) and #pragma pack(pop).  */
160
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
161
 
162
union tree_node;
163
#define TREE union tree_node *
164
 
165
#define drectve_section() \
166
  (fprintf (asm_out_file, "\t.section .drectve\n"), \
167
   in_section = NULL)
168
 
169
/* Older versions of gas don't handle 'r' as data.
170
   Explicitly set data flag with 'd'.  */
171
#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\""
172
 
173
/* Don't allow flag_pic to propagate since gas may produce invalid code
174
   otherwise.  */
175
 
176
#undef  SUBTARGET_OVERRIDE_OPTIONS
177
#define SUBTARGET_OVERRIDE_OPTIONS					\
178
do {									\
179
  if (TARGET_64BIT && flag_pic != 1)					\
180
    {									\
181
      if (flag_pic > 1)							\
182
        warning (0,							\
183
	         "-fPIC ignored for target (all code is position independent)"\
184
                 );                         				\
185
      flag_pic = 1;							\
186
    }									\
187
  else if (!TARGET_64BIT && flag_pic)					\
188
    {									\
189
      warning (0, "-f%s ignored for target (all code is position independent)",\
190
	       (flag_pic > 1) ? "PIC" : "pic");				\
191
      flag_pic = 0;							\
192
    }									\
193
} while (0)								\
194
 
195
/* Define this macro if references to a symbol must be treated
196
   differently depending on something about the variable or
197
   function named by the symbol (such as what section it is in).
198
 
199
   On i386 running Windows NT, modify the assembler name with a suffix
200
   consisting of an atsign (@) followed by string of digits that represents
201
   the number of bytes of arguments passed to the function, if it has the
202
   attribute STDCALL.
203
 
204
   In addition, we must mark dll symbols specially. Definitions of
205
   dllexport'd objects install some info in the .drectve section.
206
   References to dllimport'd objects are fetched indirectly via
207
   _imp__.  If both are declared, dllexport overrides.  This is also
208
   needed to implement one-only vtables: they go into their own
209
   section and we need to set DECL_SECTION_NAME so we do that here.
210
   Note that we can be called twice on the same decl.  */
211
 
212
#define SUBTARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
213
 
214
/* Output a common block.  */
215
#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
216
#define ASM_OUTPUT_ALIGNED_DECL_COMMON \
217
  i386_pe_asm_output_aligned_decl_common
218
 
219
/* Output the label for an initialized variable.  */
220
#undef ASM_DECLARE_OBJECT_NAME
221
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)	\
222
do {							\
223
  i386_pe_maybe_record_exported_symbol (DECL, NAME, 1);	\
224
  ASM_OUTPUT_LABEL ((STREAM), (NAME));			\
225
} while (0)
226
 
227
/* Output a reference to a label. Fastcall function symbols
228
   keep their '@' prefix, while other symbols are prefixed
229
   with user_label_prefix.  */
230
#undef ASM_OUTPUT_LABELREF
231
#define  ASM_OUTPUT_LABELREF(STREAM, NAME)	\
232
do {						\
233
  if ((NAME)[0] != FASTCALL_PREFIX)		\
234
    fputs (user_label_prefix, (STREAM));	\
235
  fputs ((NAME), (STREAM));			\
236
} while (0)
237
 
238
 
239
/* Emit code to check the stack when allocating more than 4000
240
   bytes in one go.  */
241
#define CHECK_STACK_LIMIT 4000
242
 
243
#undef STACK_BOUNDARY
244
#define STACK_BOUNDARY	(ix86_abi == MS_ABI ? 128 : BITS_PER_WORD)
245
 
246
/* By default, target has a 80387, uses IEEE compatible arithmetic,
247
   returns float values in the 387 and needs stack probes.
248
   We also align doubles to 64-bits for MSVC default compatibility.  */
249
 
250
#undef TARGET_SUBTARGET_DEFAULT
251
#define TARGET_SUBTARGET_DEFAULT \
252
	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \
253
	 | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE)
254
 
255
#undef TARGET_SUBTARGET64_DEFAULT
256
#define TARGET_SUBTARGET64_DEFAULT \
257
	MASK_128BIT_LONG_DOUBLE
258
 
259
/* This is how to output an assembler line
260
   that says to advance the location counter
261
   to a multiple of 2**LOG bytes.  */
262
 
263
#undef ASM_OUTPUT_ALIGN
264
#define ASM_OUTPUT_ALIGN(FILE,LOG)	\
265
    if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
266
 
267
/* Windows uses explicit import from shared libraries.  */
268
#define MULTIPLE_SYMBOL_SPACES 1
269
 
270
#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
271
#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
272
 
273
#define SUPPORTS_ONE_ONLY 1
274
 
275
/* Switch into a generic section.  */
276
#define TARGET_ASM_NAMED_SECTION  i386_pe_asm_named_section
277
 
278
/* Select attributes for named sections.  */
279
#define TARGET_SECTION_TYPE_FLAGS  i386_pe_section_type_flags
280
 
281
/* Write the extra assembler code needed to declare a function
282
   properly.  If we are generating SDB debugging information, this
283
   will happen automatically, so we only need to handle other cases.  */
284
#undef ASM_DECLARE_FUNCTION_NAME
285
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
286
  do									\
287
    {									\
288
      i386_pe_maybe_record_exported_symbol (DECL, NAME, 0);		\
289
      if (write_symbols != SDB_DEBUG)					\
290
	i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));	\
291
      ASM_OUTPUT_LABEL (FILE, NAME);					\
292
    }									\
293
  while (0)
294
 
295
/* Add an external function to the list of functions to be declared at
296
   the end of the file.  */
297
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)				\
298
  do									\
299
    {									\
300
      if (TREE_CODE (DECL) == FUNCTION_DECL)				\
301
	i386_pe_record_external_function ((DECL), (NAME));		\
302
    }									\
303
  while (0)
304
 
305
/* Declare the type properly for any external libcall.  */
306
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
307
  i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
308
 
309
/* This says out to put a global symbol in the BSS section.  */
310
#undef ASM_OUTPUT_ALIGNED_BSS
311
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
312
  asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
313
 
314
/* Output function declarations at the end of the file.  */
315
#undef TARGET_ASM_FILE_END
316
#define TARGET_ASM_FILE_END i386_pe_file_end
317
 
318
#undef ASM_COMMENT_START
319
#define ASM_COMMENT_START " #"
320
 
321
#ifndef DWARF2_UNWIND_INFO
322
/* If configured with --disable-sjlj-exceptions, use DWARF2, else
323
   default to SJLJ.  */
324
#if  (defined (CONFIG_SJLJ_EXCEPTIONS) && !CONFIG_SJLJ_EXCEPTIONS)
325
/* The logic of this #if must be kept synchronised with the logic
326
   for selecting the tmake_eh_file fragment in config.gcc.  */
327
#define DWARF2_UNWIND_INFO 1
328
/* If multilib is selected break build as sjlj is required.  */
329
#if defined (TARGET_BI_ARCH)
330
#error For 64-bit windows and 32-bit based multilib version of gcc just SJLJ exceptions are supported.
331
#endif
332
#else
333
#define DWARF2_UNWIND_INFO 0
334
#endif
335
#endif
336
 
337
/* Don't assume anything about the header files.  */
338
#define NO_IMPLICIT_EXTERN_C
339
 
340
#undef PROFILE_HOOK
341
#define PROFILE_HOOK(LABEL)						\
342
  if (MAIN_NAME_P (DECL_NAME (current_function_decl)))			\
343
    {									\
344
      emit_call_insn (gen_rtx_CALL (VOIDmode,				\
345
	gen_rtx_MEM (FUNCTION_MODE,					\
346
		     gen_rtx_SYMBOL_REF (Pmode, "_monstartup")),	\
347
	const0_rtx));							\
348
    }
349
 
350
/* Java Native Interface (JNI) methods on Win32 are invoked using the
351
   stdcall calling convention.  */
352
#undef MODIFY_JNI_METHOD_CALL
353
#define MODIFY_JNI_METHOD_CALL(MDECL)					      \
354
  build_type_attribute_variant ((MDECL),				      \
355
			       build_tree_list (get_identifier ("stdcall"),   \
356
						NULL))
357
 
358
/* For Win32 ABI compatibility */
359
#undef DEFAULT_PCC_STRUCT_RETURN
360
#define DEFAULT_PCC_STRUCT_RETURN 0
361
 
362
/* MSVC returns aggregate types of up to 8 bytes via registers.
363
   See i386.c:ix86_return_in_memory.  */
364
#undef MS_AGGREGATE_RETURN
365
#define MS_AGGREGATE_RETURN 1
366
 
367
/* Biggest alignment supported by the object file format of this
368
   machine.  Use this macro to limit the alignment which can be
369
   specified using the `__attribute__ ((aligned (N)))' construct.  If
370
   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
371
/* IMAGE_SCN_ALIGN_8192BYTES is the largest section alignment flag
372
   specified in the PECOFF60 spec.  Native MS compiler also limits
373
   user-specified alignment to 8192 bytes.  */
374
#undef MAX_OFILE_ALIGNMENT
375
#define MAX_OFILE_ALIGNMENT (8192 * 8)
376
 
377
/* BIGGEST_FIELD_ALIGNMENT macro is used directly by libobjc, There, we
378
   align internal doubles in structures on dword boundaries. Otherwise,
379
   support vector modes using ADJUST_FIELD_ALIGN, defined in i386.h.  */
380
#ifdef IN_TARGET_LIBS
381
#undef	BIGGEST_FIELD_ALIGNMENT
382
#define BIGGEST_FIELD_ALIGNMENT 64
383
#endif
384
 
385
/* A bit-field declared as `int' forces `int' alignment for the struct.  */
386
#undef PCC_BITFIELD_TYPE_MATTERS
387
#define PCC_BITFIELD_TYPE_MATTERS 1
388
#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
389
 
390
/* Enable alias attribute support.  */
391
#ifndef SET_ASM_OP
392
#define SET_ASM_OP "\t.set\t"
393
#endif
394
 
395
/* This implements the `alias' attribute, keeping any stdcall or
396
   fastcall decoration.  */
397
#undef	ASM_OUTPUT_DEF_FROM_DECLS
398
#define	ASM_OUTPUT_DEF_FROM_DECLS(STREAM, DECL, TARGET)			\
399
  do									\
400
    {									\
401
      const char *alias							\
402
	= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));		\
403
      i386_pe_maybe_record_exported_symbol (DECL, alias, 0);		\
404
      if (TREE_CODE (DECL) == FUNCTION_DECL)				\
405
	i386_pe_declare_function_type (STREAM, alias,			\
406
				       TREE_PUBLIC (DECL));		\
407
      ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET));	\
408
    } while (0)
409
 
410
/* GNU as supports weak symbols on PECOFF. */
411
#ifdef HAVE_GAS_WEAK
412
#define ASM_WEAKEN_LABEL(FILE, NAME)  \
413
  do                                  \
414
    {                                 \
415
      fputs ("\t.weak\t", (FILE));    \
416
      assemble_name ((FILE), (NAME)); \
417
      fputc ('\n', (FILE));           \
418
    }                                 \
419
  while (0)
420
#endif /* HAVE_GAS_WEAK */
421
 
422
/* FIXME: SUPPORTS_WEAK && TARGET_HAVE_NAMED_SECTIONS is true,
423
   but for .jcr section to work we also need crtbegin and crtend
424
   objects.  */
425
#define TARGET_USE_JCR_SECTION 1
426
 
427
/* Decide whether it is safe to use a local alias for a virtual function
428
   when constructing thunks.  */
429
#undef TARGET_USE_LOCAL_THUNK_ALIAS_P
430
#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL))
431
 
432
#define SUBTARGET_ATTRIBUTE_TABLE \
433
  { "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute }
434
  /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
435
 
436
/*  mcount() does not need a counter variable.  */
437
#undef NO_PROFILE_COUNTERS
438
#define NO_PROFILE_COUNTERS 1
439
 
440
#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P i386_pe_valid_dllimport_attribute_p
441
#define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION i386_pe_adjust_class_at_definition
442
#define TARGET_MANGLE_DECL_ASSEMBLER_NAME i386_pe_mangle_decl_assembler_name
443
 
444
#undef TREE
445
 
446
#ifndef BUFSIZ
447
# undef FILE
448
#endif