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