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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [m68k/] [netbsd-elf.h] - Blame information for rev 294

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Definitions of target machine for GNU compiler,
2
   for m68k (including m68010) NetBSD platforms using the
3
   ELF object format.
4
   Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
5
   Contributed by Wasabi Systems. Inc.
6
 
7
   This file is derived from <m68k/m68kv4.h>, <m68k/m68kelf.h>,
8
   and <m68k/linux.h>.
9
 
10
This file is part of GCC.
11
 
12
GCC is free software; you can redistribute it and/or modify
13
it under the terms of the GNU General Public License as published by
14
the Free Software Foundation; either version 3, or (at your option)
15
any later version.
16
 
17
GCC is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
GNU General Public License for more details.
21
 
22
You should have received a copy of the GNU General Public License
23
along with GCC; see the file COPYING3.  If not see
24
<http://www.gnu.org/licenses/>.  */
25
 
26
#define TARGET_OS_CPP_BUILTINS()                \
27
  do                                            \
28
    {                                           \
29
      NETBSD_OS_CPP_BUILTINS_ELF();             \
30
      builtin_define ("__m68k__");              \
31
      builtin_define ("__SVR4_ABI__");          \
32
      builtin_define ("__motorola__");          \
33
    }                                           \
34
  while (0)
35
 
36
/* Default target comes from config.gcc */
37
#undef TARGET_DEFAULT
38
#define TARGET_DEFAULT TARGET_CPU_DEFAULT
39
 
40
 
41
/* Don't try using XFmode on the 68010.  */
42
#undef LONG_DOUBLE_TYPE_SIZE
43
#define LONG_DOUBLE_TYPE_SIZE                   \
44
  ((TARGET_68020 || TARGET_68040 || TARGET_68040_ONLY || \
45
    TARGET_68060) ? 80 : 64)
46
 
47
#ifdef __mc68010__
48
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
49
#else
50
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80
51
#endif
52
 
53
#define EXTRA_SPECS \
54
  { "cpp_cpu_default_spec", CPP_CPU_DEFAULT_SPEC }, \
55
  { "cpp_cpu_spec",         CPP_CPU_SPEC }, \
56
  { "cpp_fpu_spec",         CPP_FPU_SPEC }, \
57
  { "asm_default_spec",     ASM_DEFAULT_SPEC }, \
58
  { "netbsd_cpp_spec",      NETBSD_CPP_SPEC }, \
59
  { "netbsd_entry_point",   NETBSD_ENTRY_POINT },
60
 
61
 
62
#define CPP_CPU_SPEC \
63
  "%{m68010:-D__mc68010__} \
64
   %{m68020:-D__mc68020__} \
65
   %{m68030:-D__mc68030__} \
66
   %{m68040:-D__mc68040__} \
67
   %(cpp_cpu_default_spec)"
68
 
69
 
70
#undef TARGET_VERSION
71
#if TARGET_DEFAULT & MASK_68020
72
#define TARGET_VERSION fprintf (stderr, " (NetBSD/m68k ELF)");
73
#define CPP_CPU_DEFAULT_SPEC "%{!m680*:-D__mc68020__}"
74
#define ASM_DEFAULT_SPEC "%{!m680*:-m68020}"
75
#else
76
#define TARGET_VERSION fprintf (stderr, " (NetBSD/68010 ELF)");
77
#define CPP_CPU_DEFAULT_SPEC "%{!m680*:-D__mc68010__}"
78
#define ASM_DEFAULT_SPEC "%{!m680*:-m68010}"
79
#endif
80
 
81
 
82
#if TARGET_DEFAULT & MASK_68881
83
#define CPP_FPU_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__}"
84
#else
85
#define CPP_FPU_SPEC "%{m68881:-D__HAVE_68881__ -D__HAVE_FPU__}"
86
#endif
87
 
88
 
89
/* Provide a CPP_SPEC appropriate for NetBSD m68k targets.  Currently we
90
   deal with the GCC option '-posix', as well as an indication as to
91
   whether or not use of the FPU is allowed.  */
92
 
