OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [i386/] [i386-interix.h] - Blame information for rev 709

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 709 jeremybenn
/* Target definitions for GCC for Intel 80386 running Interix
2
   Parts Copyright (C) 1991, 1999, 2000, 2002, 2003, 2004, 2007, 2008, 2009,
3
   2010, 2011, 2012 Free Software Foundation, Inc.
4
 
5
   Parts:
6
     by Douglas B. Rupp (drupp@cs.washington.edu).
7
     by Ron Guilmette (rfg@netcom.com).
8
     by Donn Terry (donn@softway.com).
9
     by Mumit Khan (khan@xraylith.wisc.edu).
10
 
11
This file is part of GCC.
12
 
13
GCC is free software; you can redistribute it and/or modify
14
it under the terms of the GNU General Public License as published by
15
the Free Software Foundation; either version 3, or (at your option)
16
any later version.
17
 
18
GCC is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
GNU General Public License for more details.
22
 
23
You should have received a copy of the GNU General Public License
24
along with GCC; see the file COPYING3.  If not see
25
<http://www.gnu.org/licenses/>.  */
26
 
27
/* Note: Interix doesn't support user-written DLLs (use conventional
28
   shared libs (.so) instead).  Thus a lot of the stuff that might apply
29
   about dllimport/dllexport and the like does not apply here. */
30
 
31
#include <stdio.h>
32
 
33
/* Names to predefine in the preprocessor for this target machine.  */
34
 
35
#define DBX_DEBUGGING_INFO 1
36
#define SDB_DEBUGGING_INFO 1
37
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
38
 
39
/* Our strategy for finding global constructors is a bit different, although
40
   not a lot.  */
41
#define DO_GLOBAL_CTORS_BODY                                            \
42
do {                                                                    \
43
  int i;                                                                \
44
  unsigned long nptrs;                                                  \
45
  func_ptr *p;                                                          \
46
  asm(                                                                  \
47
       "     .section .ctor_head, \"rw\"\n"                             \
48
       "1:\n"                                                           \
49
       "     .text \n"                                                  \
50
       ASM_LOAD_ADDR(1b,%0)                                              \
51
       : "=r" (p) : : "cc");                                            \
52
  for (nptrs = 0; p[nptrs] != 0; nptrs++);                                \
53
  for (i = nptrs-1; i >= 0; i--)                                 \
54
    p[i] ();                                                            \
55
} while (0)
56
 
57
#define DO_GLOBAL_DTORS_BODY                                            \
58
do {                                                                    \
59
  func_ptr *p;                                                          \
60
  asm(                                                                  \
61
       "     .section .dtor_head, \"rw\"\n"                             \
62
       "1:\n"                                                           \
63
       "     .text \n"                                                  \
64
       ASM_LOAD_ADDR(1b,%0)                                              \
65
       : "=r" (p) : : "cc");                                            \
66
  while (*p)                                                            \
67
    {                                                                   \
68
      p++;                                                              \
69
      (*(p-1)) ();                                                      \
70
    }                                                                   \
71
} while (0)
72
 
73
/* We don't use the "usual" push-an-address solution. */
74
#undef TARGET_ASM_CONSTRUCTOR
75
 
76
#undef  SUBTARGET_SWITCHES
77
#define SUBTARGET_SWITCHES \
78
{ "ms-bitfields", MASK_MS_BITFIELD_LAYOUT, N_("Use native (MS) bitfield layout") }, \
79
{ "no-ms-bitfields", -MASK_MS_BITFIELD_LAYOUT, N_("Use gcc default bitfield layout") },
80
 
81
#undef LIB_SPEC
82
#define LIB_SPEC "\
83
 %{!shared:%{!dynamic:-lc -lpsxdll \
84
 }} \
85
 %{!G:%{!dynamic:-lc -lpsxdll \
86
 }} \
87
 %{dynamic:-lc -lpsxdll \
88
 } \
89
 %{v}"
90
 
91
#undef LINK_SPEC
92
#define LINK_SPEC "%{!shared:-stack 0x4000000,0x10000} \
93
                   %{g} \
94
                   %{dynamic:-Bdynamic} \
95
                   %{static:-Bstatic} \
96
                   %{shared:--shared -Bdynamic} \
97
                   %{G:--shared -Bdynamic} \
98
                   %{symbolic:--shared -Bsymbolic -Bdynamic} \
99
                   %{rpath*:--rpath %*} \
100
                   "
101
 
102
#undef STARTFILE_SPEC
103
#define STARTFILE_SPEC  \
104
  "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}} %{shared:crti%O%s}"
105
 
106
#define TARGET_DECLSPEC 1
107
 
108
/* cpp handles __STDC__ */
109
#define TARGET_OS_CPP_BUILTINS()                                        \
110
  do                                                                    \
