152284Sobrien/* elfos.h -- operating system specific defines to be used when 252284Sobrien targeting GCC for some generic ELF system 3169689Skan Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004 490075Sobrien Free Software Foundation, Inc. 552284Sobrien Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com). 652284Sobrien 7132718SkanThis file is part of GCC. 852284Sobrien 9132718SkanGCC is free software; you can redistribute it and/or modify 1052284Sobrienit under the terms of the GNU General Public License as published by 1152284Sobrienthe Free Software Foundation; either version 2, or (at your option) 1252284Sobrienany later version. 1352284Sobrien 14132718SkanGCC is distributed in the hope that it will be useful, 1552284Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1652284SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1752284SobrienGNU General Public License for more details. 1852284Sobrien 1952284SobrienYou should have received a copy of the GNU General Public License 20132718Skanalong with GCC; see the file COPYING. If not, write to 21169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 22169689SkanBoston, MA 02110-1301, USA. */ 2352284Sobrien 24132718Skan#define TARGET_OBJFMT_CPP_BUILTINS() \ 25132718Skan do \ 26132718Skan { \ 27132718Skan builtin_define ("__ELF__"); \ 28132718Skan } \ 29132718Skan while (0) 3052284Sobrien 3190075Sobrien/* Define a symbol indicating that we are using elfos.h. 3290075Sobrien Some CPU specific configuration files use this. */ 3390075Sobrien#define USING_ELFOS_H 3452284Sobrien 3590075Sobrien/* The prefix to add to user-visible assembler symbols. 3652284Sobrien 3790075Sobrien For ELF systems the convention is *not* to prepend a leading 3890075Sobrien underscore onto user-level symbol names. */ 3952284Sobrien 4090075Sobrien#undef USER_LABEL_PREFIX 4190075Sobrien#define USER_LABEL_PREFIX "" 4252284Sobrien 4390075Sobrien/* Biggest alignment supported by the object file format of this 4490075Sobrien machine. Use this macro to limit the alignment which can be 4590075Sobrien specified using the `__attribute__ ((aligned (N)))' construct. If 4690075Sobrien not defined, the default value is `BIGGEST_ALIGNMENT'. */ 4790075Sobrien#ifndef MAX_OFILE_ALIGNMENT 4890075Sobrien#define MAX_OFILE_ALIGNMENT (32768 * 8) 4990075Sobrien#endif 5052284Sobrien 5152284Sobrien/* Use periods rather than dollar signs in special g++ assembler names. */ 5252284Sobrien 5352284Sobrien#define NO_DOLLAR_IN_LABEL 5452284Sobrien 55117395Skan/* Writing `int' for a bit-field forces int alignment for the structure. */ 5652284Sobrien 57117395Skan#ifndef PCC_BITFIELD_TYPE_MATTERS 5852284Sobrien#define PCC_BITFIELD_TYPE_MATTERS 1 59117395Skan#endif 6052284Sobrien 6152284Sobrien/* Handle #pragma weak and #pragma pack. */ 6252284Sobrien 63117395Skan#define HANDLE_SYSV_PRAGMA 1 6452284Sobrien 6552284Sobrien/* All ELF targets can support DWARF-2. */ 6652284Sobrien 6790075Sobrien#define DWARF2_DEBUGGING_INFO 1 6852284Sobrien 6990075Sobrien/* The GNU tools operate better with dwarf2, and it is required by some 7090075Sobrien psABI's. Since we don't have any native tools to be compatible with, 7190075Sobrien default to dwarf2. */ 7252284Sobrien 7352284Sobrien#ifndef PREFERRED_DEBUGGING_TYPE 7490075Sobrien#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 7552284Sobrien#endif 7652284Sobrien 7790075Sobrien/* All SVR4 targets use the ELF object file format. */ 7890075Sobrien#define OBJECT_FORMAT_ELF 7952284Sobrien 8052284Sobrien 8190075Sobrien/* Output #ident as a .ident. */ 8290075Sobrien 8390075Sobrien#define ASM_OUTPUT_IDENT(FILE, NAME) \ 8490075Sobrien fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME); 8590075Sobrien 8690075Sobrien#define IDENT_ASM_OP "\t.ident\t" 8790075Sobrien 8890075Sobrien#undef SET_ASM_OP 8990075Sobrien#define SET_ASM_OP "\t.set\t" 9090075Sobrien 91132718Skan/* Most svr4 assemblers want a .file directive at the beginning of 92132718Skan their input file. */ 93132718Skan#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true 9452284Sobrien 9552284Sobrien/* This is how to allocate empty space in some section. The .zero 9652284Sobrien pseudo-op is used for this on most svr4 assemblers. */ 9752284Sobrien 9890075Sobrien#define SKIP_ASM_OP "\t.zero\t" 9952284Sobrien 10090075Sobrien#undef ASM_OUTPUT_SKIP 10190075Sobrien#define ASM_OUTPUT_SKIP(FILE, SIZE) \ 102132718Skan fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\ 103132718Skan SKIP_ASM_OP, (SIZE)) 10452284Sobrien 10552284Sobrien/* This is how to store into the string LABEL 10652284Sobrien the symbol_ref name of an internal numbered label where 10752284Sobrien PREFIX is the class of label and NUM is the number within the class. 10852284Sobrien This is suitable for output with `assemble_name'. 10952284Sobrien 11052284Sobrien For most svr4 systems, the convention is that any symbol which begins 11152284Sobrien with a period is not put into the linker symbol table by the assembler. */ 11252284Sobrien 11390075Sobrien#undef ASM_GENERATE_INTERNAL_LABEL 11490075Sobrien#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ 11590075Sobrien do \ 11690075Sobrien { \ 11790075Sobrien sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM)); \ 11890075Sobrien } \ 11990075Sobrien while (0) 12052284Sobrien 12152284Sobrien/* Output the label which precedes a jumptable. Note that for all svr4 12252284Sobrien systems where we actually generate jumptables (which is to say every 12352284Sobrien svr4 target except i386, where we use casesi instead) we put the jump- 12452284Sobrien tables into the .rodata section and since other stuff could have been 12552284Sobrien put into the .rodata section prior to any given jumptable, we have to 12652284Sobrien make sure that the location counter for the .rodata section gets pro- 12752284Sobrien perly re-aligned prior to the actual beginning of the jump table. */ 12852284Sobrien 12990075Sobrien#undef ALIGN_ASM_OP 13090075Sobrien#define ALIGN_ASM_OP "\t.align\t" 13152284Sobrien 13252284Sobrien#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL 13390075Sobrien#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \ 13452284Sobrien ASM_OUTPUT_ALIGN ((FILE), 2); 13552284Sobrien#endif 13652284Sobrien 13790075Sobrien#undef ASM_OUTPUT_CASE_LABEL 13890075Sobrien#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \ 13990075Sobrien do \ 14090075Sobrien { \ 14190075Sobrien ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ 142132718Skan (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); \ 14390075Sobrien } \ 14490075Sobrien while (0) 14552284Sobrien 14652284Sobrien/* The standard SVR4 assembler seems to require that certain builtin 14752284Sobrien library routines (e.g. .udiv) be explicitly declared as .globl 14852284Sobrien in each assembly file where they are referenced. */ 14952284Sobrien 15090075Sobrien#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ 151117395Skan (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)) 15252284Sobrien 15352284Sobrien/* This says how to output assembler code to declare an 15452284Sobrien uninitialized external linkage data object. Under SVR4, 15552284Sobrien the linker seems to want the alignment of data objects 15652284Sobrien to depend on their types. We do exactly that here. */ 15752284Sobrien 15890075Sobrien#define COMMON_ASM_OP "\t.comm\t" 15952284Sobrien 16090075Sobrien#undef ASM_OUTPUT_ALIGNED_COMMON 16152284Sobrien#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ 16290075Sobrien do \ 16390075Sobrien { \ 16490075Sobrien fprintf ((FILE), "%s", COMMON_ASM_OP); \ 16590075Sobrien assemble_name ((FILE), (NAME)); \ 166132718Skan fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ 167132718Skan (SIZE), (ALIGN) / BITS_PER_UNIT); \ 16890075Sobrien } \ 16990075Sobrien while (0) 17052284Sobrien 17152284Sobrien/* This says how to output assembler code to declare an 17252284Sobrien uninitialized internal linkage data object. Under SVR4, 17352284Sobrien the linker seems to want the alignment of data objects 17452284Sobrien to depend on their types. We do exactly that here. */ 17552284Sobrien 17690075Sobrien#define LOCAL_ASM_OP "\t.local\t" 17752284Sobrien 17890075Sobrien#undef ASM_OUTPUT_ALIGNED_LOCAL 17990075Sobrien#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ 18090075Sobrien do \ 18190075Sobrien { \ 18290075Sobrien fprintf ((FILE), "%s", LOCAL_ASM_OP); \ 18390075Sobrien assemble_name ((FILE), (NAME)); \ 18490075Sobrien fprintf ((FILE), "\n"); \ 18590075Sobrien ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ 18690075Sobrien } \ 18790075Sobrien while (0) 18852284Sobrien 18952284Sobrien/* This is the pseudo-op used to generate a contiguous sequence of byte 19052284Sobrien values from a double-quoted string WITHOUT HAVING A TERMINATING NUL 19152284Sobrien AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ 19252284Sobrien 19390075Sobrien#undef ASCII_DATA_ASM_OP 19490075Sobrien#define ASCII_DATA_ASM_OP "\t.ascii\t" 19552284Sobrien 196117395Skan/* Support a read-only data section. */ 197117395Skan#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata" 19852284Sobrien 19952284Sobrien/* On svr4, we *do* have support for the .init and .fini sections, and we 20052284Sobrien can put stuff in there to be executed before and after `main'. We let 20152284Sobrien crtstuff.c and other files know this by defining the following symbols. 20252284Sobrien The definitions say how to change sections to the .init and .fini 20352284Sobrien sections. This is the same for all known svr4 assemblers. */ 20452284Sobrien 20590075Sobrien#define INIT_SECTION_ASM_OP "\t.section\t.init" 20690075Sobrien#define FINI_SECTION_ASM_OP "\t.section\t.fini" 20752284Sobrien 208117395Skan/* Output assembly directive to move to the beginning of current section. */ 20990075Sobrien#ifdef HAVE_GAS_SUBSECTION_ORDERING 210117395Skan# define ASM_SECTION_START_OP "\t.subsection\t-1" 211117395Skan# define ASM_OUTPUT_SECTION_START(FILE) \ 21290075Sobrien fprintf ((FILE), "%s\n", ASM_SECTION_START_OP) 21390075Sobrien#endif 21490075Sobrien 21590075Sobrien#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) 216132718Skan 21790075Sobrien/* Switch into a generic section. */ 21890075Sobrien#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section 21952284Sobrien 220117395Skan#undef TARGET_ASM_SELECT_RTX_SECTION 221117395Skan#define TARGET_ASM_SELECT_RTX_SECTION default_elf_select_rtx_section 222117395Skan#undef TARGET_ASM_SELECT_SECTION 223117395Skan#define TARGET_ASM_SELECT_SECTION default_elf_select_section 224169689Skan#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS 225169689Skan#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS true 22652284Sobrien 22752284Sobrien/* Define the strings used for the special svr4 .type and .size directives. 22852284Sobrien These strings generally do not vary from one system running svr4 to 22952284Sobrien another, but if a given system (e.g. m88k running svr) needs to use 23052284Sobrien different pseudo-op names for these, they may be overridden in the 23152284Sobrien file which includes this one. */ 23252284Sobrien 23390075Sobrien#define TYPE_ASM_OP "\t.type\t" 23490075Sobrien#define SIZE_ASM_OP "\t.size\t" 23552284Sobrien 23652284Sobrien/* This is how we tell the assembler that a symbol is weak. */ 23752284Sobrien 238132718Skan#define ASM_WEAKEN_LABEL(FILE, NAME) \ 23990075Sobrien do \ 24090075Sobrien { \ 24190075Sobrien fputs ("\t.weak\t", (FILE)); \ 242132718Skan assemble_name ((FILE), (NAME)); \ 24390075Sobrien fputc ('\n', (FILE)); \ 24490075Sobrien } \ 24590075Sobrien while (0) 24652284Sobrien 24752284Sobrien/* The following macro defines the format used to output the second 24852284Sobrien operand of the .type assembler directive. Different svr4 assemblers 24952284Sobrien expect various different forms for this operand. The one given here 25052284Sobrien is just a default. You may need to override it in your machine- 25152284Sobrien specific tm.h file (depending upon the particulars of your assembler). */ 25252284Sobrien 25352284Sobrien#define TYPE_OPERAND_FMT "@%s" 25452284Sobrien 25552284Sobrien/* Write the extra assembler code needed to declare a function's result. 25652284Sobrien Most svr4 assemblers don't require any special declaration of the 25752284Sobrien result value, but there are exceptions. */ 25852284Sobrien 25952284Sobrien#ifndef ASM_DECLARE_RESULT 26052284Sobrien#define ASM_DECLARE_RESULT(FILE, RESULT) 26152284Sobrien#endif 26252284Sobrien 26352284Sobrien/* These macros generate the special .type and .size directives which 26452284Sobrien are used to set the corresponding fields of the linker symbol table 26552284Sobrien entries in an ELF object file under SVR4. These macros also output 26652284Sobrien the starting labels for the relevant functions/objects. */ 26752284Sobrien 26852284Sobrien/* Write the extra assembler code needed to declare a function properly. 26952284Sobrien Some svr4 assemblers need to also have something extra said about the 27052284Sobrien function's return value. We allow for that here. */ 27152284Sobrien 27290075Sobrien#ifndef ASM_DECLARE_FUNCTION_NAME 273117395Skan#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 274117395Skan do \ 275117395Skan { \ 276117395Skan ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ 277117395Skan ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ 278117395Skan ASM_OUTPUT_LABEL (FILE, NAME); \ 279117395Skan } \ 28090075Sobrien while (0) 28190075Sobrien#endif 28252284Sobrien 28352284Sobrien/* Write the extra assembler code needed to declare an object properly. */ 28452284Sobrien 28590075Sobrien#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ 28690075Sobrien do \ 28790075Sobrien { \ 288117395Skan HOST_WIDE_INT size; \ 289117395Skan \ 290117395Skan ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ 291117395Skan \ 29290075Sobrien size_directive_output = 0; \ 29390075Sobrien if (!flag_inhibit_size_directive \ 29490075Sobrien && (DECL) && DECL_SIZE (DECL)) \ 29590075Sobrien { \ 29690075Sobrien size_directive_output = 1; \ 297117395Skan size = int_size_in_bytes (TREE_TYPE (DECL)); \ 298117395Skan ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ 29990075Sobrien } \ 300117395Skan \ 30190075Sobrien ASM_OUTPUT_LABEL (FILE, NAME); \ 30290075Sobrien } \ 30390075Sobrien while (0) 30452284Sobrien 30552284Sobrien/* Output the size directive for a decl in rest_of_decl_compilation 30652284Sobrien in the case where we did not do so before the initializer. 30752284Sobrien Once we find the error_mark_node, we know that the value of 30852284Sobrien size_directive_output was set 30952284Sobrien by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ 31052284Sobrien 311132718Skan#undef ASM_FINISH_DECLARE_OBJECT 31290075Sobrien#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\ 31390075Sobrien do \ 31490075Sobrien { \ 31590075Sobrien const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ 316117395Skan HOST_WIDE_INT size; \ 317132718Skan \ 31890075Sobrien if (!flag_inhibit_size_directive \ 31990075Sobrien && DECL_SIZE (DECL) \ 32090075Sobrien && ! AT_END && TOP_LEVEL \ 32190075Sobrien && DECL_INITIAL (DECL) == error_mark_node \ 32290075Sobrien && !size_directive_output) \ 32390075Sobrien { \ 32490075Sobrien size_directive_output = 1; \ 325117395Skan size = int_size_in_bytes (TREE_TYPE (DECL)); \ 326117395Skan ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ 32790075Sobrien } \ 32890075Sobrien } \ 32990075Sobrien while (0) 33052284Sobrien 33152284Sobrien/* This is how to declare the size of a function. */ 33290075Sobrien#ifndef ASM_DECLARE_FUNCTION_SIZE 33390075Sobrien#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ 33490075Sobrien do \ 33590075Sobrien { \ 33690075Sobrien if (!flag_inhibit_size_directive) \ 337117395Skan ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ 33890075Sobrien } \ 33990075Sobrien while (0) 34090075Sobrien#endif 34152284Sobrien 34252284Sobrien/* A table of bytes codes used by the ASM_OUTPUT_ASCII and 34352284Sobrien ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table 34452284Sobrien corresponds to a particular byte value [0..255]. For any 34552284Sobrien given byte value, if the value in the corresponding table 34652284Sobrien position is zero, the given character can be output directly. 34752284Sobrien If the table value is 1, the byte must be output as a \ooo 34852284Sobrien octal escape. If the tables value is anything else, then the 34952284Sobrien byte value should be output as a \ followed by the value 35052284Sobrien in the table. Note that we can use standard UN*X escape 35152284Sobrien sequences for many control characters, but we don't use 35252284Sobrien \a to represent BEL because some svr4 assemblers (e.g. on 35352284Sobrien the i386) don't know about that. Also, we don't use \v 35452284Sobrien since some versions of gas, such as 2.2 did not accept it. */ 35552284Sobrien 35652284Sobrien#define ESCAPES \ 35752284Sobrien"\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\ 35852284Sobrien\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\ 35952284Sobrien\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\ 36052284Sobrien\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\ 36152284Sobrien\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\ 36252284Sobrien\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\ 36352284Sobrien\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\ 36452284Sobrien\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" 36552284Sobrien 36652284Sobrien/* Some svr4 assemblers have a limit on the number of characters which 36752284Sobrien can appear in the operand of a .string directive. If your assembler 36852284Sobrien has such a limitation, you should define STRING_LIMIT to reflect that 36952284Sobrien limit. Note that at least some svr4 assemblers have a limit on the 37052284Sobrien actual number of bytes in the double-quoted string, and that they 37152284Sobrien count each character in an escape sequence as one byte. Thus, an 37252284Sobrien escape sequence like \377 would count as four bytes. 37352284Sobrien 37452284Sobrien If your target assembler doesn't support the .string directive, you 37552284Sobrien should define this to zero. 37652284Sobrien*/ 37752284Sobrien 37852284Sobrien#define STRING_LIMIT ((unsigned) 256) 37952284Sobrien 38090075Sobrien#define STRING_ASM_OP "\t.string\t" 38152284Sobrien 38252284Sobrien/* The routine used to output NUL terminated strings. We use a special 38352284Sobrien version of this for most svr4 targets because doing so makes the 38452284Sobrien generated assembly code more compact (and thus faster to assemble) 38552284Sobrien as well as more readable, especially for targets like the i386 38652284Sobrien (where the only alternative is to output character sequences as 387117395Skan comma separated lists of numbers). */ 38852284Sobrien 38990075Sobrien#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ 39090075Sobrien do \ 39190075Sobrien { \ 39290075Sobrien register const unsigned char *_limited_str = \ 39390075Sobrien (const unsigned char *) (STR); \ 39490075Sobrien register unsigned ch; \ 395132718Skan \ 39690075Sobrien fprintf ((FILE), "%s\"", STRING_ASM_OP); \ 397132718Skan \ 39890075Sobrien for (; (ch = *_limited_str); _limited_str++) \ 39990075Sobrien { \ 40090075Sobrien register int escape; \ 401132718Skan \ 40290075Sobrien switch (escape = ESCAPES[ch]) \ 40390075Sobrien { \ 40490075Sobrien case 0: \ 40590075Sobrien putc (ch, (FILE)); \ 40690075Sobrien break; \ 40790075Sobrien case 1: \ 40890075Sobrien fprintf ((FILE), "\\%03o", ch); \ 40990075Sobrien break; \ 41090075Sobrien default: \ 41190075Sobrien putc ('\\', (FILE)); \ 41290075Sobrien putc (escape, (FILE)); \ 41390075Sobrien break; \ 41490075Sobrien } \ 41590075Sobrien } \ 416132718Skan \ 41790075Sobrien fprintf ((FILE), "\"\n"); \ 41890075Sobrien } \ 41952284Sobrien while (0) 42052284Sobrien 42152284Sobrien/* The routine used to output sequences of byte values. We use a special 42252284Sobrien version of this for most svr4 targets because doing so makes the 42352284Sobrien generated assembly code more compact (and thus faster to assemble) 42452284Sobrien as well as more readable. Note that if we find subparts of the 42552284Sobrien character sequence which end with NUL (and which are shorter than 42652284Sobrien STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ 42752284Sobrien 42890075Sobrien#undef ASM_OUTPUT_ASCII 42952284Sobrien#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ 43052284Sobrien do \ 43152284Sobrien { \ 432169689Skan const unsigned char *_ascii_bytes = \ 43390075Sobrien (const unsigned char *) (STR); \ 434169689Skan const unsigned char *limit = _ascii_bytes + (LENGTH); \ 435169689Skan const unsigned char *last_null = NULL; \ 436169689Skan unsigned bytes_in_chunk = 0; \ 43790075Sobrien \ 43852284Sobrien for (; _ascii_bytes < limit; _ascii_bytes++) \ 43952284Sobrien { \ 440169689Skan const unsigned char *p; \ 441132718Skan \ 44252284Sobrien if (bytes_in_chunk >= 60) \ 44352284Sobrien { \ 44452284Sobrien fprintf ((FILE), "\"\n"); \ 44552284Sobrien bytes_in_chunk = 0; \ 44652284Sobrien } \ 447132718Skan \ 448169689Skan if (_ascii_bytes > last_null) \ 449169689Skan { \ 450169689Skan for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ 451169689Skan continue; \ 452169689Skan last_null = p; \ 453169689Skan } \ 454169689Skan else \ 455169689Skan p = last_null; \ 456132718Skan \ 45790075Sobrien if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \ 45852284Sobrien { \ 45952284Sobrien if (bytes_in_chunk > 0) \ 46052284Sobrien { \ 46152284Sobrien fprintf ((FILE), "\"\n"); \ 46252284Sobrien bytes_in_chunk = 0; \ 46352284Sobrien } \ 464132718Skan \ 46552284Sobrien ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ 46652284Sobrien _ascii_bytes = p; \ 46752284Sobrien } \ 46852284Sobrien else \ 46952284Sobrien { \ 47052284Sobrien register int escape; \ 47152284Sobrien register unsigned ch; \ 472132718Skan \ 47352284Sobrien if (bytes_in_chunk == 0) \ 47490075Sobrien fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \ 475132718Skan \ 47652284Sobrien switch (escape = ESCAPES[ch = *_ascii_bytes]) \ 47752284Sobrien { \ 47852284Sobrien case 0: \ 47952284Sobrien putc (ch, (FILE)); \ 48052284Sobrien bytes_in_chunk++; \ 48152284Sobrien break; \ 48252284Sobrien case 1: \ 48352284Sobrien fprintf ((FILE), "\\%03o", ch); \ 48452284Sobrien bytes_in_chunk += 4; \ 48552284Sobrien break; \ 48652284Sobrien default: \ 48752284Sobrien putc ('\\', (FILE)); \ 48852284Sobrien putc (escape, (FILE)); \ 48952284Sobrien bytes_in_chunk += 2; \ 49052284Sobrien break; \ 49152284Sobrien } \ 49252284Sobrien } \ 49352284Sobrien } \ 494132718Skan \ 49552284Sobrien if (bytes_in_chunk > 0) \ 49652284Sobrien fprintf ((FILE), "\"\n"); \ 49752284Sobrien } \ 49852284Sobrien while (0) 499215840Sdim 500215840Sdim/* A C statement (sans semicolon) to output to the stdio stream STREAM 501215840Sdim any text necessary for declaring the name of an external symbol 502215840Sdim named NAME whch is referenced in this compilation but not defined. 503215840Sdim It is needed to properly support non-default visibility. */ 504215840Sdim 505215840Sdim#ifndef ASM_OUTPUT_EXTERNAL 506215840Sdim#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ 507215840Sdim default_elf_asm_output_external (FILE, DECL, NAME) 508215840Sdim#endif 509