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