111
    {                                                                   \
112
        builtin_define ("__INTERIX");                                   \
113
        builtin_define ("_M_IX86=300");                                 \
114
        builtin_define ("_X86_=1");                                     \
115
        builtin_define ("__stdcall=__attribute__((__stdcall__))");      \
116
        builtin_define ("__cdecl=__attribute__((__cdecl__))");          \
117
        builtin_define ("__declspec(x)=__attribute__((x))");            \
118
        builtin_assert ("system=unix");                                 \
119
        builtin_assert ("system=interix");                              \
120
        if (preprocessing_asm_p ())                                     \
121
          builtin_define_std ("LANGUAGE_ASSEMBLY");                     \
122
        else                                                            \
123
          {                                                             \
124
             builtin_define_std ("LANGUAGE_C");                         \
125
             if (c_dialect_cxx ())                                      \
126
               builtin_define_std ("LANGUAGE_C_PLUS_PLUS");             \
127
             if (c_dialect_objc ())                                     \
128
               builtin_define_std ("LANGUAGE_OBJECTIVE_C");             \
129
          }                                                             \
130
    }                                                                   \
131
  while (0)
132
 
133
#undef CPP_SPEC
134
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
135
 
136
#define SIZE_TYPE "unsigned int"
137
#define PTRDIFF_TYPE "int"
138
#define WCHAR_TYPE "short unsigned int"
139
#define WCHAR_TYPE_SIZE 16
140
 
141
/* Turn off long double being 96 bits.  */
142
#undef LONG_DOUBLE_TYPE_SIZE
143
#define LONG_DOUBLE_TYPE_SIZE 64
144
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
145
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
146
 
147
/* The following are needed for us to be able to use winnt.c, but are not
148
   otherwise meaningful to Interix.  (The functions that use these are
149
   never called because we don't do DLLs.) */
150
#define TARGET_NOP_FUN_DLLIMPORT 1
151
#define drectve_section()  /* nothing */
152
 
153
 
154
#define EH_FRAME_IN_DATA_SECTION
155
 
156
#define READONLY_DATA_SECTION_ASM_OP    "\t.section\t.rdata,\"r\""
157
 
158
/* Define this macro if references to a symbol must be treated
159
   differently depending on something about the variale or
160
   function named by the symbol (such as what section it is in).  */
161
 
162
#undef TARGET_ENCODE_SECTION_INFO
163
#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
164
#undef  TARGET_STRIP_NAME_ENCODING
165
#define TARGET_STRIP_NAME_ENCODING  i386_pe_strip_name_encoding_full
166
 
167
/* Emit code to check the stack when allocating more that 4000
168
   bytes in one go.  */
169
 
170
#define CHECK_STACK_LIMIT 4000
171
 
172
/* By default, target has a 80387, uses IEEE compatible arithmetic,
173
   and returns float values in the 387 and needs stack probes
174
   We also align doubles to 64-bits forMSVC default compatibility
175
   Ditto for bitfields. */
176
#undef TARGET_SUBTARGET_DEFAULT
177
#define TARGET_SUBTARGET_DEFAULT \
178
   (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE | \
179
    MASK_ALIGN_DOUBLE | MASK_MS_BITFIELD_LAYOUT)
180
 
181
/* The MS compilers take alignment as a number of bytes, so we do as well */
182
#undef ASM_OUTPUT_ALIGN
183
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
184
  if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
185
 
186
 
187
/* Define this macro if in some cases global symbols from one translation
188
   unit may not be bound to undefined symbols in another translation unit
189
   without user intervention.  For instance, under Microsoft Windows
190
   symbols must be explicitly imported from shared libraries (DLLs).  */
191
/*
192
 * Old gcc(3.3) did not have 1 here
193
 */
194
#define MULTIPLE_SYMBOL_SPACES  1
195
 
196
extern void i386_pe_unique_section PARAMS ((tree, int));
197
#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
198
 
199
/* Switch into a generic section.  */
200
#define TARGET_ASM_NAMED_SECTION  default_pe_asm_named_section
201
 
202
/* Select attributes for named sections.  */
203
#define TARGET_SECTION_TYPE_FLAGS  i386_pe_section_type_flags
204
 
205
/* Write the extra assembler code needed to declare a function
206
   properly.  If we are generating SDB debugging information, this
207
   will happen automatically, so we only need to handle other cases.  */
208
#undef ASM_DECLARE_FUNCTION_NAME
209
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
210
  do                                                                    \
211
    {                                                                   \
212
      if (write_symbols != SDB_DEBUG)                                   \
213
       i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));  \
214
      ASM_OUTPUT_LABEL (FILE, NAME);                                    \
215
    }                                                                   \
216
  while (0)
217
 
218
/* Add an external function to the list of functions to be declared at
219
   the end of the file.  */
220
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)                           \
221
  do                                                                    \
222
    {                                                                   \
223
      if (TREE_CODE (DECL) == FUNCTION_DECL)                            \
224
        i386_pe_record_external_function (DECL, NAME);                  \
225
    }                                                                   \
226
  while (0)
227
 
228
/* Declare the type properly for any external libcall.  */
229
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
230
  i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
231
 
232
/* This says out to put a global symbol in the BSS section.  */
233
#undef ASM_OUTPUT_ALIGNED_BSS
234
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
235
  asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
236
 
