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