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