237
/* Don't assume anything about the header files.  */
238
#define NO_IMPLICIT_EXTERN_C
239
 
240
/* External function declarations.  */
241
extern void i386_pe_record_external_function (tree, const char *);
242
extern void i386_pe_declare_function_type (FILE *, const char *, int);
243
extern void i386_pe_record_exported_symbol (const char *, int);
244
extern void i386_pe_asm_file_end (FILE *);
245
 
246
/* For Win32 ABI compatibility */
247
#undef DEFAULT_PCC_STRUCT_RETURN
248
#define DEFAULT_PCC_STRUCT_RETURN 0
249
 
250
/* A bitfield declared as `int' forces `int' alignment for the struct.  */
251
#undef PCC_BITFIELD_TYPE_MATTERS
252
#define PCC_BITFIELD_TYPE_MATTERS 1
253
 
254
/* Enable alias attribute support.  */
255
#ifndef SET_ASM_OP
256
#define SET_ASM_OP "\t.set\t"
257
#endif
258
 
259
/* Note that there appears to be two different ways to support const
260
   sections at the moment.  You can either #define the symbol
261
   READONLY_DATA_SECTION (giving it some code which switches to the
262
   readonly data section) or else you can #define the symbols
263
   EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
264
   SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
265
 
266
#define USE_CONST_SECTION 1
267
 
268
/* The linker will take care of this, and having them causes problems with
269
   ld -r (specifically -rU).  */
270
#define CTOR_LISTS_DEFINED_EXTERNALLY 1
271
 
272
/* Output a definition (implements alias) */
273
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
274
do                                                                      \
275
{                                                                       \
276
    fputs (SET_ASM_OP, (FILE));                                         \
277
    assemble_name (FILE, LABEL1);                                       \
278
    fputc (',', (FILE));                                                \
279
    assemble_name (FILE, LABEL2);                                       \
280
    fputc ('\n', (FILE));                                               \
281
    }                                                                   \
282
while (0)
283
 
284
#define HOST_PTR_AS_INT unsigned long
285
 
286
/* The following two flags are usually "off" for i386, because some non-gnu
287
   tools (for the i386) don't handle them.  However, we don't have that
288
   problem, so....  */
289
 
290
/* Forward references to tags are allowed.  */
291
#define SDB_ALLOW_FORWARD_REFERENCES
292
/* Unknown tags are also allowed.  */
293
#define SDB_ALLOW_UNKNOWN_REFERENCES
294
/* DWARF2 Unwinding doesn't work with exception handling yet.  */
295
#define DWARF2_UNWIND_INFO 0
296
/* MSVC returns structs of up to 8 bytes via registers. */
297
 
298
#undef SUBTARGET_RETURN_IN_MEMORY
299
#define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
300
  (TYPE_MODE (TYPE) == BLKmode || \
301
     (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes(TYPE) > 8 ))
302
 
303
#define ASM_LOAD_ADDR(loc, reg)   "     leal " #loc "," #reg "\n"
304
 
305
/* The integer half of this list needs to be constant.  However, there's
306
   a lot of disagreement about what the floating point adjustments should
307
   be.  We pick one that works with gdb.  (The underlying problem is
308
   what to do about the segment registers.  Since we have access to them
309
   from /proc, we'll allow them to be accessed in gdb, even tho the
310
   gcc compiler can't generate them.  (There's some evidence that
311
   MSVC does, but possibly only for certain special "canned" sequences.)  */
312
 
313
#undef DBX_REGISTER_NUMBER
314
#define DBX_REGISTER_NUMBER(n) \
315
(TARGET_64BIT ? dbx64_register_map[n] \
316
 : (n) == 0 ? (int) 0 \
317
 : (n) == 1 ? (int) 2 \
318
 : (n) == 2 ? (int) 1 \
319
 : (n) == 3 ? (int) 3 \
320
 : (n) == 4 ? (int) 6 \
321
 : (n) == 5 ? (int) 7 \
322
 : (n) == 6 ? (int) 5 \
323
 : (n) == 7 ? (int) 4 \
324
 : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (int) (n)+8 \
325
 : (int) (-1))
326
 
327
#define EH_FRAME_IN_DATA_SECTION
328
 
329
/* the following are OSF linker (not gld) specific... we don't want them */
330
#undef HAS_INIT_SECTION
331
#undef LD_INIT_SWITCH
332
#undef LD_FINI_SWITCH
333
 
334
/* The following are needed for us to be able to use winnt.c, but are not
335
   otherwise meaningful to Interix.  (The functions that use these are
336
   never called because we don't do DLLs.) */
337
#define TARGET_NOP_FUN_DLLIMPORT 1
338
#define I386_PE_STRIP_ENCODING(SYM_NAME) \
339
  ((SYM_NAME) + ((SYM_NAME)[0] == '@' \
340
                 ? ((SYM_NAME)[3] == '*' ? 4 : 3) : 0) \
341
             + ((SYM_NAME)[0] == '*' ? 1 : 0))
342
 
343
#define drectve_section()  /* nothing */
344
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.