1 |
282 |
jeremybenn |
/* elfos.h -- operating system specific defines to be used when
|
2 |
|
|
targeting GCC for some generic ELF system
|
3 |
|
|
Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004,
|
4 |
|
|
2007, 2009, 2010 Free Software Foundation, Inc.
|
5 |
|
|
Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
|
6 |
|
|
|
7 |
|
|
This file is part of GCC.
|
8 |
|
|
|
9 |
|
|
GCC 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 3, or (at your option)
|
12 |
|
|
any later version.
|
13 |
|
|
|
14 |
|
|
GCC 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 |
|
|
Under Section 7 of GPL version 3, you are granted additional
|
20 |
|
|
permissions described in the GCC Runtime Library Exception, version
|
21 |
|
|
3.1, as published by the Free Software Foundation.
|
22 |
|
|
|
23 |
|
|
You should have received a copy of the GNU General Public License and
|
24 |
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
25 |
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
26 |
|
|
<http://www.gnu.org/licenses/>. */
|
27 |
|
|
|
28 |
|
|
#define TARGET_OBJFMT_CPP_BUILTINS() \
|
29 |
|
|
do \
|
30 |
|
|
{ \
|
31 |
|
|
builtin_define ("__ELF__"); \
|
32 |
|
|
} \
|
33 |
|
|
while (0)
|
34 |
|
|
|
35 |
|
|
/* Define a symbol indicating that we are using elfos.h.
|
36 |
|
|
Some CPU specific configuration files use this. */
|
37 |
|
|
#define USING_ELFOS_H
|
38 |
|
|
|
39 |
|
|
/* The prefix to add to user-visible assembler symbols.
|
40 |
|
|
|
41 |
|
|
For ELF systems the convention is *not* to prepend a leading
|
42 |
|
|
underscore onto user-level symbol names. */
|
43 |
|
|
|
44 |
|
|
#undef USER_LABEL_PREFIX
|
45 |
|
|
#define USER_LABEL_PREFIX ""
|
46 |
|
|
|
47 |
|
|
/* The biggest alignment supported by ELF in bits. 32-bit ELF
|
48 |
|
|
supports section alignment up to (0x80000000 * 8), while
|
49 |
|
|
64-bit ELF supports (0x8000000000000000 * 8). If this macro
|
50 |
|
|
is not defined, the default is the largest alignment supported
|
51 |
|
|
by 32-bit ELF and representable on a 32-bit host. Use this
|
52 |
|
|
macro to limit the alignment which can be specified using
|
53 |
|
|
the `__attribute__ ((aligned (N)))' construct. */
|
54 |
|
|
#ifndef MAX_OFILE_ALIGNMENT
|
55 |
|
|
#define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8)
|
56 |
|
|
#endif
|
57 |
|
|
|
58 |
|
|
/* Use periods rather than dollar signs in special g++ assembler names. */
|
59 |
|
|
|
60 |
|
|
#define NO_DOLLAR_IN_LABEL
|
61 |
|
|
|
62 |
|
|
/* Writing `int' for a bit-field forces int alignment for the structure. */
|
63 |
|
|
|
64 |
|
|
#ifndef PCC_BITFIELD_TYPE_MATTERS
|
65 |
|
|
#define PCC_BITFIELD_TYPE_MATTERS 1
|
66 |
|
|
#endif
|
67 |
|
|
|
68 |
|
|
/* Handle #pragma weak and #pragma pack. */
|
69 |
|
|
|
70 |
|
|
#define HANDLE_SYSV_PRAGMA 1
|
71 |
|
|
|
72 |
|
|
/* All ELF targets can support DWARF-2. */
|
73 |
|
|
|
74 |
|
|
#define DWARF2_DEBUGGING_INFO 1
|
75 |
|
|
|
76 |
|
|
/* The GNU tools operate better with dwarf2, and it is required by some
|
77 |
|
|
psABI's. Since we don't have any native tools to be compatible with,
|
78 |
|
|
default to dwarf2. */
|
79 |
|
|
|
80 |
|
|
#ifndef PREFERRED_DEBUGGING_TYPE
|
81 |
|
|
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
82 |
|
|
#endif
|
83 |
|
|
|
84 |
|
|
/* All SVR4 targets use the ELF object file format. */
|
85 |
|
|
#define OBJECT_FORMAT_ELF
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
/* Output #ident as a .ident. */
|
89 |
|
|
|
90 |
|
|
#define ASM_OUTPUT_IDENT(FILE, NAME) \
|
91 |
|
|
fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
|
92 |
|
|
|
93 |
|
|
#define IDENT_ASM_OP "\t.ident\t"
|
94 |
|
|
|
95 |
|
|
#undef SET_ASM_OP
|
96 |
|
|
#define SET_ASM_OP "\t.set\t"
|
97 |
|
|
|
98 |
|
|
/* Most svr4 assemblers want a .file directive at the beginning of
|
99 |
|
|
their input file. */
|
100 |
|
|
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
|
101 |
|
|
|
102 |
|
|
/* This is how to allocate empty space in some section. The .zero
|
103 |
|
|
pseudo-op is used for this on most svr4 assemblers. */
|
104 |
|
|
|
105 |
|
|
#define SKIP_ASM_OP "\t.zero\t"
|
106 |
|
|
|
107 |
|
|
#undef ASM_OUTPUT_SKIP
|
108 |
|
|
#define ASM_OUTPUT_SKIP(FILE, SIZE) \
|
109 |
|
|
fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
|
110 |
|
|
SKIP_ASM_OP, (SIZE))
|
111 |
|
|
|
112 |
|
|
/* This is how to store into the string LABEL
|
113 |
|
|
the symbol_ref name of an internal numbered label where
|
114 |
|
|
PREFIX is the class of label and NUM is the number within the class.
|
115 |
|
|
This is suitable for output with `assemble_name'.
|
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 |
|
|
|
120 |
|
|
#undef ASM_GENERATE_INTERNAL_LABEL
|
121 |
|
|
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
|
122 |
|
|
do \
|
123 |
|
|
{ \
|
124 |
|
|
sprintf (LABEL, "*.%s%u", PREFIX, (unsigned) (NUM)); \
|
125 |
|
|
} \
|
126 |
|
|
while (0)
|
127 |
|
|
|
128 |
|
|
/* Output the label which precedes a jumptable. Note that for all svr4
|
129 |
|
|
systems where we actually generate jumptables (which is to say every
|
130 |
|
|
svr4 target except i386, where we use casesi instead) we put the jump-
|
131 |
|
|
tables into the .rodata section and since other stuff could have been
|
132 |
|
|
put into the .rodata section prior to any given jumptable, we have to
|
133 |
|
|
make sure that the location counter for the .rodata section gets pro-
|
134 |
|
|
perly re-aligned prior to the actual beginning of the jump table. */
|
135 |
|
|
|
136 |
|
|
#undef ALIGN_ASM_OP
|
137 |
|
|
#define ALIGN_ASM_OP "\t.align\t"
|
138 |
|
|
|
139 |
|
|
#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
|
140 |
|
|
#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
|
141 |
|
|
ASM_OUTPUT_ALIGN ((FILE), 2);
|
142 |
|
|
#endif
|
143 |
|
|
|
144 |
|
|
#undef ASM_OUTPUT_CASE_LABEL
|
145 |
|
|
#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
|
146 |
|
|
do \
|
147 |
|
|
{ \
|
148 |
|
|
ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \
|
149 |
|
|
(*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); \
|
150 |
|
|
} \
|
151 |
|
|
while (0)
|
152 |
|
|
|
153 |
|
|
/* The standard SVR4 assembler seems to require that certain builtin
|
154 |
|
|
library routines (e.g. .udiv) be explicitly declared as .globl
|
155 |
|
|
in each assembly file where they are referenced. */
|
156 |
|
|
|
157 |
|
|
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
|
158 |
|
|
(*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
|
159 |
|
|
|
160 |
|
|
/* This says how to output assembler code to declare an
|
161 |
|
|
uninitialized external linkage data object. Under SVR4,
|
162 |
|
|
the linker seems to want the alignment of data objects
|
163 |
|
|
to depend on their types. We do exactly that here. */
|
164 |
|
|
|
165 |
|
|
#define COMMON_ASM_OP "\t.comm\t"
|
166 |
|
|
|
167 |
|
|
#undef ASM_OUTPUT_ALIGNED_COMMON
|
168 |
|
|
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
|
169 |
|
|
do \
|
170 |
|
|
{ \
|
171 |
|
|
fprintf ((FILE), "%s", COMMON_ASM_OP); \
|
172 |
|
|
assemble_name ((FILE), (NAME)); \
|
173 |
|
|
fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
|
174 |
|
|
(SIZE), (ALIGN) / BITS_PER_UNIT); \
|
175 |
|
|
} \
|
176 |
|
|
while (0)
|
177 |
|
|
|
178 |
|
|
/* This says how to output assembler code to declare an
|
179 |
|
|
uninitialized internal linkage data object. Under SVR4,
|
180 |
|
|
the linker seems to want the alignment of data objects
|
181 |
|
|
to depend on their types. We do exactly that here. */
|
182 |
|
|
|
183 |
|
|
#define LOCAL_ASM_OP "\t.local\t"
|
184 |
|
|
|
185 |
|
|
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
186 |
|
|
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
187 |
|
|
do \
|
188 |
|
|
{ \
|
189 |
|
|
fprintf ((FILE), "%s", LOCAL_ASM_OP); \
|
190 |
|
|
assemble_name ((FILE), (NAME)); \
|
191 |
|
|
fprintf ((FILE), "\n"); \
|
192 |
|
|
ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
|
193 |
|
|
} \
|
194 |
|
|
while (0)
|
195 |
|
|
|
196 |
|
|
/* This is the pseudo-op used to generate a contiguous sequence of byte
|
197 |
|
|
values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
|
198 |
|
|
AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */
|
199 |
|
|
|
200 |
|
|
#undef ASCII_DATA_ASM_OP
|
201 |
|
|
#define ASCII_DATA_ASM_OP "\t.ascii\t"
|
202 |
|
|
|
203 |
|
|
/* Support a read-only data section. */
|
204 |
|
|
#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata"
|
205 |
|
|
|
206 |
|
|
/* On svr4, we *do* have support for the .init and .fini sections, and we
|
207 |
|
|
can put stuff in there to be executed before and after `main'. We let
|
208 |
|
|
crtstuff.c and other files know this by defining the following symbols.
|
209 |
|
|
The definitions say how to change sections to the .init and .fini
|
210 |
|
|
sections. This is the same for all known svr4 assemblers. */
|
211 |
|
|
|
212 |
|
|
#define INIT_SECTION_ASM_OP "\t.section\t.init"
|
213 |
|
|
#define FINI_SECTION_ASM_OP "\t.section\t.fini"
|
214 |
|
|
|
215 |
|
|
/* Output assembly directive to move to the beginning of current section. */
|
216 |
|
|
#ifdef HAVE_GAS_SUBSECTION_ORDERING
|
217 |
|
|
# define ASM_SECTION_START_OP "\t.subsection\t-1"
|
218 |
|
|
# define ASM_OUTPUT_SECTION_START(FILE) \
|
219 |
|
|
fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
|
220 |
|
|
#endif
|
221 |
|
|
|
222 |
|
|
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
|
223 |
|
|
|
224 |
|
|
/* Switch into a generic section. */
|
225 |
|
|
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
|
226 |
|
|
|
227 |
|
|
#undef TARGET_ASM_SELECT_RTX_SECTION
|
228 |
|
|
#define TARGET_ASM_SELECT_RTX_SECTION default_elf_select_rtx_section
|
229 |
|
|
#undef TARGET_ASM_SELECT_SECTION
|
230 |
|
|
#define TARGET_ASM_SELECT_SECTION default_elf_select_section
|
231 |
|
|
#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
|
232 |
|
|
#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS true
|
233 |
|
|
|
234 |
|
|
/* Define the strings used for the special svr4 .type and .size directives.
|
235 |
|
|
These strings generally do not vary from one system running svr4 to
|
236 |
|
|
another, but if a given system (e.g. m88k running svr) needs to use
|
237 |
|
|
different pseudo-op names for these, they may be overridden in the
|
238 |
|
|
file which includes this one. */
|
239 |
|
|
|
240 |
|
|
#define TYPE_ASM_OP "\t.type\t"
|
241 |
|
|
#define SIZE_ASM_OP "\t.size\t"
|
242 |
|
|
|
243 |
|
|
/* This is how we tell the assembler that a symbol is weak. */
|
244 |
|
|
|
245 |
|
|
#define ASM_WEAKEN_LABEL(FILE, NAME) \
|
246 |
|
|
do \
|
247 |
|
|
{ \
|
248 |
|
|
fputs ("\t.weak\t", (FILE)); \
|
249 |
|
|
assemble_name ((FILE), (NAME)); \
|
250 |
|
|
fputc ('\n', (FILE)); \
|
251 |
|
|
} \
|
252 |
|
|
while (0)
|
253 |
|
|
|
254 |
|
|
/* The following macro defines the format used to output the second
|
255 |
|
|
operand of the .type assembler directive. Different svr4 assemblers
|
256 |
|
|
expect various different forms for this operand. The one given here
|
257 |
|
|
is just a default. You may need to override it in your machine-
|
258 |
|
|
specific tm.h file (depending upon the particulars of your assembler). */
|
259 |
|
|
|
260 |
|
|
#define TYPE_OPERAND_FMT "@%s"
|
261 |
|
|
|
262 |
|
|
/* Write the extra assembler code needed to declare a function's result.
|
263 |
|
|
Most svr4 assemblers don't require any special declaration of the
|
264 |
|
|
result value, but there are exceptions. */
|
265 |
|
|
|
266 |
|
|
#ifndef ASM_DECLARE_RESULT
|
267 |
|
|
#define ASM_DECLARE_RESULT(FILE, RESULT)
|
268 |
|
|
#endif
|
269 |
|
|
|
270 |
|
|
/* These macros generate the special .type and .size directives which
|
271 |
|
|
are used to set the corresponding fields of the linker symbol table
|
272 |
|
|
entries in an ELF object file under SVR4. These macros also output
|
273 |
|
|
the starting labels for the relevant functions/objects. */
|
274 |
|
|
|
275 |
|
|
/* Write the extra assembler code needed to declare a function properly.
|
276 |
|
|
Some svr4 assemblers need to also have something extra said about the
|
277 |
|
|
function's return value. We allow for that here. */
|
278 |
|
|
|
279 |
|
|
#ifndef ASM_DECLARE_FUNCTION_NAME
|
280 |
|
|
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
|
281 |
|
|
do \
|
282 |
|
|
{ \
|
283 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
|
284 |
|
|
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
|
285 |
|
|
ASM_OUTPUT_LABEL (FILE, NAME); \
|
286 |
|
|
} \
|
287 |
|
|
while (0)
|
288 |
|
|
#endif
|
289 |
|
|
|
290 |
|
|
/* Write the extra assembler code needed to declare an object properly. */
|
291 |
|
|
|
292 |
|
|
#ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
|
293 |
|
|
#define USE_GNU_UNIQUE_OBJECT 1
|
294 |
|
|
#else
|
295 |
|
|
#define USE_GNU_UNIQUE_OBJECT 0
|
296 |
|
|
#endif
|
297 |
|
|
|
298 |
|
|
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
|
299 |
|
|
do \
|
300 |
|
|
{ \
|
301 |
|
|
HOST_WIDE_INT size; \
|
302 |
|
|
\
|
303 |
|
|
/* For template static data member instantiations or \
|
304 |
|
|
inline fn local statics and their guard variables, use \
|
305 |
|
|
gnu_unique_object so that they will be combined even under \
|
306 |
|
|
RTLD_LOCAL. Don't use gnu_unique_object for typeinfo, \
|
307 |
|
|
vtables and other read-only artificial decls. */ \
|
308 |
|
|
if (USE_GNU_UNIQUE_OBJECT && DECL_ONE_ONLY (DECL) \
|
309 |
|
|
&& (!DECL_ARTIFICIAL (DECL) || !TREE_READONLY (DECL))) \
|
310 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "gnu_unique_object"); \
|
311 |
|
|
else \
|
312 |
|
|
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
|
313 |
|
|
\
|
314 |
|
|
size_directive_output = 0; \
|
315 |
|
|
if (!flag_inhibit_size_directive \
|
316 |
|
|
&& (DECL) && DECL_SIZE (DECL)) \
|
317 |
|
|
{ \
|
318 |
|
|
size_directive_output = 1; \
|
319 |
|
|
size = int_size_in_bytes (TREE_TYPE (DECL)); \
|
320 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
|
321 |
|
|
} \
|
322 |
|
|
\
|
323 |
|
|
ASM_OUTPUT_LABEL (FILE, NAME); \
|
324 |
|
|
} \
|
325 |
|
|
while (0)
|
326 |
|
|
|
327 |
|
|
/* Output the size directive for a decl in rest_of_decl_compilation
|
328 |
|
|
in the case where we did not do so before the initializer.
|
329 |
|
|
Once we find the error_mark_node, we know that the value of
|
330 |
|
|
size_directive_output was set
|
331 |
|
|
by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
|
332 |
|
|
|
333 |
|
|
#undef ASM_FINISH_DECLARE_OBJECT
|
334 |
|
|
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
|
335 |
|
|
do \
|
336 |
|
|
{ \
|
337 |
|
|
const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
|
338 |
|
|
HOST_WIDE_INT size; \
|
339 |
|
|
\
|
340 |
|
|
if (!flag_inhibit_size_directive \
|
341 |
|
|
&& DECL_SIZE (DECL) \
|
342 |
|
|
&& ! AT_END && TOP_LEVEL \
|
343 |
|
|
&& DECL_INITIAL (DECL) == error_mark_node \
|
344 |
|
|
&& !size_directive_output) \
|
345 |
|
|
{ \
|
346 |
|
|
size_directive_output = 1; \
|
347 |
|
|
size = int_size_in_bytes (TREE_TYPE (DECL)); \
|
348 |
|
|
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
|
349 |
|
|
} \
|
350 |
|
|
} \
|
351 |
|
|
while (0)
|
352 |
|
|
|
353 |
|
|
/* This is how to declare the size of a function. */
|
354 |
|
|
#ifndef ASM_DECLARE_FUNCTION_SIZE
|
355 |
|
|
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
|
356 |
|
|
do \
|
357 |
|
|
{ \
|
358 |
|
|
if (!flag_inhibit_size_directive) \
|
359 |
|
|
ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
|
360 |
|
|
} \
|
361 |
|
|
while (0)
|
362 |
|
|
#endif
|
363 |
|
|
|
364 |
|
|
/* A table of bytes codes used by the ASM_OUTPUT_ASCII and
|
365 |
|
|
ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
|
366 |
|
|
corresponds to a particular byte value [0..255]. For any
|
367 |
|
|
given byte value, if the value in the corresponding table
|
368 |
|
|
position is zero, the given character can be output directly.
|
369 |
|
|
If the table value is 1, the byte must be output as a \ooo
|
370 |
|
|
octal escape. If the tables value is anything else, then the
|
371 |
|
|
byte value should be output as a \ followed by the value
|
372 |
|
|
in the table. Note that we can use standard UN*X escape
|
373 |
|
|
sequences for many control characters, but we don't use
|
374 |
|
|
\a to represent BEL because some svr4 assemblers (e.g. on
|
375 |
|
|
the i386) don't know about that. Also, we don't use \v
|
376 |
|
|
since some versions of gas, such as 2.2 did not accept it. */
|
377 |
|
|
|
378 |
|
|
#define ESCAPES \
|
379 |
|
|
"\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\
|
380 |
|
|
\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\
|
381 |
|
|
\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\
|
382 |
|
|
\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\
|
383 |
|
|
\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\
|
384 |
|
|
\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\
|
385 |
|
|
\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\
|
386 |
|
|
\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"
|
387 |
|
|
|
388 |
|
|
/* Some svr4 assemblers have a limit on the number of characters which
|
389 |
|
|
can appear in the operand of a .string directive. If your assembler
|
390 |
|
|
has such a limitation, you should define STRING_LIMIT to reflect that
|
391 |
|
|
limit. Note that at least some svr4 assemblers have a limit on the
|
392 |
|
|
actual number of bytes in the double-quoted string, and that they
|
393 |
|
|
count each character in an escape sequence as one byte. Thus, an
|
394 |
|
|
escape sequence like \377 would count as four bytes.
|
395 |
|
|
|
396 |
|
|
If your target assembler doesn't support the .string directive, you
|
397 |
|
|
should define this to zero.
|
398 |
|
|
*/
|
399 |
|
|
|
400 |
|
|
#define STRING_LIMIT ((unsigned) 256)
|
401 |
|
|
|
402 |
|
|
#define STRING_ASM_OP "\t.string\t"
|
403 |
|
|
|
404 |
|
|
/* The routine used to output NUL terminated strings. We use a special
|
405 |
|
|
version of this for most svr4 targets because doing so makes the
|
406 |
|
|
generated assembly code more compact (and thus faster to assemble)
|
407 |
|
|
as well as more readable, especially for targets like the i386
|
408 |
|
|
(where the only alternative is to output character sequences as
|
409 |
|
|
comma separated lists of numbers). */
|
410 |
|
|
|
411 |
|
|
#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
|
412 |
|
|
do \
|
413 |
|
|
{ \
|
414 |
|
|
register const unsigned char *_limited_str = \
|
415 |
|
|
(const unsigned char *) (STR); \
|
416 |
|
|
register unsigned ch; \
|
417 |
|
|
\
|
418 |
|
|
fprintf ((FILE), "%s\"", STRING_ASM_OP); \
|
419 |
|
|
\
|
420 |
|
|
for (; (ch = *_limited_str); _limited_str++) \
|
421 |
|
|
{ \
|
422 |
|
|
register int escape; \
|
423 |
|
|
\
|
424 |
|
|
switch (escape = ESCAPES[ch]) \
|
425 |
|
|
{ \
|
426 |
|
|
case 0: \
|
427 |
|
|
putc (ch, (FILE)); \
|
428 |
|
|
break; \
|
429 |
|
|
case 1: \
|
430 |
|
|
fprintf ((FILE), "\\%03o", ch); \
|
431 |
|
|
break; \
|
432 |
|
|
default: \
|
433 |
|
|
putc ('\\', (FILE)); \
|
434 |
|
|
putc (escape, (FILE)); \
|
435 |
|
|
break; \
|
436 |
|
|
} \
|
437 |
|
|
} \
|
438 |
|
|
\
|
439 |
|
|
fprintf ((FILE), "\"\n"); \
|
440 |
|
|
} \
|
441 |
|
|
while (0)
|
442 |
|
|
|
443 |
|
|
/* The routine used to output sequences of byte values. We use a special
|
444 |
|
|
version of this for most svr4 targets because doing so makes the
|
445 |
|
|
generated assembly code more compact (and thus faster to assemble)
|
446 |
|
|
as well as more readable. Note that if we find subparts of the
|
447 |
|
|
character sequence which end with NUL (and which are shorter than
|
448 |
|
|
STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
|
449 |
|
|
|
450 |
|
|
#undef ASM_OUTPUT_ASCII
|
451 |
|
|
#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
|
452 |
|
|
do \
|
453 |
|
|
{ \
|
454 |
|
|
const unsigned char *_ascii_bytes = \
|
455 |
|
|
(const unsigned char *) (STR); \
|
456 |
|
|
const unsigned char *limit = _ascii_bytes + (LENGTH); \
|
457 |
|
|
const unsigned char *last_null = NULL; \
|
458 |
|
|
unsigned bytes_in_chunk = 0; \
|
459 |
|
|
\
|
460 |
|
|
for (; _ascii_bytes < limit; _ascii_bytes++) \
|
461 |
|
|
{ \
|
462 |
|
|
const unsigned char *p; \
|
463 |
|
|
\
|
464 |
|
|
if (bytes_in_chunk >= 60) \
|
465 |
|
|
{ \
|
466 |
|
|
fprintf ((FILE), "\"\n"); \
|
467 |
|
|
bytes_in_chunk = 0; \
|
468 |
|
|
} \
|
469 |
|
|
\
|
470 |
|
|
if (_ascii_bytes > last_null) \
|
471 |
|
|
{ \
|
472 |
|
|
for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
|
473 |
|
|
continue; \
|
474 |
|
|
last_null = p; \
|
475 |
|
|
} \
|
476 |
|
|
else \
|
477 |
|
|
p = last_null; \
|
478 |
|
|
\
|
479 |
|
|
if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \
|
480 |
|
|
{ \
|
481 |
|
|
if (bytes_in_chunk > 0) \
|
482 |
|
|
{ \
|
483 |
|
|
fprintf ((FILE), "\"\n"); \
|
484 |
|
|
bytes_in_chunk = 0; \
|
485 |
|
|
} \
|
486 |
|
|
\
|
487 |
|
|
ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
|
488 |
|
|
_ascii_bytes = p; \
|
489 |
|
|
} \
|
490 |
|
|
else \
|
491 |
|
|
{ \
|
492 |
|
|
register int escape; \
|
493 |
|
|
register unsigned ch; \
|
494 |
|
|
\
|
495 |
|
|
if (bytes_in_chunk == 0) \
|
496 |
|
|
fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP); \
|
497 |
|
|
\
|
498 |
|
|
switch (escape = ESCAPES[ch = *_ascii_bytes]) \
|
499 |
|
|
{ \
|
500 |
|
|
case 0: \
|
501 |
|
|
putc (ch, (FILE)); \
|
502 |
|
|
bytes_in_chunk++; \
|
503 |
|
|
break; \
|
504 |
|
|
case 1: \
|
505 |
|
|
fprintf ((FILE), "\\%03o", ch); \
|
506 |
|
|
bytes_in_chunk += 4; \
|
507 |
|
|
break; \
|
508 |
|
|
default: \
|
509 |
|
|
putc ('\\', (FILE)); \
|
510 |
|
|
putc (escape, (FILE)); \
|
511 |
|
|
bytes_in_chunk += 2; \
|
512 |
|
|
break; \
|
513 |
|
|
} \
|
514 |
|
|
} \
|
515 |
|
|
} \
|
516 |
|
|
\
|
517 |
|
|
if (bytes_in_chunk > 0) \
|
518 |
|
|
fprintf ((FILE), "\"\n"); \
|
519 |
|
|
} \
|
520 |
|
|
while (0)
|
521 |
|
|
|
522 |
|
|
/* Allow the use of the -frecord-gcc-switches switch via the
|
523 |
|
|
elf_record_gcc_switches function defined in varasm.c. */
|
524 |
|
|
#undef TARGET_ASM_RECORD_GCC_SWITCHES
|
525 |
|
|
#define TARGET_ASM_RECORD_GCC_SWITCHES elf_record_gcc_switches
|
526 |
|
|
|
527 |
|
|
/* A C statement (sans semicolon) to output to the stdio stream STREAM
|
528 |
|
|
any text necessary for declaring the name of an external symbol
|
529 |
|
|
named NAME which is referenced in this compilation but not defined.
|
530 |
|
|
It is needed to properly support non-default visibility. */
|
531 |
|
|
|
532 |
|
|
#ifndef ASM_OUTPUT_EXTERNAL
|
533 |
|
|
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
|
534 |
|
|
default_elf_asm_output_external (FILE, DECL, NAME)
|
535 |
|
|
#endif
|