1193323Sed/* elfos.h  --  operating system specific defines to be used when
2193323Sed   targeting GCC for some generic ELF system
3193323Sed   Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004
4193323Sed   Free Software Foundation, Inc.
5193323Sed   Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
6193323Sed
7193323SedThis file is part of GCC.
8193323Sed
9193323SedGCC is free software; you can redistribute it and/or modify
10193323Sedit under the terms of the GNU General Public License as published by
11193323Sedthe Free Software Foundation; either version 2, or (at your option)
12193323Sedany later version.
13193323Sed
14193323SedGCC is distributed in the hope that it will be useful,
15193323Sedbut WITHOUT ANY WARRANTY; without even the implied warranty of
16193323SedMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17193323SedGNU General Public License for more details.
18193323Sed
19193323SedYou should have received a copy of the GNU General Public License
20193323Sedalong with GCC; see the file COPYING.  If not, write to
21195340Sedthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
22198090SrdivackyBoston, MA 02110-1301, USA.  */
23193323Sed
24198090Srdivacky#define TARGET_OBJFMT_CPP_BUILTINS()		\
25193323Sed  do						\
26193323Sed    {						\
27193323Sed	builtin_define ("__ELF__");		\
28198090Srdivacky    }						\
29193323Sed  while (0)
30193323Sed
31193323Sed/* Define a symbol indicating that we are using elfos.h.
32193323Sed   Some CPU specific configuration files use this.  */
33193323Sed#define USING_ELFOS_H
34193323Sed
35193323Sed/* The prefix to add to user-visible assembler symbols.
36193323Sed
37193323Sed   For ELF systems the convention is *not* to prepend a leading
38193323Sed   underscore onto user-level symbol names.  */
39193323Sed
40193323Sed#undef  USER_LABEL_PREFIX
41193323Sed#define USER_LABEL_PREFIX ""
42193323Sed
43193323Sed/* Biggest alignment supported by the object file format of this
44198396Srdivacky   machine.  Use this macro to limit the alignment which can be
45198396Srdivacky   specified using the `__attribute__ ((aligned (N)))' construct.  If
46198396Srdivacky   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
47198396Srdivacky#ifndef MAX_OFILE_ALIGNMENT
48198396Srdivacky#define MAX_OFILE_ALIGNMENT (32768 * 8)
49198396Srdivacky#endif
50198396Srdivacky
51198396Srdivacky/* Use periods rather than dollar signs in special g++ assembler names.  */
52198892Srdivacky
53198396Srdivacky#define NO_DOLLAR_IN_LABEL
54198396Srdivacky
55198396Srdivacky/* Writing `int' for a bit-field forces int alignment for the structure.  */
56198396Srdivacky
57198396Srdivacky#ifndef PCC_BITFIELD_TYPE_MATTERS
58198396Srdivacky#define PCC_BITFIELD_TYPE_MATTERS 1
59198396Srdivacky#endif
60198892Srdivacky
61198892Srdivacky/* Handle #pragma weak and #pragma pack.  */
62198892Srdivacky
63198892Srdivacky#define HANDLE_SYSV_PRAGMA 1
64198892Srdivacky
65198892Srdivacky/* All ELF targets can support DWARF-2.  */
66198892Srdivacky
67198892Srdivacky#define DWARF2_DEBUGGING_INFO 1
68198892Srdivacky
69198892Srdivacky/* The GNU tools operate better with dwarf2, and it is required by some
70198892Srdivacky   psABI's.  Since we don't have any native tools to be compatible with,
71198892Srdivacky   default to dwarf2.  */
72198892Srdivacky
73198892Srdivacky#ifndef PREFERRED_DEBUGGING_TYPE
74198892Srdivacky#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
75198892Srdivacky#endif
76198892Srdivacky
77198892Srdivacky/* All SVR4 targets use the ELF object file format.  */
78198892Srdivacky#define OBJECT_FORMAT_ELF
79198892Srdivacky
80198892Srdivacky
81198892Srdivacky/* Output #ident as a .ident.  */
82198892Srdivacky
83198892Srdivacky#define ASM_OUTPUT_IDENT(FILE, NAME) \
84198892Srdivacky  fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
85198892Srdivacky
86193323Sed#define IDENT_ASM_OP "\t.ident\t"
87193323Sed
88193323Sed#undef  SET_ASM_OP
89193323Sed#define SET_ASM_OP	"\t.set\t"
90193323Sed
91193323Sed/* Most svr4 assemblers want a .file directive at the beginning of
92193323Sed   their input file.  */
93193323Sed#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
94198090Srdivacky
95193323Sed/* This is how to allocate empty space in some section.  The .zero
96193323Sed   pseudo-op is used for this on most svr4 assemblers.  */
97193323Sed
98193323Sed#define SKIP_ASM_OP	"\t.zero\t"
99198090Srdivacky
100193323Sed#undef  ASM_OUTPUT_SKIP
101193323Sed#define ASM_OUTPUT_SKIP(FILE, SIZE) \
102193323Sed   fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
103193323Sed	    SKIP_ASM_OP, (SIZE))
104198090Srdivacky
105198090Srdivacky/* This is how to store into the string LABEL
106198090Srdivacky   the symbol_ref name of an internal numbered label where
107198090Srdivacky   PREFIX is the class of label and NUM is the number within the class.
108198090Srdivacky   This is suitable for output with `assemble_name'.
109198090Srdivacky
110198090Srdivacky   For most svr4 systems, the convention is that any symbol which begins
111193323Sed   with a period is not put into the linker symbol table by the assembler.  */
112193323Sed
113193323Sed#undef  ASM_GENERATE_INTERNAL_LABEL
114198090Srdivacky#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)		\
115198090Srdivacky  do								\
116198090Srdivacky    {								\
117193323Sed      sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM));	\
118193323Sed    }								\
119193323Sed  while (0)
120198892Srdivacky
121198892Srdivacky/* Output the label which precedes a jumptable.  Note that for all svr4
122198892Srdivacky   systems where we actually generate jumptables (which is to say every
123198892Srdivacky   svr4 target except i386, where we use casesi instead) we put the jump-
124198892Srdivacky   tables into the .rodata section and since other stuff could have been
125198892Srdivacky   put into the .rodata section prior to any given jumptable, we have to
126198892Srdivacky   make sure that the location counter for the .rodata section gets pro-
127198892Srdivacky   perly re-aligned prior to the actual beginning of the jump table.  */
128198892Srdivacky
129198892Srdivacky#undef ALIGN_ASM_OP
130198892Srdivacky#define ALIGN_ASM_OP "\t.align\t"
131198892Srdivacky
132198892Srdivacky#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
133198892Srdivacky#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
134198892Srdivacky  ASM_OUTPUT_ALIGN ((FILE), 2);
135198892Srdivacky#endif
136198892Srdivacky
137198892Srdivacky#undef  ASM_OUTPUT_CASE_LABEL
138198892Srdivacky#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)		\
139198892Srdivacky  do									\
140198892Srdivacky    {									\
141198892Srdivacky      ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE)	\
142198892Srdivacky	(*targetm.asm_out.internal_label) (FILE, PREFIX, NUM);			\
143198892Srdivacky    }									\
144198892Srdivacky  while (0)
145198892Srdivacky
146198892Srdivacky/* The standard SVR4 assembler seems to require that certain builtin
147198892Srdivacky   library routines (e.g. .udiv) be explicitly declared as .globl
148198892Srdivacky   in each assembly file where they are referenced.  */
149198892Srdivacky
150198892Srdivacky#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)	\
151198892Srdivacky  (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
152193323Sed
153193323Sed/* This says how to output assembler code to declare an
154193323Sed   uninitialized external linkage data object.  Under SVR4,
155193323Sed   the linker seems to want the alignment of data objects
156193323Sed   to depend on their types.  We do exactly that here.  */
157193323Sed
158193323Sed#define COMMON_ASM_OP	"\t.comm\t"
159193323Sed
160193323Sed#undef  ASM_OUTPUT_ALIGNED_COMMON
161193323Sed#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
162193323Sed  do									\
163193323Sed    {									\
164193323Sed      fprintf ((FILE), "%s", COMMON_ASM_OP);				\
165193323Sed      assemble_name ((FILE), (NAME));					\
166193323Sed      fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",		\
167193323Sed	       (SIZE), (ALIGN) / BITS_PER_UNIT);			\
168198090Srdivacky    }									\
169193323Sed  while (0)
170193323Sed
171198090Srdivacky/* This says how to output assembler code to declare an
172193323Sed   uninitialized internal linkage data object.  Under SVR4,
173195340Sed   the linker seems to want the alignment of data objects
174198090Srdivacky   to depend on their types.  We do exactly that here.  */
175193323Sed
176193323Sed#define LOCAL_ASM_OP	"\t.local\t"
177193323Sed
178193323Sed#undef  ASM_OUTPUT_ALIGNED_LOCAL
179193323Sed#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)	\
180198090Srdivacky  do								\
181198090Srdivacky    {								\
182198090Srdivacky      fprintf ((FILE), "%s", LOCAL_ASM_OP);			\
183198090Srdivacky      assemble_name ((FILE), (NAME));				\
184198090Srdivacky      fprintf ((FILE), "\n");					\
185198090Srdivacky      ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);	\
186198090Srdivacky    }								\
187198090Srdivacky  while (0)
188198090Srdivacky
189198090Srdivacky/* This is the pseudo-op used to generate a contiguous sequence of byte
190198090Srdivacky   values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
191198090Srdivacky   AUTOMATICALLY APPENDED.  This is the same for most svr4 assemblers.  */
192198090Srdivacky
193193323Sed#undef  ASCII_DATA_ASM_OP
194193323Sed#define ASCII_DATA_ASM_OP	"\t.ascii\t"
195193323Sed
196195340Sed/* Support a read-only data section.  */
197193323Sed#define READONLY_DATA_SECTION_ASM_OP	"\t.section\t.rodata"
198193323Sed
199193323Sed/* On svr4, we *do* have support for the .init and .fini sections, and we
200193323Sed   can put stuff in there to be executed before and after `main'.  We let
201193323Sed   crtstuff.c and other files know this by defining the following symbols.
202193323Sed   The definitions say how to change sections to the .init and .fini
203193323Sed   sections.  This is the same for all known svr4 assemblers.  */
204193323Sed
205195340Sed#define INIT_SECTION_ASM_OP	"\t.section\t.init"
206193323Sed#define FINI_SECTION_ASM_OP	"\t.section\t.fini"
207193323Sed
208193323Sed/* Output assembly directive to move to the beginning of current section.  */
209198090Srdivacky#ifdef HAVE_GAS_SUBSECTION_ORDERING
210193323Sed# define ASM_SECTION_START_OP	"\t.subsection\t-1"
211193323Sed# define ASM_OUTPUT_SECTION_START(FILE)	\
212193323Sed  fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
213193323Sed#endif
214195340Sed
215193323Sed#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
216193323Sed
217193323Sed/* Switch into a generic section.  */
218193323Sed#define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
219193323Sed
220193323Sed#undef  TARGET_ASM_SELECT_RTX_SECTION
221193323Sed#define TARGET_ASM_SELECT_RTX_SECTION default_elf_select_rtx_section
222193323Sed#undef	TARGET_ASM_SELECT_SECTION
223193323Sed#define TARGET_ASM_SELECT_SECTION default_elf_select_section
224193323Sed#undef  TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
225193323Sed#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS true
226198090Srdivacky
227198090Srdivacky/* Define the strings used for the special svr4 .type and .size directives.
228193323Sed   These strings generally do not vary from one system running svr4 to
229193323Sed   another, but if a given system (e.g. m88k running svr) needs to use
230198090Srdivacky   different pseudo-op names for these, they may be overridden in the
231193323Sed   file which includes this one.  */
232193323Sed
233193323Sed#define TYPE_ASM_OP	"\t.type\t"
234193323Sed#define SIZE_ASM_OP	"\t.size\t"
235193323Sed
236193323Sed/* This is how we tell the assembler that a symbol is weak.  */
237193323Sed
238193323Sed#define ASM_WEAKEN_LABEL(FILE, NAME)	\
239193323Sed  do					\
240193323Sed    {					\
241193323Sed      fputs ("\t.weak\t", (FILE));	\
242193323Sed      assemble_name ((FILE), (NAME));	\
243193323Sed      fputc ('\n', (FILE));		\
244193323Sed    }					\
245193323Sed  while (0)
246193323Sed
247193323Sed/* The following macro defines the format used to output the second
248193323Sed   operand of the .type assembler directive.  Different svr4 assemblers
249193323Sed   expect various different forms for this operand.  The one given here
250193323Sed   is just a default.  You may need to override it in your machine-
251193323Sed   specific tm.h file (depending upon the particulars of your assembler).  */
252193323Sed
253193323Sed#define TYPE_OPERAND_FMT	"@%s"
254193323Sed
255193323Sed/* Write the extra assembler code needed to declare a function's result.
256193323Sed   Most svr4 assemblers don't require any special declaration of the
257193323Sed   result value, but there are exceptions.  */
258193323Sed
259193323Sed#ifndef ASM_DECLARE_RESULT
260193323Sed#define ASM_DECLARE_RESULT(FILE, RESULT)
261193323Sed#endif
262193323Sed
263193323Sed/* These macros generate the special .type and .size directives which
264193323Sed   are used to set the corresponding fields of the linker symbol table
265193323Sed   entries in an ELF object file under SVR4.  These macros also output
266193323Sed   the starting labels for the relevant functions/objects.  */
267193323Sed
268193323Sed/* Write the extra assembler code needed to declare a function properly.
269193323Sed   Some svr4 assemblers need to also have something extra said about the
270193323Sed   function's return value.  We allow for that here.  */
271193323Sed
272193323Sed#ifndef ASM_DECLARE_FUNCTION_NAME
273193323Sed#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
274193323Sed  do								\
275193323Sed    {								\
276198090Srdivacky      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
277193323Sed      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
278193323Sed      ASM_OUTPUT_LABEL (FILE, NAME);				\
279193323Sed    }								\
280193323Sed  while (0)
281193323Sed#endif
282193323Sed
283193323Sed/* Write the extra assembler code needed to declare an object properly.  */
284193323Sed
285193323Sed#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)		\
286193323Sed  do								\
287193323Sed    {								\
288193323Sed      HOST_WIDE_INT size;					\
289198090Srdivacky								\
290193323Sed      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");		\
291198090Srdivacky								\
292193323Sed      size_directive_output = 0;				\
293198090Srdivacky      if (!flag_inhibit_size_directive				\
294198090Srdivacky	  && (DECL) && DECL_SIZE (DECL))			\
295198090Srdivacky	{							\
296198090Srdivacky	  size_directive_output = 1;				\
297198090Srdivacky	  size = int_size_in_bytes (TREE_TYPE (DECL));		\
298198090Srdivacky	  ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);		\
299198090Srdivacky	}							\
300198090Srdivacky								\
301198090Srdivacky      ASM_OUTPUT_LABEL (FILE, NAME);				\
302198090Srdivacky    }								\
303198090Srdivacky  while (0)
304198090Srdivacky
305198090Srdivacky/* Output the size directive for a decl in rest_of_decl_compilation
306193323Sed   in the case where we did not do so before the initializer.
307193323Sed   Once we find the error_mark_node, we know that the value of
308193323Sed   size_directive_output was set
309193323Sed   by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
310198090Srdivacky
311193323Sed#undef ASM_FINISH_DECLARE_OBJECT
312198090Srdivacky#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
313193323Sed  do								\
314193323Sed    {								\
315193323Sed      const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);	\
316193323Sed      HOST_WIDE_INT size;					\
317193323Sed								\
318193323Sed      if (!flag_inhibit_size_directive				\
319198090Srdivacky	  && DECL_SIZE (DECL)					\
320193323Sed	  && ! AT_END && TOP_LEVEL				\
321193323Sed	  && DECL_INITIAL (DECL) == error_mark_node		\
322193323Sed	  && !size_directive_output)				\
323193323Sed	{							\
324198090Srdivacky	  size_directive_output = 1;				\
325193323Sed	  size = int_size_in_bytes (TREE_TYPE (DECL));		\
326198090Srdivacky	  ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size);		\
327193323Sed	}							\
328193323Sed    }								\
329193323Sed  while (0)
330193323Sed
331193323Sed/* This is how to declare the size of a function.  */
332193323Sed#ifndef ASM_DECLARE_FUNCTION_SIZE
333193323Sed#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)		\
334193323Sed  do								\
335193323Sed    {								\
336198090Srdivacky      if (!flag_inhibit_size_directive)				\
337198090Srdivacky	ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);			\
338198090Srdivacky    }								\
339193323Sed  while (0)
340193323Sed#endif
341193323Sed
342193323Sed/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
343198090Srdivacky   ASM_OUTPUT_LIMITED_STRING macros.  Each byte in the table
344193323Sed   corresponds to a particular byte value [0..255].  For any
345193323Sed   given byte value, if the value in the corresponding table
346193323Sed   position is zero, the given character can be output directly.
347193323Sed   If the table value is 1, the byte must be output as a \ooo
348193323Sed   octal escape.  If the tables value is anything else, then the
349193323Sed   byte value should be output as a \ followed by the value
350193323Sed   in the table.  Note that we can use standard UN*X escape
351193323Sed   sequences for many control characters, but we don't use
352193323Sed   \a to represent BEL because some svr4 assemblers (e.g. on
353193323Sed   the i386) don't know about that.  Also, we don't use \v
354193323Sed   since some versions of gas, such as 2.2 did not accept it.  */
355193323Sed
356193323Sed#define ESCAPES \
357193323Sed"\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\
358193323Sed\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\
359193323Sed\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\
360198090Srdivacky\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\
361193323Sed\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\
362193323Sed\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\
363193323Sed\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\
364198090Srdivacky\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"
365193323Sed
366193323Sed/* Some svr4 assemblers have a limit on the number of characters which
367193323Sed   can appear in the operand of a .string directive.  If your assembler
368193323Sed   has such a limitation, you should define STRING_LIMIT to reflect that
369198090Srdivacky   limit.  Note that at least some svr4 assemblers have a limit on the
370193323Sed   actual number of bytes in the double-quoted string, and that they
371193323Sed   count each character in an escape sequence as one byte.  Thus, an
372193323Sed   escape sequence like \377 would count as four bytes.
373193323Sed
374193323Sed   If your target assembler doesn't support the .string directive, you
375193323Sed   should define this to zero.
376193323Sed*/
377193323Sed
378193323Sed#define STRING_LIMIT	((unsigned) 256)
379193323Sed
380193323Sed#define STRING_ASM_OP	"\t.string\t"
381198090Srdivacky
382193323Sed/* The routine used to output NUL terminated strings.  We use a special
383193323Sed   version of this for most svr4 targets because doing so makes the
384193323Sed   generated assembly code more compact (and thus faster to assemble)
385193323Sed   as well as more readable, especially for targets like the i386
386193323Sed   (where the only alternative is to output character sequences as
387193323Sed   comma separated lists of numbers).  */
388193323Sed
389193323Sed#define ASM_OUTPUT_LIMITED_STRING(FILE, STR)		\
390193323Sed  do							\
391198090Srdivacky    {							\
392193323Sed      register const unsigned char *_limited_str =	\
393193323Sed	(const unsigned char *) (STR);			\
394193323Sed      register unsigned ch;				\
395193323Sed							\
396193323Sed      fprintf ((FILE), "%s\"", STRING_ASM_OP);		\
397193323Sed							\
398193323Sed      for (; (ch = *_limited_str); _limited_str++)	\
399193323Sed        {						\
400193323Sed	  register int escape;				\
401193323Sed							\
402193323Sed	  switch (escape = ESCAPES[ch])			\
403193323Sed	    {						\
404193323Sed	    case 0:					\
405193323Sed	      putc (ch, (FILE));			\
406193323Sed	      break;					\
407193323Sed	    case 1:					\
408193323Sed	      fprintf ((FILE), "\\%03o", ch);		\
409193323Sed	      break;					\
410193323Sed	    default:					\
411193323Sed	      putc ('\\', (FILE));			\
412193323Sed	      putc (escape, (FILE));			\
413198090Srdivacky	      break;					\
414198090Srdivacky	    }						\
415198090Srdivacky        }						\
416198090Srdivacky							\
417198090Srdivacky      fprintf ((FILE), "\"\n");				\
418198090Srdivacky    }							\
419198090Srdivacky  while (0)
420198090Srdivacky
421198090Srdivacky/* The routine used to output sequences of byte values.  We use a special
422198090Srdivacky   version of this for most svr4 targets because doing so makes the
423198090Srdivacky   generated assembly code more compact (and thus faster to assemble)
424198090Srdivacky   as well as more readable.  Note that if we find subparts of the
425198090Srdivacky   character sequence which end with NUL (and which are shorter than
426198090Srdivacky   STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
427198090Srdivacky
428198090Srdivacky#undef  ASM_OUTPUT_ASCII
429198090Srdivacky#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)				\
430198090Srdivacky  do									\
431198090Srdivacky    {									\
432198090Srdivacky      const unsigned char *_ascii_bytes =				\
433198090Srdivacky	(const unsigned char *) (STR);					\
434198090Srdivacky      const unsigned char *limit = _ascii_bytes + (LENGTH);		\
435198090Srdivacky      const unsigned char *last_null = NULL;				\
436198090Srdivacky      unsigned bytes_in_chunk = 0;					\
437198090Srdivacky									\
438198090Srdivacky      for (; _ascii_bytes < limit; _ascii_bytes++)			\
439198090Srdivacky        {								\
440198090Srdivacky	  const unsigned char *p;					\
441198090Srdivacky									\
442198090Srdivacky	  if (bytes_in_chunk >= 60)					\
443198090Srdivacky	    {								\
444198090Srdivacky	      fprintf ((FILE), "\"\n");					\
445193323Sed	      bytes_in_chunk = 0;					\
446193323Sed	    }								\
447193323Sed									\
448193323Sed	  if (_ascii_bytes > last_null)					\
449193323Sed	    {								\
450193323Sed	      for (p = _ascii_bytes; p < limit && *p != '\0'; p++)	\
451193323Sed		continue;						\
452193323Sed	      last_null = p;						\
453198090Srdivacky	    }								\
454193323Sed	  else								\
455193323Sed	    p = last_null;						\
456193323Sed									\
457193323Sed	  if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT)	\
458193323Sed	    {								\
459193323Sed	      if (bytes_in_chunk > 0)					\
460198090Srdivacky		{							\
461193323Sed		  fprintf ((FILE), "\"\n");				\
462193323Sed		  bytes_in_chunk = 0;					\
463193323Sed		}							\
464193323Sed									\
465193323Sed	      ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);		\
466198090Srdivacky	      _ascii_bytes = p;						\
467198090Srdivacky	    }								\
468198090Srdivacky	  else								\
469198090Srdivacky	    {								\
470198090Srdivacky	      register int escape;					\
471198090Srdivacky	      register unsigned ch;					\
472198090Srdivacky									\
473198090Srdivacky	      if (bytes_in_chunk == 0)					\
474198090Srdivacky		fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP);		\
475198090Srdivacky									\
476198090Srdivacky	      switch (escape = ESCAPES[ch = *_ascii_bytes])		\
477198090Srdivacky		{							\
478198090Srdivacky		case 0:							\
479198090Srdivacky		  putc (ch, (FILE));					\
480198090Srdivacky		  bytes_in_chunk++;					\
481198090Srdivacky		  break;						\
482198090Srdivacky		case 1:							\
483198090Srdivacky		  fprintf ((FILE), "\\%03o", ch);			\
484198090Srdivacky		  bytes_in_chunk += 4;					\
485198090Srdivacky		  break;						\
486198090Srdivacky		default:						\
487198090Srdivacky		  putc ('\\', (FILE));					\
488198090Srdivacky		  putc (escape, (FILE));				\
489198090Srdivacky		  bytes_in_chunk += 2;					\
490198090Srdivacky		  break;						\
491198090Srdivacky		}							\
492198090Srdivacky	    }								\
493198090Srdivacky	}								\
494198090Srdivacky									\
495198090Srdivacky      if (bytes_in_chunk > 0)						\
496198090Srdivacky        fprintf ((FILE), "\"\n");					\
497198090Srdivacky    }									\
498198090Srdivacky  while (0)
499198090Srdivacky
500198090Srdivacky/* A C statement (sans semicolon) to output to the stdio stream STREAM
501198090Srdivacky   any text necessary for declaring the name of an external symbol
502198090Srdivacky   named NAME whch is referenced in this compilation but not defined.
503198090Srdivacky   It is needed to properly support non-default visibility.  */
504198090Srdivacky
505198090Srdivacky#ifndef ASM_OUTPUT_EXTERNAL
506198090Srdivacky#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
507198090Srdivacky  default_elf_asm_output_external (FILE, DECL, NAME)
508198090Srdivacky#endif
509198090Srdivacky