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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [elfos.h] - Blame information for rev 820

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

Line No. Rev Author Line
1 38 julius
/* elfos.h  --  operating system specific defines to be used when
2
   targeting GCC for some generic ELF system
3
   Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004,
4
   2007 Free Software Foundation, Inc.
5
   Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
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
<http://www.gnu.org/licenses/>.  */
22
 
23
#define TARGET_OBJFMT_CPP_BUILTINS()            \
24
  do                                            \
25
    {                                           \
26
        builtin_define ("__ELF__");             \
27
    }                                           \
28
  while (0)
29
 
30
/* Define a symbol indicating that we are using elfos.h.
31
   Some CPU specific configuration files use this.  */
32
#define USING_ELFOS_H
33
 
34
/* The prefix to add to user-visible assembler symbols.
35
 
36
   For ELF systems the convention is *not* to prepend a leading
37
   underscore onto user-level symbol names.  */
38
 
39
#undef  USER_LABEL_PREFIX
40
#define USER_LABEL_PREFIX ""
41
 
42
/* Biggest alignment supported by the object file format of this
43
   machine.  Use this macro to limit the alignment which can be
44
   specified using the `__attribute__ ((aligned (N)))' construct.  If
45
   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
46
#ifndef MAX_OFILE_ALIGNMENT
47
#define MAX_OFILE_ALIGNMENT (32768 * 8)
48
#endif
49
 
50
/* Use periods rather than dollar signs in special g++ assembler names.  */
51
 
52
#define NO_DOLLAR_IN_LABEL
53
 
54
/* Writing `int' for a bit-field forces int alignment for the structure.  */
55
 
56
#ifndef PCC_BITFIELD_TYPE_MATTERS
57
#define PCC_BITFIELD_TYPE_MATTERS 1
58
#endif
59
 
60
/* Handle #pragma weak and #pragma pack.  */
61
 
62
#define HANDLE_SYSV_PRAGMA 1
63
 
64
/* All ELF targets can support DWARF-2.  */
65
 
66
#define DWARF2_DEBUGGING_INFO 1
67
 
68
/* The GNU tools operate better with dwarf2, and it is required by some
69
   psABI's.  Since we don't have any native tools to be compatible with,
70
   default to dwarf2.  */
71
 
72
#ifndef PREFERRED_DEBUGGING_TYPE
73
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
74
#endif
75
 
76
/* All SVR4 targets use the ELF object file format.  */
77
#define OBJECT_FORMAT_ELF
78
 
79
 
80
/* Output #ident as a .ident.  */
81
 
82
#define ASM_OUTPUT_IDENT(FILE, NAME) \
83
  fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
84
 
85
#define IDENT_ASM_OP "\t.ident\t"
86
 
87
#undef  SET_ASM_OP
88
#define SET_ASM_OP      "\t.set\t"
89
 
90
/* Most svr4 assemblers want a .file directive at the beginning of
91
   their input file.  */
92
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
93
 
94
/* This is how to allocate empty space in some section.  The .zero
95
   pseudo-op is used for this on most svr4 assemblers.  */
96
 
97
#define SKIP_ASM_OP     "\t.zero\t"
98
 
99
#undef  ASM_OUTPUT_SKIP
100
#define ASM_OUTPUT_SKIP(FILE, SIZE) \
101
   fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
102
            SKIP_ASM_OP, (SIZE))
103
 
104
/* This is how to store into the string LABEL
105
   the symbol_ref name of an internal numbered label where
106
   PREFIX is the class of label and NUM is the number within the class.
107
   This is suitable for output with `assemble_name'.
108
 
109
   For most svr4 systems, the convention is that any symbol which begins
110
   with a period is not put into the linker symbol table by the assembler.  */
111
 
112
#undef  ASM_GENERATE_INTERNAL_LABEL
113
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)         \
114
  do                                                            \
115
    {                                                           \
116
      sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM));      \
117
    }                                                           \
118
  while (0)
119
 
120
/* Output the label which precedes a jumptable.  Note that for all svr4
121
   systems where we actually generate jumptables (which is to say every
122
   svr4 target except i386, where we use casesi instead) we put the jump-
123
   tables into the .rodata section and since other stuff could have been
124
   put into the .rodata section prior to any given jumptable, we have to
125
   make sure that the location counter for the .rodata section gets pro-
126
   perly re-aligned prior to the actual beginning of the jump table.  */
127
 
128
#undef ALIGN_ASM_OP
129
#define ALIGN_ASM_OP "\t.align\t"
130
 
131
#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
132
#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
133
  ASM_OUTPUT_ALIGN ((FILE), 2);
134
#endif
135
 
136
#undef  ASM_OUTPUT_CASE_LABEL
137
#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)             \
138
  do                                                                    \
