* defaults.h (ASM_OUTPUT_ALTERNATE_LABEL_NAME): Provide default.
[official-gcc.git] / gcc / defaults.h
blob807119f422831eb8c65687fd210f5e5cac760f97
1 /* Definitions of various defaults for how to do assembler output
2 (most of which are designed to be appropriate for GAS or for
3 some BSD assembler).
4 Copyright (C) 1992, 1996-1999 Free Software Foundation, Inc.
5 Contributed by Ron Guilmette (rfg@monkeys.com)
7 This file is part of GNU CC.
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.
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.
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
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 /* Store in OUTPUT a string (made with alloca) containing
25 an assembler-name for a local static variable or function named NAME.
26 LABELNO is an integer which is different for each call. */
28 #ifndef ASM_FORMAT_PRIVATE_NAME
29 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
30 do { \
31 int len = strlen (NAME); \
32 char *temp = (char *) alloca (len + 3); \
33 temp[0] = 'L'; \
34 strcpy (&temp[1], (NAME)); \
35 temp[len + 1] = '.'; \
36 temp[len + 2] = 0; \
37 (OUTPUT) = (char *) alloca (strlen (NAME) + 11); \
38 ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \
39 } while (0)
40 #endif
42 #ifndef ASM_STABD_OP
43 #define ASM_STABD_OP ".stabd"
44 #endif
46 /* This is how to output an element of a case-vector that is absolute.
47 Some targets don't use this, but we have to define it anyway. */
49 #ifndef ASM_OUTPUT_ADDR_VEC_ELT
50 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
51 do { fprintf (FILE, "\t%s\t", ASM_LONG); \
52 ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE)); \
53 fputc ('\n', FILE); \
54 } while (0)
55 #endif
57 /* Provide default for ASM_OUTPUT_ALTERNATE_LABEL_NAME. */
58 #ifndef ASM_OUTPUT_ALTERNATE_LABEL_NAME
59 #define ASM_OUTPUT_ALTERNATE_LABEL_NAME(FILE,INSN) \
60 fprintf (FILE, "%s:\n", LABEL_ALTERNATE_NAME (INSN))
61 #endif
63 /* choose a reasonable default for ASM_OUTPUT_ASCII. */
65 #ifndef ASM_OUTPUT_ASCII
66 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
67 do { \
68 FILE *_hide_asm_out_file = (MYFILE); \
69 unsigned char *_hide_p = (unsigned char *) (MYSTRING); \
70 int _hide_thissize = (MYLENGTH); \
71 { \
72 FILE *asm_out_file = _hide_asm_out_file; \
73 unsigned char *p = _hide_p; \
74 int thissize = _hide_thissize; \
75 int i; \
76 fprintf (asm_out_file, "\t.ascii \""); \
78 for (i = 0; i < thissize; i++) \
79 { \
80 register int c = p[i]; \
81 if (c == '\"' || c == '\\') \
82 putc ('\\', asm_out_file); \
83 if (c >= ' ' && c < 0177) \
84 putc (c, asm_out_file); \
85 else \
86 { \
87 fprintf (asm_out_file, "\\%o", c); \
88 /* After an octal-escape, if a digit follows, \
89 terminate one string constant and start another. \
90 The Vax assembler fails to stop reading the escape \
91 after three digits, so this is the only way we \
92 can get it to parse the data properly. */ \
93 if (i < thissize - 1 \
94 && p[i + 1] >= '0' && p[i + 1] <= '9') \
95 fprintf (asm_out_file, "\"\n\t.ascii \""); \
96 } \
97 } \
98 fprintf (asm_out_file, "\"\n"); \
99 } \
101 while (0)
102 #endif
104 #ifndef ASM_IDENTIFY_GCC
105 /* Default the definition, only if ASM_IDENTIFY_GCC is not set,
106 because if it is set, we might not want ASM_IDENTIFY_LANGUAGE
107 outputting labels, if we do want it to, then it must be defined
108 in the tm.h file. */
109 #ifndef ASM_IDENTIFY_LANGUAGE
110 #define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE);
111 #endif
112 #endif
114 /* This is how we tell the assembler to equate two values. */
115 #ifdef SET_ASM_OP
116 #ifndef ASM_OUTPUT_DEF
117 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
118 do { fprintf ((FILE), "\t%s\t", SET_ASM_OP); \
119 assemble_name (FILE, LABEL1); \
120 fprintf (FILE, ","); \
121 assemble_name (FILE, LABEL2); \
122 fprintf (FILE, "\n"); \
123 } while (0)
124 #endif
125 #endif
127 /* This is how to output a reference to a user-level label named NAME. */
129 #ifndef ASM_OUTPUT_LABELREF
130 #define ASM_OUTPUT_LABELREF(FILE,NAME) asm_fprintf ((FILE), "%U%s", (NAME))
131 #endif
133 /* This determines whether or not we support weak symbols. */
134 #ifndef SUPPORTS_WEAK
135 #ifdef ASM_WEAKEN_LABEL
136 #define SUPPORTS_WEAK 1
137 #else
138 #define SUPPORTS_WEAK 0
139 #endif
140 #endif
142 /* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to
143 provide a weak attribute. Else define it to nothing.
145 This would normally belong in gansidecl.h, but SUPPORTS_WEAK is
146 not available at that time.
148 Note, this is only for use by target files which we know are to be
149 compiled by GCC. */
150 #ifndef TARGET_ATTRIBUTE_WEAK
151 # if SUPPORTS_WEAK
152 # define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak))
153 # else
154 # define TARGET_ATTRIBUTE_WEAK
155 # endif
156 #endif
158 /* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
159 the rest of the DWARF 2 frame unwind support is also provided. */
160 #if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
161 #define DWARF2_UNWIND_INFO 1
162 #endif
164 #if defined (DWARF2_UNWIND_INFO) && !defined (EH_FRAME_SECTION)
165 # if defined (EH_FRAME_SECTION_ASM_OP)
166 # define EH_FRAME_SECTION() eh_frame_section();
167 # else
168 /* If we aren't using crtstuff to run ctors, don't use it for EH. */
169 # if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR)
170 # define EH_FRAME_SECTION_ASM_OP ".section\t.eh_frame,\"aw\""
171 # define EH_FRAME_SECTION() \
172 do { named_section (NULL_TREE, ".eh_frame", 0); } while (0)
173 # endif
174 # endif
175 #endif
177 /* By default, we generate a label at the beginning and end of the
178 text section, and compute the size of the text section by
179 subtracting the two. However, on some platforms that doesn't
180 work, and we use the section itself, rather than a label at the
181 beginning of it, to indicate the start of the section. On such
182 platforms, define this to zero. */
183 #ifndef DWARF2_GENERATE_TEXT_SECTION_LABEL
184 #define DWARF2_GENERATE_TEXT_SECTION_LABEL 1
185 #endif
187 /* Supply a default definition for PROMOTE_PROTOTYPES. */
188 #ifndef PROMOTE_PROTOTYPES
189 #define PROMOTE_PROTOTYPES 0
190 #endif