93
#undef CPP_SPEC
94
#define CPP_SPEC \
95
  "%(netbsd_cpp_spec) %(cpp_cpu_spec) %(cpp_fpu_spec)"
96
 
97
 
98
/* Provide an ASM_SPEC appropriate for NetBSD m68k ELF targets.  We pass
99
   on some CPU options, as well as PIC code generation options.  */
100
 
101
#undef ASM_SPEC
102
#define ASM_SPEC \
103
  "%(asm_default_spec) \
104
    %{m68010} %{m68020} %{m68030} %{m68040} %{m68060} \
105
    %{fpic|fpie:-k} %{fPIC|fPIE:-k -K}"
106
 
107
#define AS_NEEDS_DASH_FOR_PIPED_INPUT
108
 
109
/* Provide a LINK_SPEC appropriate for a NetBSD/m68k ELF target.  */
110
 
111
#undef LINK_SPEC
112
#define LINK_SPEC NETBSD_LINK_SPEC_ELF
113
 
114
#define NETBSD_ENTRY_POINT "_start"
115
 
116
/* Output assembler code to FILE to increment profiler label # LABELNO
117
   for profiling a function only.  */
118
 
119
#undef FUNCTION_PROFILER
120
#define FUNCTION_PROFILER(FILE, LABELNO)                                \
121
do                                                                      \
122
  {                                                                     \
123
    asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO));        \
124
    if (flag_pic)                                                       \
125
      fprintf (FILE, "\tbsr.l __mcount@PLTPC\n");                       \
126
    else                                                                \
127
      fprintf (FILE, "\tjbsr __mcount\n");                              \
128
  }                                                                     \
129
while (0)
130
 
131
 
132
/* Make gcc agree with <machine/ansi.h>  */
133
 
134
#undef SIZE_TYPE
135
#define SIZE_TYPE "unsigned int"
136
 
137
#undef PTRDIFF_TYPE
138
#define PTRDIFF_TYPE "int"
139
 
140
 
141
/* XXX
142
   Here is a bunch of stuff lifted from m68kelf.h.  We don't use that
143
   file directly, because it has a lot of baggage we don't want.  */
144
 
145
 
146
/* The prefix for register names.  Note that REGISTER_NAMES
147
   is supposed to include this prefix.  Also note that this is NOT an
148
   fprintf format string, it is a literal string.  */
149
 
150
#undef REGISTER_PREFIX
151
#define REGISTER_PREFIX "%"
152
 
153
 
154
/* The prefix for local (compiler generated) lables.
155
   These labels will not appear in the symbol table.  */
156
 
157
#undef LOCAL_LABEL_PREFIX
158
#define LOCAL_LABEL_PREFIX "."
159
 
160
 
161
/* The prefix to add to user-visible assembler symbols.  */
162
 
163
#undef USER_LABEL_PREFIX
164
#define USER_LABEL_PREFIX ""
165
 
166
 
167
/* The prefix for immediate operands.  */
168
 
169
#undef IMMEDIATE_PREFIX
170
#define IMMEDIATE_PREFIX "#"
171
 
172
 
173
#undef ASM_COMMENT_START
174
#define ASM_COMMENT_START "|"
175
 
176
 
177
/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
178
   keep switch tables in the text section.  */
179
 
180
#undef JUMP_TABLES_IN_TEXT_SECTION
181
#define JUMP_TABLES_IN_TEXT_SECTION 1
182
 
183
 
184
/* Use the default action for outputting the case label.  */
185
#undef ASM_OUTPUT_CASE_LABEL
186
#define ASM_RETURN_CASE_JUMP                            \
187
  do {                                                  \
188
    if (TARGET_COLDFIRE)                                \
189
      {                                                 \
190
        if (ADDRESS_REG_P (operands[0]))         \
191
          return "jmp %%pc@(2,%0:l)";                   \
192
        else                                            \
193
          return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";      \
194
      }                                                 \
195
    else                                                \
196
      return "jmp %%pc@(2,%0:w)";                       \
197
  } while (0)
198
 
199
 