139
    {                                                                   \
140
      ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE)       \
141
        (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM);                  \
142
    }                                                                   \
143
  while (0)
144
 
145
/* The standard SVR4 assembler seems to require that certain builtin
146
   library routines (e.g. .udiv) be explicitly declared as .globl
147
   in each assembly file where they are referenced.  */
148
 
149
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)  \
150
  (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
151
 
152
/* This says how to output assembler code to declare an
153
   uninitialized external linkage data object.  Under SVR4,
154
   the linker seems to want the alignment of data objects
155
   to depend on their types.  We do exactly that here.  */
156
 
157
#define COMMON_ASM_OP   "\t.comm\t"
158
 
159
#undef  ASM_OUTPUT_ALIGNED_COMMON
160
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)              \
161
  do                                                                    \
162
    {                                                                   \
163
      fprintf ((FILE), "%s", COMMON_ASM_OP);                            \
164
      assemble_name ((FILE), (NAME));                                   \
165
      fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",          \
166
               (SIZE), (ALIGN) / BITS_PER_UNIT);                        \
167
    }                                                                   \
168
  while (0)
169
 
170
/* This says how to output assembler code to declare an
171
   uninitialized internal linkage data object.  Under SVR4,
172
   the linker seems to want the alignment of data objects
173
   to depend on their types.  We do exactly that here.  */
174
 
175
#define LOCAL_ASM_OP    "\t.local\t"
176
 
177
#undef  ASM_OUTPUT_ALIGNED_LOCAL
178
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)       \
179
  do                                                            \
180
    {                                                           \
181
      fprintf ((FILE), "%s", LOCAL_ASM_OP);                     \
182
      assemble_name ((FILE), (NAME));                           \
183
      fprintf ((FILE), "\n");                                   \
184
      ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);      \
185
    }                                                           \
186
  while (0)
187
 
188
/* This is the pseudo-op used to generate a contiguous sequence of byte
189
   values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
190
   AUTOMATICALLY APPENDED.  This is the same for most svr4 assemblers.  */
191
 
192
#undef  ASCII_DATA_ASM_OP
193
#define ASCII_DATA_ASM_OP       "\t.ascii\t"
194
 
195
/* Support a read-only data section.  */
196
#define READONLY_DATA_SECTION_ASM_OP    "\t.section\t.rodata"
197
 
198
/* On svr4, we *do* have support for the .init and .fini sections, and we
199
   can put stuff in there to be executed before and after `main'.  We let
200
   crtstuff.c and other files know this by defining the following symbols.
201
   The definitions say how to change sections to the .init and .fini
202
   sections.  This is the same for all known svr4 assemblers.  */
203
 
204
#define INIT_SECTION_ASM_OP     "\t.section\t.init"
205
#define FINI_SECTION_ASM_OP     "\t.section\t.fini"
206
 
207
/* Output assembly directive to move to the beginning of current section.  */
208
#ifdef HAVE_GAS_SUBSECTION_ORDERING
209
# define ASM_SECTION_START_OP   "\t.subsection\t-1"
210
# define ASM_OUTPUT_SECTION_START(FILE) \
211
  fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
212
#endif
213
 
214
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
215
 
216
/* Switch into a generic section.  */
217
#define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
218
 
219
#undef  TARGET_ASM_SELECT_RTX_SECTION
220
#define TARGET_ASM_SELECT_RTX_SECTION default_elf_select_rtx_section
221
#undef  TARGET_ASM_SELECT_SECTION
222
#define TARGET_ASM_SELECT_SECTION default_elf_select_section
223
#undef  TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
224
#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS true
225
 
226
/* Define the strings used for the special svr4 .type and .size directives.
227
   These strings generally do not vary from one system running svr4 to
228
   another, but if a given system (e.g. m88k running svr) needs to use
229
   different pseudo-op names for these, they may be overridden in the
230
   file which includes this one.  */
231
 
232
#define TYPE_ASM_OP     "\t.type\t"
233
#define SIZE_ASM_OP     "\t.size\t"
234
 
235
/* This is how we tell the assembler that a symbol is weak.  */
236
 
237
#define ASM_WEAKEN_LABEL(FILE, NAME)    \
238
  do                                    \
239
    {                                   \
240
      fputs ("\t.weak\t", (FILE));      \
241
      assemble_name ((FILE), (NAME));   \
242
      fputc ('\n', (FILE));             \
243
    }                                   \
244
  while (0)
245
 
246
/* The following macro defines the format used to output the second
247
   operand of the .type assembler directive.  Different svr4 assemblers
248
   expect various different forms for this operand.  The one given here
249
   is just a default.  You may need to override it in your machine-
250
   specific tm.h file (depending upon the particulars of your assembler).  */
