Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/elfos.h @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* elfos.h -- operating system specific defines to be used when | 1 /* elfos.h -- operating system specific defines to be used when |
2 targeting GCC for some generic ELF system | 2 targeting GCC for some generic ELF system |
3 Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, | 3 Copyright (C) 1991-2017 Free Software Foundation, Inc. |
4 2007, 2009, 2010 Free Software Foundation, Inc. | |
5 Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com). | 4 Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com). |
6 | 5 |
7 This file is part of GCC. | 6 This file is part of GCC. |
8 | 7 |
9 GCC is free software; you can redistribute it and/or modify | 8 GCC is free software; you can redistribute it and/or modify |
81 #define OBJECT_FORMAT_ELF | 80 #define OBJECT_FORMAT_ELF |
82 | 81 |
83 | 82 |
84 /* Output #ident as a .ident. */ | 83 /* Output #ident as a .ident. */ |
85 | 84 |
86 #define ASM_OUTPUT_IDENT(FILE, NAME) \ | 85 #undef TARGET_ASM_OUTPUT_IDENT |
87 fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME); | 86 #define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive |
88 | |
89 #define IDENT_ASM_OP "\t.ident\t" | |
90 | 87 |
91 #undef SET_ASM_OP | 88 #undef SET_ASM_OP |
92 #define SET_ASM_OP "\t.set\t" | 89 #define SET_ASM_OP "\t.set\t" |
93 | 90 |
94 /* Most svr4 assemblers want a .file directive at the beginning of | 91 /* Most svr4 assemblers want a .file directive at the beginning of |
100 | 97 |
101 #define SKIP_ASM_OP "\t.zero\t" | 98 #define SKIP_ASM_OP "\t.zero\t" |
102 | 99 |
103 #undef ASM_OUTPUT_SKIP | 100 #undef ASM_OUTPUT_SKIP |
104 #define ASM_OUTPUT_SKIP(FILE, SIZE) \ | 101 #define ASM_OUTPUT_SKIP(FILE, SIZE) \ |
105 fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\ | 102 fprintf ((FILE), "%s" HOST_WIDE_INT_PRINT_UNSIGNED "\n",\ |
106 SKIP_ASM_OP, (SIZE)) | 103 SKIP_ASM_OP, (SIZE)) |
107 | 104 |
108 /* This is how to store into the string LABEL | 105 /* This is how to store into the string LABEL |
109 the symbol_ref name of an internal numbered label where | 106 the symbol_ref name of an internal numbered label where |
110 PREFIX is the class of label and NUM is the number within the class. | 107 PREFIX is the class of label and NUM is the number within the class. |
115 | 112 |
116 #undef ASM_GENERATE_INTERNAL_LABEL | 113 #undef ASM_GENERATE_INTERNAL_LABEL |
117 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ | 114 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ |
118 do \ | 115 do \ |
119 { \ | 116 { \ |
120 sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM)); \ | 117 char *__p; \ |
118 (LABEL)[0] = '*'; \ | |
119 (LABEL)[1] = '.'; \ | |
120 __p = stpcpy (&(LABEL)[2], PREFIX); \ | |
121 sprint_ul (__p, (unsigned long) (NUM)); \ | |
121 } \ | 122 } \ |
122 while (0) | 123 while (0) |
123 | 124 |
124 /* Output the label which precedes a jumptable. Note that for all svr4 | 125 /* Output the label which precedes a jumptable. Note that for all svr4 |
125 systems where we actually generate jumptables (which is to say every | 126 systems where we actually generate jumptables (which is to say every |
164 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ | 165 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ |
165 do \ | 166 do \ |
166 { \ | 167 { \ |
167 fprintf ((FILE), "%s", COMMON_ASM_OP); \ | 168 fprintf ((FILE), "%s", COMMON_ASM_OP); \ |
168 assemble_name ((FILE), (NAME)); \ | 169 assemble_name ((FILE), (NAME)); \ |
169 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ | 170 fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", \ |
170 (SIZE), (ALIGN) / BITS_PER_UNIT); \ | 171 (SIZE), (ALIGN) / BITS_PER_UNIT); \ |
171 } \ | 172 } \ |
172 while (0) | 173 while (0) |
173 | 174 |
174 /* This says how to output assembler code to declare an | 175 /* This says how to output assembler code to declare an |
281 ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \ | 282 ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \ |
282 } \ | 283 } \ |
283 while (0) | 284 while (0) |
284 #endif | 285 #endif |
285 | 286 |
287 /* Write the extra assembler code needed to declare the name of a | |
288 cold function partition properly. Some svr4 assemblers need to also | |
289 have something extra said about the function's return value. We | |
290 allow for that here. */ | |
291 | |
292 #ifndef ASM_DECLARE_COLD_FUNCTION_NAME | |
293 #define ASM_DECLARE_COLD_FUNCTION_NAME(FILE, NAME, DECL) \ | |
294 do \ | |
295 { \ | |
296 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ | |
297 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ | |
298 ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \ | |
299 } \ | |
300 while (0) | |
301 #endif | |
302 | |
286 /* Write the extra assembler code needed to declare an object properly. */ | 303 /* Write the extra assembler code needed to declare an object properly. */ |
287 | 304 |
288 #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT | 305 #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT |
289 #define USE_GNU_UNIQUE_OBJECT 1 | 306 #define USE_GNU_UNIQUE_OBJECT flag_gnu_unique |
290 #else | 307 #else |
291 #define USE_GNU_UNIQUE_OBJECT 0 | 308 #define USE_GNU_UNIQUE_OBJECT 0 |
292 #endif | 309 #endif |
293 | 310 |
294 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ | 311 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ |
310 size_directive_output = 0; \ | 327 size_directive_output = 0; \ |
311 if (!flag_inhibit_size_directive \ | 328 if (!flag_inhibit_size_directive \ |
312 && (DECL) && DECL_SIZE (DECL)) \ | 329 && (DECL) && DECL_SIZE (DECL)) \ |
313 { \ | 330 { \ |
314 size_directive_output = 1; \ | 331 size_directive_output = 1; \ |
315 size = int_size_in_bytes (TREE_TYPE (DECL)); \ | 332 size = tree_to_uhwi (DECL_SIZE_UNIT (DECL)); \ |
316 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ | 333 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ |
317 } \ | 334 } \ |
318 \ | 335 \ |
319 ASM_OUTPUT_LABEL (FILE, NAME); \ | 336 ASM_OUTPUT_LABEL (FILE, NAME); \ |
320 } \ | 337 } \ |
338 && ! AT_END && TOP_LEVEL \ | 355 && ! AT_END && TOP_LEVEL \ |
339 && DECL_INITIAL (DECL) == error_mark_node \ | 356 && DECL_INITIAL (DECL) == error_mark_node \ |
340 && !size_directive_output) \ | 357 && !size_directive_output) \ |
341 { \ | 358 { \ |
342 size_directive_output = 1; \ | 359 size_directive_output = 1; \ |
343 size = int_size_in_bytes (TREE_TYPE (DECL)); \ | 360 size = tree_to_uhwi (DECL_SIZE_UNIT (DECL)); \ |
344 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ | 361 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ |
345 } \ | 362 } \ |
346 } \ | 363 } \ |
347 while (0) | 364 while (0) |
348 | 365 |
349 /* This is how to declare the size of a function. */ | 366 /* This is how to declare the size of a function. */ |
350 #ifndef ASM_DECLARE_FUNCTION_SIZE | 367 #ifndef ASM_DECLARE_FUNCTION_SIZE |
351 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ | 368 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ |
369 do \ | |
370 { \ | |
371 if (!flag_inhibit_size_directive) \ | |
372 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ | |
373 } \ | |
374 while (0) | |
375 #endif | |
376 | |
377 /* This is how to declare the size of a cold function partition. */ | |
378 #ifndef ASM_DECLARE_COLD_FUNCTION_SIZE | |
379 #define ASM_DECLARE_COLD_FUNCTION_SIZE(FILE, FNAME, DECL) \ | |
352 do \ | 380 do \ |
353 { \ | 381 { \ |
354 if (!flag_inhibit_size_directive) \ | 382 if (!flag_inhibit_size_directive) \ |
355 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ | 383 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ |
356 } \ | 384 } \ |
369 sequences for many control characters, but we don't use | 397 sequences for many control characters, but we don't use |
370 \a to represent BEL because some svr4 assemblers (e.g. on | 398 \a to represent BEL because some svr4 assemblers (e.g. on |
371 the i386) don't know about that. Also, we don't use \v | 399 the i386) don't know about that. Also, we don't use \v |
372 since some versions of gas, such as 2.2 did not accept it. */ | 400 since some versions of gas, such as 2.2 did not accept it. */ |
373 | 401 |
374 #define ESCAPES \ | 402 #define ELF_ASCII_ESCAPES \ |
375 "\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\ | 403 "\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\ |
376 \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\ | 404 \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\ |
377 \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\ | 405 \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\ |
378 \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\ | 406 \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\ |
379 \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\ | 407 \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\ |
391 | 419 |
392 If your target assembler doesn't support the .string directive, you | 420 If your target assembler doesn't support the .string directive, you |
393 should define this to zero. | 421 should define this to zero. |
394 */ | 422 */ |
395 | 423 |
396 #define STRING_LIMIT ((unsigned) 256) | 424 #define ELF_STRING_LIMIT ((unsigned) 256) |
397 | 425 |
398 #define STRING_ASM_OP "\t.string\t" | 426 #define STRING_ASM_OP "\t.string\t" |
399 | 427 |
400 /* The routine used to output NUL terminated strings. We use a special | 428 /* The routine used to output NUL terminated strings. We use a special |
401 version of this for most svr4 targets because doing so makes the | 429 version of this for most svr4 targets because doing so makes the |
403 as well as more readable, especially for targets like the i386 | 431 as well as more readable, especially for targets like the i386 |
404 (where the only alternative is to output character sequences as | 432 (where the only alternative is to output character sequences as |
405 comma separated lists of numbers). */ | 433 comma separated lists of numbers). */ |
406 | 434 |
407 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ | 435 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ |
408 do \ | 436 default_elf_asm_output_limited_string ((FILE), (STR)) |
409 { \ | |
410 register const unsigned char *_limited_str = \ | |
411 (const unsigned char *) (STR); \ | |
412 register unsigned ch; \ | |
413 \ | |
414 fprintf ((FILE), "%s\"", STRING_ASM_OP); \ | |
415 \ | |
416 for (; (ch = *_limited_str); _limited_str++) \ | |
417 { \ | |
418 register int escape; \ | |
419 \ | |
420 switch (escape = ESCAPES[ch]) \ | |
421 { \ | |
422 case 0: \ | |
423 putc (ch, (FILE)); \ | |
424 break; \ | |
425 case 1: \ | |
426 fprintf ((FILE), "\\%03o", ch); \ | |
427 break; \ | |
428 default: \ | |
429 putc ('\\', (FILE)); \ | |
430 putc (escape, (FILE)); \ | |
431 break; \ | |
432 } \ | |
433 } \ | |
434 \ | |
435 fprintf ((FILE), "\"\n"); \ | |
436 } \ | |
437 while (0) | |
438 | 437 |
439 /* The routine used to output sequences of byte values. We use a special | 438 /* The routine used to output sequences of byte values. We use a special |
440 version of this for most svr4 targets because doing so makes the | 439 version of this for most svr4 targets because doing so makes the |
441 generated assembly code more compact (and thus faster to assemble) | 440 generated assembly code more compact (and thus faster to assemble) |
442 as well as more readable. Note that if we find subparts of the | 441 as well as more readable. Note that if we find subparts of the |
443 character sequence which end with NUL (and which are shorter than | 442 character sequence which end with NUL (and which are shorter than |
444 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ | 443 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ |
445 | 444 |
446 #undef ASM_OUTPUT_ASCII | 445 #undef ASM_OUTPUT_ASCII |
447 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ | 446 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ |
448 do \ | 447 default_elf_asm_output_ascii ((FILE), (STR), (LENGTH)); |
449 { \ | |
450 const unsigned char *_ascii_bytes = \ | |
451 (const unsigned char *) (STR); \ | |
452 const unsigned char *limit = _ascii_bytes + (LENGTH); \ | |
453 const unsigned char *last_null = NULL; \ | |
454 unsigned bytes_in_chunk = 0; \ | |
455 \ | |
456 for (; _ascii_bytes < limit; _ascii_bytes++) \ | |
457 { \ | |
458 const unsigned char *p; \ | |
459 \ | |
460 if (bytes_in_chunk >= 60) \ | |
461 { \ | |
462 fprintf ((FILE), "\"\n"); \ | |
463 bytes_in_chunk = 0; \ | |
464 } \ | |
465 \ | |
466 if (_ascii_bytes > last_null) \ | |
467 { \ | |
468 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ | |
469 continue; \ | |
470 last_null = p; \ | |
471 } \ | |
472 else \ | |
473 p = last_null; \ | |
474 \ | |
475 if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \ | |
476 { \ | |
477 if (bytes_in_chunk > 0) \ | |
478 { \ | |
479 fprintf ((FILE), "\"\n"); \ | |
480 bytes_in_chunk = 0; \ | |
481 } \ | |
482 \ | |
483 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ | |
484 _ascii_bytes = p; \ | |
485 } \ | |
486 else \ | |
487 { \ | |
488 register int escape; \ | |
489 register unsigned ch; \ | |
490 \ | |
491 if (bytes_in_chunk == 0) \ | |
492 fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \ | |
493 \ | |
494 switch (escape = ESCAPES[ch = *_ascii_bytes]) \ | |
495 { \ | |
496 case 0: \ | |
497 putc (ch, (FILE)); \ | |
498 bytes_in_chunk++; \ | |
499 break; \ | |
500 case 1: \ | |
501 fprintf ((FILE), "\\%03o", ch); \ | |
502 bytes_in_chunk += 4; \ | |
503 break; \ | |
504 default: \ | |
505 putc ('\\', (FILE)); \ | |
506 putc (escape, (FILE)); \ | |
507 bytes_in_chunk += 2; \ | |
508 break; \ | |
509 } \ | |
510 } \ | |
511 } \ | |
512 \ | |
513 if (bytes_in_chunk > 0) \ | |
514 fprintf ((FILE), "\"\n"); \ | |
515 } \ | |
516 while (0) | |
517 | 448 |
518 /* Allow the use of the -frecord-gcc-switches switch via the | 449 /* Allow the use of the -frecord-gcc-switches switch via the |
519 elf_record_gcc_switches function defined in varasm.c. */ | 450 elf_record_gcc_switches function defined in varasm.c. */ |
520 #undef TARGET_ASM_RECORD_GCC_SWITCHES | 451 #undef TARGET_ASM_RECORD_GCC_SWITCHES |
521 #define TARGET_ASM_RECORD_GCC_SWITCHES elf_record_gcc_switches | 452 #define TARGET_ASM_RECORD_GCC_SWITCHES elf_record_gcc_switches |
527 | 458 |
528 #ifndef ASM_OUTPUT_EXTERNAL | 459 #ifndef ASM_OUTPUT_EXTERNAL |
529 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ | 460 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ |
530 default_elf_asm_output_external (FILE, DECL, NAME) | 461 default_elf_asm_output_external (FILE, DECL, NAME) |
531 #endif | 462 #endif |
463 | |
464 #undef TARGET_LIBC_HAS_FUNCTION | |
465 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function |