200
/* This is how to output an assembler line that says to advance the
201
   location counter to a multiple of 2**LOG bytes.  */
202
 
203
#undef ASM_OUTPUT_ALIGN
204
#define ASM_OUTPUT_ALIGN(FILE,LOG)                                      \
205
do                                                                      \
206
  {                                                                     \
207
    if ((LOG) > 0)                                                       \
208
      fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG));             \
209
  }                                                                     \
210
while (0)
211
 
212
 
213
/* If defined, a C expression whose value is a string containing the
214
   assembler operation to identify the following data as uninitialized global
215
   data.  */
216
 
217
#define BSS_SECTION_ASM_OP      ".section\t.bss"
218
 
219
 
220
/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
221
   separate, explicit argument.  If you define this macro, it is used
222
   in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
223
   handling the required alignment of the variable.  The alignment is
224
   specified as the number of bits.
225
 
226
   Try to use function `asm_output_aligned_bss' defined in file
227
   `varasm.c' when defining this macro.  */
228
 
229
#undef ASM_OUTPUT_ALIGNED_BSS
230
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)           \
231
  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
232
 
233
 
234
#undef ASM_OUTPUT_COMMON
235
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)                    \
236
( fputs (".comm ", (FILE)),                                             \
237
  assemble_name ((FILE), (NAME)),                                       \
238
  fprintf ((FILE), ",%u\n", (int)(SIZE)))
239
 
240
#undef ASM_OUTPUT_LOCAL
241
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)                     \
242
( fputs (".lcomm ", (FILE)),                                            \
243
  assemble_name ((FILE), (NAME)),                                       \
244
  fprintf ((FILE), ",%u\n", (int)(SIZE)))
245
 
246
 
247
/* XXX
248
   This is the end of the chunk lifted from m68kelf.h  */
249
 
250
 
251
/* XXX
252
   The following chunk is more or less lifted from m68kv4.h.
253
   We'd like to just #include that file, but it has not yet
254
   been converted to the new include style.
255
 
256
   Should there be a m68kv4-abi.h ??  */
257
 
258
 
259
/* Register in which address to store a structure value is passed to a
260
   function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0. */
261
 
262
#undef M68K_STRUCT_VALUE_REGNUM
263
#define M68K_STRUCT_VALUE_REGNUM 8
264
 
265
 
266
/* Register in which static-chain is passed to a function.  The
267
   default isn m68k.h is a0, but that is already the struct value
268
   regnum.  Make it a1 instead.  */
269
 
270
#undef STATIC_CHAIN_REGNUM
271
#define STATIC_CHAIN_REGNUM 9
272
 
273
 
274
/* Now to renumber registers for dbx and gdb.
275
   We use the Sun-3 convention, which is:
276
   floating point registers have numbers 18 to 25, not
277
   16 to 23 as they do in the compiler.  */
278
 
279
#undef DBX_REGISTER_NUMBER
280
#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
281
 
282
 
283
/* 1 if N is a possible register number for a function value.  For
284
   m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
285
   pointer, or floating types, respectively.  Reject fp0 if not using
286
   a 68881 coprocessor.  */
287
 
288
#undef FUNCTION_VALUE_REGNO_P
289
#define FUNCTION_VALUE_REGNO_P(N)                                       \
290
  ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
291
 
292
 
293
/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
294
   more than one register.  */
295
 
296
#undef NEEDS_UNTYPED_CALL
297
#define NEEDS_UNTYPED_CALL 1
298
 
299
 
300
/* Define how to generate (in the callee) the output value of a
301
   function and how to find (in the caller) the value returned by a
302
   function.  VALTYPE is the data type of the value (as a tree).  If
303
   the precise function being called is known, FUNC is its
304
   FUNCTION_DECL; otherwise, FUNC is 0.  For m68k/SVR4 generate the
305
   result in d0, a0, or fp0 as appropriate.  */
306
 
307
#undef FUNCTION_VALUE
308
#define FUNCTION_VALUE(VALTYPE, FUNC)                                   \
309
  m68k_function_value (VALTYPE, FUNC)
310
 
311
 