251
 
252
#define TYPE_OPERAND_FMT        "@%s"
253
 
254
/* Write the extra assembler code needed to declare a function's result.
255
   Most svr4 assemblers don't require any special declaration of the
256
   result value, but there are exceptions.  */
257
 
258
#ifndef ASM_DECLARE_RESULT
259
#define ASM_DECLARE_RESULT(FILE, RESULT)
260
#endif
261
 
262
/* These macros generate the special .type and .size directives which
263
   are used to set the corresponding fields of the linker symbol table
264
   entries in an ELF object file under SVR4.  These macros also output
265
   the starting labels for the relevant functions/objects.  */
266
 
267
/* Write the extra assembler code needed to declare a function properly.
268
   Some svr4 assemblers need to also have something extra said about the
269
   function's return value.  We allow for that here.  */
270
 
271
#ifndef ASM_DECLARE_FUNCTION_NAME
272
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)             \
273
  do                                                            \
274
    {                                                           \
275
      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");       \
276
      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));            \
277
      ASM_OUTPUT_LABEL (FILE, NAME);                            \
278
    }                                                           \
279
  while (0)
280
#endif
281
 
282
/* Write the extra assembler code needed to declare an object properly.  */
283
 
284
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)               \
285
  do                                                            \
286
    {                                                           \
287
      HOST_WIDE_INT size;                                       \
288
                                                                \
289
      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");         \
290
                                                                \
291
      size_directive_output = 0;                         \
292
      if (!flag_inhibit_size_directive                          \
293
          && (DECL) && DECL_SIZE (DECL))                        \
294
        {                                                       \
295
          size_directive_output = 1;                            \
296
          size = int_size_in_bytes (TREE_TYPE (DECL));          \
297
          ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);         \
298
        }                                                       \
299
                                                                \
300
      ASM_OUTPUT_LABEL (FILE, NAME);                            \
301
    }                                                           \
302
  while (0)
303
 
304
/* Output the size directive for a decl in rest_of_decl_compilation
305
   in the case where we did not do so before the initializer.
306
   Once we find the error_mark_node, we know that the value of
307
   size_directive_output was set
308
   by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
309
 
310
#undef ASM_FINISH_DECLARE_OBJECT
311
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
312
  do                                                            \
313
    {                                                           \
314
      const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);     \
315
      HOST_WIDE_INT size;                                       \
316
                                                                \
317
      if (!flag_inhibit_size_directive                          \
318
          && DECL_SIZE (DECL)                                   \
319
          && ! AT_END && TOP_LEVEL                              \
320
          && DECL_INITIAL (DECL) == error_mark_node             \
321
          && !size_directive_output)                            \
322
        {                                                       \
323
          size_directive_output = 1;                            \
324
          size = int_size_in_bytes (TREE_TYPE (DECL));          \
325
          ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size);         \
326
        }                                                       \
327
    }                                                           \
328
  while (0)
329
 
330
/* This is how to declare the size of a function.  */
331
#ifndef ASM_DECLARE_FUNCTION_SIZE
332
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)            \
333
  do                                                            \
334
    {                                                           \
335
      if (!flag_inhibit_size_directive)                         \
336
        ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);                 \
337
    }                                                           \
338
  while (0)
339
#endif
340
 
341
/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
342
   ASM_OUTPUT_LIMITED_STRING macros.  Each byte in the table
343
   corresponds to a particular byte value [0..255].  For any
344
   given byte value, if the value in the corresponding table
345
   position is zero, the given character can be output directly.
346
   If the table value is 1, the byte must be output as a \ooo
347
   octal escape.  If the tables value is anything else, then the
348
   byte value should be output as a \ followed by the value
349
   in the table.  Note that we can use standard UN*X escape
350
   sequences for many control characters, but we don't use
351
   \a to represent BEL because some svr4 assemblers (e.g. on
352
   the i386) don't know about that.  Also, we don't use \v
353
   since some versions of gas, such as 2.2 did not accept it.  */
354
 
355
#define ESCAPES \
356
"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
357
\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
358
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
359
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
360
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
361
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
362
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
363
\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
364
 
365
/* Some svr4 assemblers have a limit on the number of characters which
366
   can appear in the operand of a .string directive.  If your assembler
367
   has such a limitation, you should define STRING_LIMIT to reflect that
368
   limit.  Note that at least some svr4 assemblers have a limit on the
369
   actual number of bytes in the double-quoted string, and that they
370
   count each character in an escape sequence as one byte.  Thus, an
371
   escape sequence like \377 would count as four bytes.
372
 
373
   If your target assembler doesn't support the .string directive, you
374
   should define this to zero.
375
*/
376
 
377
#define STRING_LIMIT    ((unsigned) 256)
378
 
