testsuite: remove SPE tests.
[official-gcc.git] / gcc / config / elfos.h
blob74a3eafda6be1134cfc128d5f2577cdeaea7dcb7
1 /* elfos.h -- operating system specific defines to be used when
2 targeting GCC for some generic ELF system
3 Copyright (C) 1991-2020 Free Software Foundation, Inc.
4 Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
27 #define TARGET_OBJFMT_CPP_BUILTINS() \
28 do \
29 { \
30 builtin_define ("__ELF__"); \
31 } \
32 while (0)
34 /* Define a symbol indicating that we are using elfos.h.
35 Some CPU specific configuration files use this. */
36 #define USING_ELFOS_H
38 /* The prefix to add to user-visible assembler symbols.
40 For ELF systems the convention is *not* to prepend a leading
41 underscore onto user-level symbol names. */
43 #undef USER_LABEL_PREFIX
44 #define USER_LABEL_PREFIX ""
46 /* The biggest alignment supported by ELF in bits. 32-bit ELF
47 supports section alignment up to (0x80000000 * 8), while
48 64-bit ELF supports (0x8000000000000000 * 8). If this macro
49 is not defined, the default is the largest alignment supported
50 by 32-bit ELF and representable on a 32-bit host. Use this
51 macro to limit the alignment which can be specified using
52 the `__attribute__ ((aligned (N)))' construct. */
53 #ifndef MAX_OFILE_ALIGNMENT
54 #define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8)
55 #endif
57 /* Use periods rather than dollar signs in special g++ assembler names. */
59 #define NO_DOLLAR_IN_LABEL
61 /* Writing `int' for a bit-field forces int alignment for the structure. */
63 #ifndef PCC_BITFIELD_TYPE_MATTERS
64 #define PCC_BITFIELD_TYPE_MATTERS 1
65 #endif
67 /* All ELF targets can support DWARF-2. */
69 #define DWARF2_DEBUGGING_INFO 1
71 /* The GNU tools operate better with dwarf2, and it is required by some
72 psABI's. Since we don't have any native tools to be compatible with,
73 default to dwarf2. */
75 #ifndef PREFERRED_DEBUGGING_TYPE
76 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
77 #endif
79 /* All SVR4 targets use the ELF object file format. */
80 #define OBJECT_FORMAT_ELF
83 /* Output #ident as a .ident. */
85 #undef TARGET_ASM_OUTPUT_IDENT
86 #define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive
88 #undef SET_ASM_OP
89 #define SET_ASM_OP "\t.set\t"
91 /* Most svr4 assemblers want a .file directive at the beginning of
92 their input file. */
93 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
95 /* This is how to allocate empty space in some section. The .zero
96 pseudo-op is used for this on most svr4 assemblers. */
98 #define SKIP_ASM_OP "\t.zero\t"
100 #undef ASM_OUTPUT_SKIP
101 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
102 fprintf ((FILE), "%s" HOST_WIDE_INT_PRINT_UNSIGNED "\n",\
103 SKIP_ASM_OP, (SIZE))
105 /* This is how to store into the string LABEL
106 the symbol_ref name of an internal numbered label where
107 PREFIX is the class of label and NUM is the number within the class.
108 This is suitable for output with `assemble_name'.
110 For most svr4 systems, the convention is that any symbol which begins
111 with a period is not put into the linker symbol table by the assembler. */
113 #undef ASM_GENERATE_INTERNAL_LABEL
114 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
115 do \
117 char *__p; \
118 (LABEL)[0] = '*'; \
119 (LABEL)[1] = '.'; \
120 __p = stpcpy (&(LABEL)[2], PREFIX); \
121 sprint_ul (__p, (unsigned long) (NUM)); \
123 while (0)
125 /* Output the label which precedes a jumptable. Note that for all svr4
126 systems where we actually generate jumptables (which is to say every
127 svr4 target except i386, where we use casesi instead) we put the jump-
128 tables into the .rodata section and since other stuff could have been
129 put into the .rodata section prior to any given jumptable, we have to
130 make sure that the location counter for the .rodata section gets pro-
131 perly re-aligned prior to the actual beginning of the jump table. */
133 #undef ALIGN_ASM_OP
134 #define ALIGN_ASM_OP "\t.align\t"
136 #ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
137 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
138 ASM_OUTPUT_ALIGN ((FILE), 2)
139 #endif
141 #undef ASM_OUTPUT_CASE_LABEL
142 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
143 do \
145 ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE); \
146 (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); \
148 while (0)
150 /* The standard SVR4 assembler seems to require that certain builtin
151 library routines (e.g. .udiv) be explicitly declared as .globl
152 in each assembly file where they are referenced. */
154 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
155 (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
157 /* This says how to output assembler code to declare an
158 uninitialized external linkage data object. Under SVR4,
159 the linker seems to want the alignment of data objects
160 to depend on their types. We do exactly that here. */
162 #define COMMON_ASM_OP "\t.comm\t"
164 #undef ASM_OUTPUT_ALIGNED_COMMON
165 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
166 do \
168 fprintf ((FILE), "%s", COMMON_ASM_OP); \
169 assemble_name ((FILE), (NAME)); \
170 fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", \
171 (SIZE), (ALIGN) / BITS_PER_UNIT); \
173 while (0)
175 /* This says how to output assembler code to declare an
176 uninitialized internal linkage data object. Under SVR4,
177 the linker seems to want the alignment of data objects
178 to depend on their types. We do exactly that here. */
180 #define LOCAL_ASM_OP "\t.local\t"
182 #undef ASM_OUTPUT_ALIGNED_LOCAL
183 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
184 do \
186 fprintf ((FILE), "%s", LOCAL_ASM_OP); \
187 assemble_name ((FILE), (NAME)); \
188 fprintf ((FILE), "\n"); \
189 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
191 while (0)
193 /* This is the pseudo-op used to generate a contiguous sequence of byte
194 values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
195 AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */
197 #undef ASCII_DATA_ASM_OP
198 #define ASCII_DATA_ASM_OP "\t.ascii\t"
200 /* Support a read-only data section. */
201 #define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata"
203 /* On svr4, we *do* have support for the .init and .fini sections, and we
204 can put stuff in there to be executed before and after `main'. We let
205 crtstuff.c and other files know this by defining the following symbols.
206 The definitions say how to change sections to the .init and .fini
207 sections. This is the same for all known svr4 assemblers. */
209 #define INIT_SECTION_ASM_OP "\t.section\t.init"
210 #define FINI_SECTION_ASM_OP "\t.section\t.fini"
212 /* Output assembly directive to move to the beginning of current section. */
213 #ifdef HAVE_GAS_SUBSECTION_ORDERING
214 # define ASM_SECTION_START_OP "\t.subsection\t-1"
215 # define ASM_OUTPUT_SECTION_START(FILE) \
216 fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
217 #endif
219 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
221 /* Switch into a generic section. */
222 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
224 #undef TARGET_ASM_SELECT_RTX_SECTION
225 #define TARGET_ASM_SELECT_RTX_SECTION default_elf_select_rtx_section
226 #undef TARGET_ASM_SELECT_SECTION
227 #define TARGET_ASM_SELECT_SECTION default_elf_select_section
228 #undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
229 #define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS true
231 /* Define the strings used for the special svr4 .type and .size directives.
232 These strings generally do not vary from one system running svr4 to
233 another, but if a given system (e.g. m88k running svr) needs to use
234 different pseudo-op names for these, they may be overridden in the
235 file which includes this one. */
237 #define TYPE_ASM_OP "\t.type\t"
238 #define SIZE_ASM_OP "\t.size\t"
240 /* This is how we tell the assembler that a symbol is weak. */
242 #define ASM_WEAKEN_LABEL(FILE, NAME) \
243 do \
245 fputs ("\t.weak\t", (FILE)); \
246 assemble_name ((FILE), (NAME)); \
247 fputc ('\n', (FILE)); \
249 while (0)
251 #define ASM_OUTPUT_SYMVER_DIRECTIVE(FILE, NAME, NAME2) \
252 do \
254 fputs ("\t.symver\t", (FILE)); \
255 assemble_name ((FILE), (NAME)); \
256 fputs (", ", (FILE)); \
257 assemble_name ((FILE), (NAME2)); \
258 fputc ('\n', (FILE)); \
260 while (0)
262 /* The following macro defines the format used to output the second
263 operand of the .type assembler directive. Different svr4 assemblers
264 expect various different forms for this operand. The one given here
265 is just a default. You may need to override it in your machine-
266 specific tm.h file (depending upon the particulars of your assembler). */
268 #define TYPE_OPERAND_FMT "@%s"
270 /* Write the extra assembler code needed to declare a function's result.
271 Most svr4 assemblers don't require any special declaration of the
272 result value, but there are exceptions. */
274 #ifndef ASM_DECLARE_RESULT
275 #define ASM_DECLARE_RESULT(FILE, RESULT)
276 #endif
278 /* These macros generate the special .type and .size directives which
279 are used to set the corresponding fields of the linker symbol table
280 entries in an ELF object file under SVR4. These macros also output
281 the starting labels for the relevant functions/objects. */
283 /* Write the extra assembler code needed to declare a function properly.
284 Some svr4 assemblers need to also have something extra said about the
285 function's return value. We allow for that here. */
287 #ifndef ASM_DECLARE_FUNCTION_NAME
288 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
289 do \
291 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
292 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
293 ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
295 while (0)
296 #endif
298 /* Write the extra assembler code needed to declare the name of a
299 cold function partition properly. Some svr4 assemblers need to also
300 have something extra said about the function's return value. We
301 allow for that here. */
303 #ifndef ASM_DECLARE_COLD_FUNCTION_NAME
304 #define ASM_DECLARE_COLD_FUNCTION_NAME(FILE, NAME, DECL) \
305 do \
307 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
308 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
309 ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \
311 while (0)
312 #endif
314 /* Write the extra assembler code needed to declare an object properly. */
316 #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
317 #define USE_GNU_UNIQUE_OBJECT flag_gnu_unique
318 #else
319 #define USE_GNU_UNIQUE_OBJECT 0
320 #endif
322 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
323 do \
325 HOST_WIDE_INT size; \
327 /* For template static data member instantiations or \
328 inline fn local statics and their guard variables, use \
329 gnu_unique_object so that they will be combined even under \
330 RTLD_LOCAL. Don't use gnu_unique_object for typeinfo, \
331 vtables and other read-only artificial decls. */ \
332 if (USE_GNU_UNIQUE_OBJECT && DECL_ONE_ONLY (DECL) \
333 && (!DECL_ARTIFICIAL (DECL) || !TREE_READONLY (DECL))) \
334 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "gnu_unique_object"); \
335 else \
336 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
338 size_directive_output = 0; \
339 if (!flag_inhibit_size_directive \
340 && (DECL) && DECL_SIZE (DECL)) \
342 size_directive_output = 1; \
343 size = tree_to_uhwi (DECL_SIZE_UNIT (DECL)); \
344 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
347 ASM_OUTPUT_LABEL (FILE, NAME); \
349 while (0)
351 /* Output the size directive for a decl in rest_of_decl_compilation
352 in the case where we did not do so before the initializer.
353 Once we find the error_mark_node, we know that the value of
354 size_directive_output was set
355 by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
357 #undef ASM_FINISH_DECLARE_OBJECT
358 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
359 do \
361 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
362 HOST_WIDE_INT size; \
364 if (!flag_inhibit_size_directive \
365 && DECL_SIZE (DECL) \
366 && ! AT_END && TOP_LEVEL \
367 && DECL_INITIAL (DECL) == error_mark_node \
368 && !size_directive_output) \
370 size_directive_output = 1; \
371 size = tree_to_uhwi (DECL_SIZE_UNIT (DECL)); \
372 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
375 while (0)
377 /* This is how to declare the size of a function. */
378 #ifndef ASM_DECLARE_FUNCTION_SIZE
379 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
380 do \
382 if (!flag_inhibit_size_directive) \
383 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
385 while (0)
386 #endif
388 /* This is how to declare the size of a cold function partition. */
389 #ifndef ASM_DECLARE_COLD_FUNCTION_SIZE
390 #define ASM_DECLARE_COLD_FUNCTION_SIZE(FILE, FNAME, DECL) \
391 do \
393 if (!flag_inhibit_size_directive) \
394 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
396 while (0)
397 #endif
399 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
400 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
401 corresponds to a particular byte value [0..255]. For any
402 given byte value, if the value in the corresponding table
403 position is zero, the given character can be output directly.
404 If the table value is 1, the byte must be output as a \ooo
405 octal escape. If the tables value is anything else, then the
406 byte value should be output as a \ followed by the value
407 in the table. Note that we can use standard UN*X escape
408 sequences for many control characters, but we don't use
409 \a to represent BEL because some svr4 assemblers (e.g. on
410 the i386) don't know about that. Also, we don't use \v
411 since some versions of gas, such as 2.2 did not accept it. */
413 #define ELF_ASCII_ESCAPES \
414 "\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\
415 \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\
416 \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\
417 \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\
418 \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\
419 \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\
420 \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\
421 \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"
423 /* Some svr4 assemblers have a limit on the number of characters which
424 can appear in the operand of a .string directive. If your assembler
425 has such a limitation, you should define STRING_LIMIT to reflect that
426 limit. Note that at least some svr4 assemblers have a limit on the
427 actual number of bytes in the double-quoted string, and that they
428 count each character in an escape sequence as one byte. Thus, an
429 escape sequence like \377 would count as four bytes.
431 If your target assembler doesn't support the .string directive, you
432 should define this to zero.
435 #define ELF_STRING_LIMIT ((unsigned) 256)
437 #define STRING_ASM_OP "\t.string\t"
439 /* The routine used to output NUL terminated strings. We use a special
440 version of this for most svr4 targets because doing so makes the
441 generated assembly code more compact (and thus faster to assemble)
442 as well as more readable, especially for targets like the i386
443 (where the only alternative is to output character sequences as
444 comma separated lists of numbers). */
446 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
447 default_elf_asm_output_limited_string ((FILE), (STR))
449 /* The routine used to output sequences of byte values. We use a special
450 version of this for most svr4 targets because doing so makes the
451 generated assembly code more compact (and thus faster to assemble)
452 as well as more readable. Note that if we find subparts of the
453 character sequence which end with NUL (and which are shorter than
454 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
456 #undef ASM_OUTPUT_ASCII
457 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
458 default_elf_asm_output_ascii ((FILE), (STR), (LENGTH))
460 /* Allow the use of the -frecord-gcc-switches switch via the
461 elf_record_gcc_switches function defined in varasm.c. */
462 #undef TARGET_ASM_RECORD_GCC_SWITCHES
463 #define TARGET_ASM_RECORD_GCC_SWITCHES elf_record_gcc_switches
465 /* A C statement (sans semicolon) to output to the stdio stream STREAM
466 any text necessary for declaring the name of an external symbol
467 named NAME which is referenced in this compilation but not defined.
468 It is needed to properly support non-default visibility. */
470 #ifndef ASM_OUTPUT_EXTERNAL
471 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
472 default_elf_asm_output_external (FILE, DECL, NAME)
473 #endif
475 #undef TARGET_LIBC_HAS_FUNCTION
476 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function