1/* 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 Free Software Foundation, Inc. 4 Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com). 5 6This file is part of GNU CC. 7 8GNU CC is free software; you can redistribute it and/or modify 9it under the terms of the GNU General Public License as published by 10the Free Software Foundation; either version 2, or (at your option) 11any later version. 12 13GNU CC is distributed in the hope that it will be useful, 14but WITHOUT ANY WARRANTY; without even the implied warranty of 15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16GNU General Public License for more details. 17 18You should have received a copy of the GNU General Public License 19along with GNU CC; see the file COPYING. If not, write to 20the Free Software Foundation, 59 Temple Place - Suite 330, 21Boston, MA 02111-1307, USA. */ 22 23/* For the sake of libgcc2.c, indicate target supports atexit. */ 24#define HAVE_ATEXIT 25 26#undef ENDFILE_SPEC 27#define ENDFILE_SPEC "crtend.o%s" 28 29#undef STARTFILE_SPEC 30#define STARTFILE_SPEC "%{!shared: \ 31 %{!symbolic: \ 32 %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\ 33 crtbegin.o%s" 34 35/* Attach a special .ident directive to the end of the file to identify 36 the version of GCC which compiled this code. The format of the 37 .ident string is patterned after the ones produced by native svr4 38 C compilers. */ 39 40#define IDENT_ASM_OP ".ident" 41 42#define ASM_FILE_END(FILE) \ 43do { \ 44 if (!flag_no_ident) \ 45 fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ 46 IDENT_ASM_OP, version_string); \ 47 } while (0) 48 49/* Output #ident as a .ident. */ 50 51#define ASM_OUTPUT_IDENT(FILE, NAME) \ 52 fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); 53 54/* Use periods rather than dollar signs in special g++ assembler names. */ 55 56#define NO_DOLLAR_IN_LABEL 57 58/* Writing `int' for a bitfield forces int alignment for the structure. */ 59 60#define PCC_BITFIELD_TYPE_MATTERS 1 61 62/* Implicit library calls should use memcpy, not bcopy, etc. */ 63 64#define TARGET_MEM_FUNCTIONS 65 66/* Handle #pragma weak and #pragma pack. */ 67 68#define HANDLE_SYSV_PRAGMA 69 70/* System V Release 4 uses DWARF debugging info. */ 71 72#define DWARF_DEBUGGING_INFO 73 74/* All ELF targets can support DWARF-2. */ 75 76#define DWARF2_DEBUGGING_INFO 77 78/* Also allow them to support STABS debugging. */ 79 80#include "dbxelf.h" 81 82/* The GNU tools operate better with stabs. Since we don't have 83 any native tools to be compatible with, default to stabs. */ 84 85#ifndef PREFERRED_DEBUGGING_TYPE 86#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG 87#endif 88 89#undef ASM_BYTE_OP 90#define ASM_BYTE_OP ".byte" 91 92#undef SET_ASM_OP 93#define SET_ASM_OP ".set" 94 95/* This is how to begin an assembly language file. Most svr4 assemblers want 96 at least a .file directive to come first, and some want to see a .version 97 directive come right after that. Here we just establish a default 98 which generates only the .file directive. If you need a .version 99 directive for any specific target, you should override this definition 100 in the target-specific file which includes this one. */ 101 102#undef ASM_FILE_START 103#define ASM_FILE_START(FILE) \ 104 output_file_directive ((FILE), main_input_filename) 105 106/* This is how to allocate empty space in some section. The .zero 107 pseudo-op is used for this on most svr4 assemblers. */ 108 109#define SKIP_ASM_OP ".zero" 110 111#undef ASM_OUTPUT_SKIP 112#define ASM_OUTPUT_SKIP(FILE,SIZE) \ 113 fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE)) 114 115/* This is how to output a reference to a user-level label named NAME. 116 `assemble_name' uses this. 117 118 For System V Release 4 the convention is *not* to prepend a leading 119 underscore onto user-level symbol names. */ 120 121#undef ASM_OUTPUT_LABELREF 122#define ASM_OUTPUT_LABELREF(FILE,NAME) fprintf (FILE, "%s", NAME) 123 124/* This is how to output an internal numbered label where 125 PREFIX is the class of label and NUM is the number within the class. 126 127 For most svr4 systems, the convention is that any symbol which begins 128 with a period is not put into the linker symbol table by the assembler. */ 129 130#undef ASM_OUTPUT_INTERNAL_LABEL 131#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ 132do { \ 133 fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \ 134} while (0) 135 136/* This is how to store into the string LABEL 137 the symbol_ref name of an internal numbered label where 138 PREFIX is the class of label and NUM is the number within the class. 139 This is suitable for output with `assemble_name'. 140 141 For most svr4 systems, the convention is that any symbol which begins 142 with a period is not put into the linker symbol table by the assembler. */ 143 144#undef ASM_GENERATE_INTERNAL_LABEL 145#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ 146do { \ 147 sprintf (LABEL, "*.%s%d", PREFIX, NUM); \ 148} while (0) 149 150/* Output the label which precedes a jumptable. Note that for all svr4 151 systems where we actually generate jumptables (which is to say every 152 svr4 target except i386, where we use casesi instead) we put the jump- 153 tables into the .rodata section and since other stuff could have been 154 put into the .rodata section prior to any given jumptable, we have to 155 make sure that the location counter for the .rodata section gets pro- 156 perly re-aligned prior to the actual beginning of the jump table. */ 157 158#define ALIGN_ASM_OP ".align" 159 160#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL 161#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ 162 ASM_OUTPUT_ALIGN ((FILE), 2); 163#endif 164 165#undef ASM_OUTPUT_CASE_LABEL 166#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ 167 do { \ 168 ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ 169 ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ 170 } while (0) 171 172/* The standard SVR4 assembler seems to require that certain builtin 173 library routines (e.g. .udiv) be explicitly declared as .globl 174 in each assembly file where they are referenced. */ 175 176#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ 177 ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) 178 179/* This says how to output assembler code to declare an 180 uninitialized external linkage data object. Under SVR4, 181 the linker seems to want the alignment of data objects 182 to depend on their types. We do exactly that here. */ 183 184#define COMMON_ASM_OP ".comm" 185 186#undef ASM_OUTPUT_ALIGNED_COMMON 187#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ 188do { \ 189 fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ 190 assemble_name ((FILE), (NAME)); \ 191 fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ 192} while (0) 193 194/* This says how to output assembler code to declare an 195 uninitialized internal linkage data object. Under SVR4, 196 the linker seems to want the alignment of data objects 197 to depend on their types. We do exactly that here. */ 198 199#define LOCAL_ASM_OP ".local" 200 201#undef ASM_OUTPUT_ALIGNED_LOCAL 202#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ 203do { \ 204 fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \ 205 assemble_name ((FILE), (NAME)); \ 206 fprintf ((FILE), "\n"); \ 207 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ 208} while (0) 209 210/* This is the pseudo-op used to generate a 32-bit word of data with a 211 specific value in some section. This is the same for all known svr4 212 assemblers. */ 213 214#define INT_ASM_OP ".long" 215 216/* This is the pseudo-op used to generate a contiguous sequence of byte 217 values from a double-quoted string WITHOUT HAVING A TERMINATING NUL 218 AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ 219 220#undef ASCII_DATA_ASM_OP 221#define ASCII_DATA_ASM_OP ".ascii" 222 223/* Support const sections and the ctors and dtors sections for g++. 224 Note that there appears to be two different ways to support const 225 sections at the moment. You can either #define the symbol 226 READONLY_DATA_SECTION (giving it some code which switches to the 227 readonly data section) or else you can #define the symbols 228 EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and 229 SELECT_RTX_SECTION. We do both here just to be on the safe side. */ 230 231#define USE_CONST_SECTION 1 232 233#define CONST_SECTION_ASM_OP ".section\t.rodata" 234 235/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. 236 237 Note that we want to give these sections the SHF_WRITE attribute 238 because these sections will actually contain data (i.e. tables of 239 addresses of functions in the current root executable or shared library 240 file) and, in the case of a shared library, the relocatable addresses 241 will have to be properly resolved/relocated (and then written into) by 242 the dynamic linker when it actually attaches the given shared library 243 to the executing process. (Note that on SVR4, you may wish to use the 244 `-z text' option to the ELF linker, when building a shared library, as 245 an additional check that you are doing everything right. But if you do 246 use the `-z text' option when building a shared library, you will get 247 errors unless the .ctors and .dtors sections are marked as writable 248 via the SHF_WRITE attribute.) */ 249 250#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\"" 251#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" 252 253/* On svr4, we *do* have support for the .init and .fini sections, and we 254 can put stuff in there to be executed before and after `main'. We let 255 crtstuff.c and other files know this by defining the following symbols. 256 The definitions say how to change sections to the .init and .fini 257 sections. This is the same for all known svr4 assemblers. */ 258 259#define INIT_SECTION_ASM_OP ".section\t.init" 260#define FINI_SECTION_ASM_OP ".section\t.fini" 261 262/* A default list of other sections which we might be "in" at any given 263 time. For targets that use additional sections (e.g. .tdesc) you 264 should override this definition in the target-specific file which 265 includes this file. */ 266 267#undef EXTRA_SECTIONS 268#define EXTRA_SECTIONS in_const, in_ctors, in_dtors 269 270/* A default list of extra section function definitions. For targets 271 that use additional sections (e.g. .tdesc) you should override this 272 definition in the target-specific file which includes this file. */ 273 274#undef EXTRA_SECTION_FUNCTIONS 275#define EXTRA_SECTION_FUNCTIONS \ 276 CONST_SECTION_FUNCTION \ 277 CTORS_SECTION_FUNCTION \ 278 DTORS_SECTION_FUNCTION 279 280#define READONLY_DATA_SECTION() const_section () 281 282extern void text_section (); 283 284#define CONST_SECTION_FUNCTION \ 285void \ 286const_section () \ 287{ \ 288 if (!USE_CONST_SECTION) \ 289 text_section(); \ 290 else if (in_section != in_const) \ 291 { \ 292 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ 293 in_section = in_const; \ 294 } \ 295} 296 297#define CTORS_SECTION_FUNCTION \ 298void \ 299ctors_section () \ 300{ \ 301 if (in_section != in_ctors) \ 302 { \ 303 fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ 304 in_section = in_ctors; \ 305 } \ 306} 307 308#define DTORS_SECTION_FUNCTION \ 309void \ 310dtors_section () \ 311{ \ 312 if (in_section != in_dtors) \ 313 { \ 314 fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ 315 in_section = in_dtors; \ 316 } \ 317} 318 319/* Switch into a generic section. 320 This is currently only used to support section attributes. */ 321 322#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ 323do { \ 324 static struct section_info \ 325 { \ 326 struct section_info *next; \ 327 char *name; \ 328 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ 329 } *sections; \ 330 struct section_info *s; \ 331 char *mode; \ 332 enum sect_enum type; \ 333 \ 334 for (s = sections; s; s = s->next) \ 335 if (!strcmp (NAME, s->name)) \ 336 break; \ 337 \ 338 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ 339 type = SECT_EXEC, mode = "ax"; \ 340 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ 341 type = SECT_RO, mode = "a"; \ 342 else \ 343 type = SECT_RW, mode = "aw"; \ 344 \ 345 if (s == 0) \ 346 { \ 347 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ 348 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ 349 strcpy (s->name, NAME); \ 350 s->type = type; \ 351 s->next = sections; \ 352 sections = s; \ 353 fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, mode); \ 354 } \ 355 else \ 356 { \ 357 if (DECL && s->type != type) \ 358 error_with_decl (DECL, "%s causes a section type conflict"); \ 359 \ 360 fprintf (FILE, ".section\t%s\n", NAME); \ 361 } \ 362} while (0) 363 364#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) 365#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL)) 366#define UNIQUE_SECTION(DECL,RELOC) \ 367do { \ 368 int len; \ 369 char *name, *string, *prefix; \ 370 \ 371 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ 372 \ 373 if (! DECL_ONE_ONLY (DECL)) \ 374 { \ 375 if (TREE_CODE (DECL) == FUNCTION_DECL) \ 376 prefix = ".text."; \ 377 else if (DECL_READONLY_SECTION (DECL, RELOC)) \ 378 prefix = ".rodata."; \ 379 else \ 380 prefix = ".data."; \ 381 } \ 382 else if (TREE_CODE (DECL) == FUNCTION_DECL) \ 383 prefix = ".gnu.linkonce.t."; \ 384 else if (DECL_READONLY_SECTION (DECL, RELOC)) \ 385 prefix = ".gnu.linkonce.r."; \ 386 else \ 387 prefix = ".gnu.linkonce.d."; \ 388 \ 389 len = strlen (name) + strlen (prefix); \ 390 string = alloca (len + 1); \ 391 sprintf (string, "%s%s", prefix, name); \ 392 \ 393 DECL_SECTION_NAME (DECL) = build_string (len, string); \ 394} while (0) 395/* A C statement (sans semicolon) to output an element in the table of 396 global constructors. */ 397#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ 398 do { \ 399 ctors_section (); \ 400 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ 401 assemble_name (FILE, NAME); \ 402 fprintf (FILE, "\n"); \ 403 } while (0) 404 405/* A C statement (sans semicolon) to output an element in the table of 406 global destructors. */ 407#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ 408 do { \ 409 dtors_section (); \ 410 fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ 411 assemble_name (FILE, NAME); \ 412 fprintf (FILE, "\n"); \ 413 } while (0) 414 415/* A C statement or statements to switch to the appropriate 416 section for output of DECL. DECL is either a `VAR_DECL' node 417 or a constant of some sort. RELOC indicates whether forming 418 the initial value of DECL requires link-time relocations. */ 419 420#define SELECT_SECTION(DECL,RELOC) \ 421{ \ 422 if (TREE_CODE (DECL) == STRING_CST) \ 423 { \ 424 if (! flag_writable_strings) \ 425 const_section (); \ 426 else \ 427 data_section (); \ 428 } \ 429 else if (TREE_CODE (DECL) == VAR_DECL \ 430 || TREE_CODE (DECL) == CONSTRUCTOR) \ 431 { \ 432 if ((flag_pic && RELOC) \ 433 || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ 434 || !DECL_INITIAL (DECL) \ 435 || (DECL_INITIAL (DECL) != error_mark_node \ 436 && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ 437 data_section (); \ 438 else \ 439 const_section (); \ 440 } \ 441 else \ 442 const_section (); \ 443} 444 445/* A C statement or statements to switch to the appropriate 446 section for output of RTX in mode MODE. RTX is some kind 447 of constant in RTL. The argument MODE is redundant except 448 in the case of a `const_int' rtx. Currently, these always 449 go into the const section. */ 450 451#undef SELECT_RTX_SECTION 452#define SELECT_RTX_SECTION(MODE,RTX) const_section() 453 454/* Define the strings used for the special svr4 .type and .size directives. 455 These strings generally do not vary from one system running svr4 to 456 another, but if a given system (e.g. m88k running svr) needs to use 457 different pseudo-op names for these, they may be overridden in the 458 file which includes this one. */ 459 460#define TYPE_ASM_OP ".type" 461#define SIZE_ASM_OP ".size" 462 463/* This is how we tell the assembler that a symbol is weak. */ 464 465#define ASM_WEAKEN_LABEL(FILE,NAME) \ 466 do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ 467 fputc ('\n', FILE); } while (0) 468 469/* The following macro defines the format used to output the second 470 operand of the .type assembler directive. Different svr4 assemblers 471 expect various different forms for this operand. The one given here 472 is just a default. You may need to override it in your machine- 473 specific tm.h file (depending upon the particulars of your assembler). */ 474 475#define TYPE_OPERAND_FMT "@%s" 476 477/* Write the extra assembler code needed to declare a function's result. 478 Most svr4 assemblers don't require any special declaration of the 479 result value, but there are exceptions. */ 480 481#ifndef ASM_DECLARE_RESULT 482#define ASM_DECLARE_RESULT(FILE, RESULT) 483#endif 484 485/* These macros generate the special .type and .size directives which 486 are used to set the corresponding fields of the linker symbol table 487 entries in an ELF object file under SVR4. These macros also output 488 the starting labels for the relevant functions/objects. */ 489 490/* Write the extra assembler code needed to declare a function properly. 491 Some svr4 assemblers need to also have something extra said about the 492 function's return value. We allow for that here. */ 493 494#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 495 do { \ 496 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 497 assemble_name (FILE, NAME); \ 498 putc (',', FILE); \ 499 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ 500 putc ('\n', FILE); \ 501 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ 502 ASM_OUTPUT_LABEL(FILE, NAME); \ 503 } while (0) 504 505/* Write the extra assembler code needed to declare an object properly. */ 506 507#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 508 do { \ 509 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ 510 assemble_name (FILE, NAME); \ 511 putc (',', FILE); \ 512 fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ 513 putc ('\n', FILE); \ 514 size_directive_output = 0; \ 515 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ 516 { \ 517 size_directive_output = 1; \ 518 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 519 assemble_name (FILE, NAME); \ 520 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 521 } \ 522 ASM_OUTPUT_LABEL(FILE, NAME); \ 523 } while (0) 524 525/* Output the size directive for a decl in rest_of_decl_compilation 526 in the case where we did not do so before the initializer. 527 Once we find the error_mark_node, we know that the value of 528 size_directive_output was set 529 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ 530 531#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ 532do { \ 533 char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 534 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ 535 && ! AT_END && TOP_LEVEL \ 536 && DECL_INITIAL (DECL) == error_mark_node \ 537 && !size_directive_output) \ 538 { \ 539 size_directive_output = 1; \ 540 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 541 assemble_name (FILE, name); \ 542 fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ 543 } \ 544 } while (0) 545 546/* This is how to declare the size of a function. */ 547 548#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ 549 do { \ 550 if (!flag_inhibit_size_directive) \ 551 { \ 552 char label[256]; \ 553 static int labelno; \ 554 labelno++; \ 555 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ 556 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ 557 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ 558 assemble_name (FILE, (FNAME)); \ 559 fprintf (FILE, ","); \ 560 assemble_name (FILE, label); \ 561 fprintf (FILE, "-"); \ 562 assemble_name (FILE, (FNAME)); \ 563 putc ('\n', FILE); \ 564 } \ 565 } while (0) 566 567/* A table of bytes codes used by the ASM_OUTPUT_ASCII and 568 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table 569 corresponds to a particular byte value [0..255]. For any 570 given byte value, if the value in the corresponding table 571 position is zero, the given character can be output directly. 572 If the table value is 1, the byte must be output as a \ooo 573 octal escape. If the tables value is anything else, then the 574 byte value should be output as a \ followed by the value 575 in the table. Note that we can use standard UN*X escape 576 sequences for many control characters, but we don't use 577 \a to represent BEL because some svr4 assemblers (e.g. on 578 the i386) don't know about that. Also, we don't use \v 579 since some versions of gas, such as 2.2 did not accept it. */ 580 581#define ESCAPES \ 582"\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\ 583\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\ 584\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\ 585\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\ 586\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\ 587\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\ 588\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\ 589\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" 590 591/* Some svr4 assemblers have a limit on the number of characters which 592 can appear in the operand of a .string directive. If your assembler 593 has such a limitation, you should define STRING_LIMIT to reflect that 594 limit. Note that at least some svr4 assemblers have a limit on the 595 actual number of bytes in the double-quoted string, and that they 596 count each character in an escape sequence as one byte. Thus, an 597 escape sequence like \377 would count as four bytes. 598 599 If your target assembler doesn't support the .string directive, you 600 should define this to zero. 601*/ 602 603#define STRING_LIMIT ((unsigned) 256) 604 605#define STRING_ASM_OP ".string" 606 607/* The routine used to output NUL terminated strings. We use a special 608 version of this for most svr4 targets because doing so makes the 609 generated assembly code more compact (and thus faster to assemble) 610 as well as more readable, especially for targets like the i386 611 (where the only alternative is to output character sequences as 612 comma separated lists of numbers). */ 613 614#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ 615 do \ 616 { \ 617 register unsigned char *_limited_str = (unsigned char *) (STR); \ 618 register unsigned ch; \ 619 fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ 620 for (; ch = *_limited_str; _limited_str++) \ 621 { \ 622 register int escape; \ 623 switch (escape = ESCAPES[ch]) \ 624 { \ 625 case 0: \ 626 putc (ch, (FILE)); \ 627 break; \ 628 case 1: \ 629 fprintf ((FILE), "\\%03o", ch); \ 630 break; \ 631 default: \ 632 putc ('\\', (FILE)); \ 633 putc (escape, (FILE)); \ 634 break; \ 635 } \ 636 } \ 637 fprintf ((FILE), "\"\n"); \ 638 } \ 639 while (0) 640 641/* The routine used to output sequences of byte values. We use a special 642 version of this for most svr4 targets because doing so makes the 643 generated assembly code more compact (and thus faster to assemble) 644 as well as more readable. Note that if we find subparts of the 645 character sequence which end with NUL (and which are shorter than 646 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ 647 648#undef ASM_OUTPUT_ASCII 649#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ 650 do \ 651 { \ 652 register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ 653 register unsigned char *limit = _ascii_bytes + (LENGTH); \ 654 register unsigned bytes_in_chunk = 0; \ 655 for (; _ascii_bytes < limit; _ascii_bytes++) \ 656 { \ 657 register unsigned char *p; \ 658 if (bytes_in_chunk >= 60) \ 659 { \ 660 fprintf ((FILE), "\"\n"); \ 661 bytes_in_chunk = 0; \ 662 } \ 663 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ 664 continue; \ 665 if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ 666 { \ 667 if (bytes_in_chunk > 0) \ 668 { \ 669 fprintf ((FILE), "\"\n"); \ 670 bytes_in_chunk = 0; \ 671 } \ 672 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ 673 _ascii_bytes = p; \ 674 } \ 675 else \ 676 { \ 677 register int escape; \ 678 register unsigned ch; \ 679 if (bytes_in_chunk == 0) \ 680 fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \ 681 switch (escape = ESCAPES[ch = *_ascii_bytes]) \ 682 { \ 683 case 0: \ 684 putc (ch, (FILE)); \ 685 bytes_in_chunk++; \ 686 break; \ 687 case 1: \ 688 fprintf ((FILE), "\\%03o", ch); \ 689 bytes_in_chunk += 4; \ 690 break; \ 691 default: \ 692 putc ('\\', (FILE)); \ 693 putc (escape, (FILE)); \ 694 bytes_in_chunk += 2; \ 695 break; \ 696 } \ 697 } \ 698 } \ 699 if (bytes_in_chunk > 0) \ 700 fprintf ((FILE), "\"\n"); \ 701 } \ 702 while (0) 703 704/* All SVR4 targets use the ELF object file format. */ 705#define OBJECT_FORMAT_ELF 706