379
#define STRING_ASM_OP   "\t.string\t"
380
 
381
/* The routine used to output NUL terminated strings.  We use a special
382
   version of this for most svr4 targets because doing so makes the
383
   generated assembly code more compact (and thus faster to assemble)
384
   as well as more readable, especially for targets like the i386
385
   (where the only alternative is to output character sequences as
386
   comma separated lists of numbers).  */
387
 
388
#define ASM_OUTPUT_LIMITED_STRING(FILE, STR)            \
389
  do                                                    \
390
    {                                                   \
391
      register const unsigned char *_limited_str =      \
392
        (const unsigned char *) (STR);                  \
393
      register unsigned ch;                             \
394
                                                        \
395
      fprintf ((FILE), "%s\"", STRING_ASM_OP);          \
396
                                                        \
397
      for (; (ch = *_limited_str); _limited_str++)      \
398
        {                                               \
399
          register int escape;                          \
400
                                                        \
401
          switch (escape = ESCAPES[ch])                 \
402
            {                                           \
403
            case 0:                                      \
404
              putc (ch, (FILE));                        \
405
              break;                                    \
406
            case 1:                                     \
407
              fprintf ((FILE), "\\%03o", ch);           \
408
              break;                                    \
409
            default:                                    \
410
              putc ('\\', (FILE));                      \
411
              putc (escape, (FILE));                    \
412
              break;                                    \
413
            }                                           \
414
        }                                               \
415
                                                        \
416
      fprintf ((FILE), "\"\n");                         \
417
    }                                                   \
418
  while (0)
419
 
420
/* The routine used to output sequences of byte values.  We use a special
421
   version of this for most svr4 targets because doing so makes the
422
   generated assembly code more compact (and thus faster to assemble)
423
   as well as more readable.  Note that if we find subparts of the
424
   character sequence which end with NUL (and which are shorter than
425
   STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
426
 
427
#undef  ASM_OUTPUT_ASCII
428
#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
429
  do                                                                    \
430
    {                                                                   \
431
      const unsigned char *_ascii_bytes =                               \
432
        (const unsigned char *) (STR);                                  \
433
      const unsigned char *limit = _ascii_bytes + (LENGTH);             \
434
      const unsigned char *last_null = NULL;                            \
435
      unsigned bytes_in_chunk = 0;                                       \
436
                                                                        \
437
      for (; _ascii_bytes < limit; _ascii_bytes++)                      \
438
        {                                                               \
439
          const unsigned char *p;                                       \
440
                                                                        \
441
          if (bytes_in_chunk >= 60)                                     \
442
            {                                                           \
443
              fprintf ((FILE), "\"\n");                                 \
444
              bytes_in_chunk = 0;                                        \
445
            }                                                           \
446
                                                                        \
447
          if (_ascii_bytes > last_null)                                 \
448
            {                                                           \
449
              for (p = _ascii_bytes; p < limit && *p != '\0'; p++)      \
450
                continue;                                               \
451
              last_null = p;                                            \
452
            }                                                           \
453
          else                                                          \
454
            p = last_null;                                              \
455
                                                                        \
456
          if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT)    \
457
            {                                                           \
458
              if (bytes_in_chunk > 0)                                    \
459
                {                                                       \
460
                  fprintf ((FILE), "\"\n");                             \
461
                  bytes_in_chunk = 0;                                    \
462
                }                                                       \
463
                                                                        \
464
              ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
465
              _ascii_bytes = p;                                         \
466
            }                                                           \
467
          else                                                          \
468
            {                                                           \
469
              register int escape;                                      \
470
              register unsigned ch;                                     \
471
                                                                        \
472
              if (bytes_in_chunk == 0)                                   \
473
                fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP);            \
474
                                                                        \
475
              switch (escape = ESCAPES[ch = *_ascii_bytes])             \
476
                {                                                       \
477
                case 0:                                                  \
478
                  putc (ch, (FILE));                                    \
479
                  bytes_in_chunk++;                                     \
480
                  break;                                                \
481
                case 1:                                                 \
482
                  fprintf ((FILE), "\\%03o", ch);                       \
483
                  bytes_in_chunk += 4;                                  \
484
                  break;                                                \
485
                default:                                                \
486
                  putc ('\\', (FILE));                                  \
487
                  putc (escape, (FILE));                                \
488
                  bytes_in_chunk += 2;                                  \
489
                  break;                                                \
490
                }                                                       \
491
            }                                                           \
492
        }                                                               \
493
                                                                        \
494
      if (bytes_in_chunk > 0)                                            \
495
        fprintf ((FILE), "\"\n");                                       \
496
    }                                                                   \
497
  while (0)

powered by: WebSVN 2.1.0

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