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