312
/* For compatibility with the large body of existing code which does
313
   not always properly declare external functions returning pointer
314
   types, the m68k/SVR4 convention is to copy the value returned for
315
   pointer functions from a0 to d0 in the function epilogue, so that
316
   callers that have neglected to properly declare the callee can
317
   still find the correct return value.  */
318
 
319
extern int current_function_returns_pointer;
320
#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE)                             \
321
do                                                                      \
322
  {                                                                     \
323
    if (current_function_returns_pointer                                \
324
        && ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode))       \
325
      asm_fprintf (FILE, "\tmove.l %Ra0,%Rd0\n");                       \
326
  }                                                                     \
327
while (0)
328
 
329
 
330
/* Define how to find the value returned by a library function
331
   assuming the value has mode MODE.
332
   For m68k/SVR4 look for integer values in d0, pointer values in d0
333
   (returned in both d0 and a0), and floating values in fp0.  */
334
 
335
#undef LIBCALL_VALUE
336
#define LIBCALL_VALUE(MODE)                                             \
337
  m68k_libcall_value (MODE)
338
 
339
 
340
/* Boundary (in *bits*) on which stack pointer should be aligned.
341
   The m68k/SVR4 convention is to keep the stack pointer longword aligned.  */
342
 
343
#undef STACK_BOUNDARY
344
#define STACK_BOUNDARY 32
345
 
346
 
347
/* Alignment of field after `int : 0' in a structure.
348
   For m68k/SVR4, this is the next longword boundary.  */
349
 
350
#undef EMPTY_FIELD_BOUNDARY
351
#define EMPTY_FIELD_BOUNDARY 32
352
 
353
 
354
/* No data type wants to be aligned rounder than this.
355
   For m68k/SVR4, some types (doubles for example) are aligned on 8 byte
356
   boundaries */
357
 
358
#undef BIGGEST_ALIGNMENT
359
#define BIGGEST_ALIGNMENT 64
360
 
361
 
362
/* For m68k SVR4, structures are returned using the reentrant
363
   technique.  */
364
 
365
#undef PCC_STATIC_STRUCT_RETURN
366
 
367
 
368
/* The svr4 ABI for the m68k says that records and unions are returned
369
   in memory.  */
370
 
371
#undef DEFAULT_PCC_STRUCT_RETURN
372
#define DEFAULT_PCC_STRUCT_RETURN 1
373
 
374
/* Output assembler code for a block containing the constant parts
375
   of a trampoline, leaving space for the variable parts.  */
376
 
377
/* On m68k svr4, the trampoline is different from the generic version
378
   in that we use a1 as the static call chain.  */
379
 
380
#undef TRAMPOLINE_TEMPLATE
381
#define TRAMPOLINE_TEMPLATE(FILE)                                       \
382
{                                                                       \
383
  assemble_aligned_integer (2, GEN_INT (0x227a));                       \
384
  assemble_aligned_integer (2, GEN_INT (8));                            \
385
  assemble_aligned_integer (2, GEN_INT (0x2f3a));                       \
386
  assemble_aligned_integer (2, GEN_INT (8));                            \
387
  assemble_aligned_integer (2, GEN_INT (0x4e75));                       \
388
  assemble_aligned_integer (4, const0_rtx);                             \
389
  assemble_aligned_integer (4, const0_rtx);                             \
390
}
391
 
392
/* Redefine since we are using a different trampoline */
393
#undef TRAMPOLINE_SIZE
394
#define TRAMPOLINE_SIZE 18
395
 
396
/* Emit RTL insns to initialize the variable parts of a trampoline.
397
   FNADDR is an RTX for the address of the function's pure code.
398
   CXT is an RTX for the static chain value for the function.  */
399
 
400
#undef INITIALIZE_TRAMPOLINE
401
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                       \
402
{                                                                       \
403
  emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 10)), CXT); \
404
  emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 14)), FNADDR); \
405
}
406
 
407
 
408
/* XXX
409
   This is the end of the chunk lifted from m68kv4.h  */

powered by: WebSVN 2.1.0

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