]>
Commit | Line | Data |
---|---|---|
99dee823 | 1 | /* Copyright (C) 2016-2021 Free Software Foundation, Inc. |
5326695a AS |
2 | |
3 | This file is free software; you can redistribute it and/or modify it under | |
4 | the terms of the GNU General Public License as published by the Free | |
5 | Software Foundation; either version 3 of the License, or (at your option) | |
6 | any later version. | |
7 | ||
8 | This file is distributed in the hope that it will be useful, but WITHOUT | |
9 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
10 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
11 | for more details. | |
12 | ||
13 | You should have received a copy of the GNU General Public License | |
14 | along with GCC; see the file COPYING3. If not see | |
15 | <http://www.gnu.org/licenses/>. */ | |
16 | ||
17 | #ifndef OBJECT_FORMAT_ELF | |
18 | #error elf.h included before elfos.h | |
19 | #endif | |
20 | ||
f062c3f1 AS |
21 | #define TEXT_SECTION_ASM_OP "\t.text" |
22 | #define BSS_SECTION_ASM_OP "\t.bss" | |
5326695a AS |
23 | #define GLOBAL_ASM_OP "\t.globl\t" |
24 | #define DATA_SECTION_ASM_OP "\t.data\t" | |
25 | #define SET_ASM_OP "\t.set\t" | |
26 | #define LOCAL_LABEL_PREFIX "." | |
27 | #define USER_LABEL_PREFIX "" | |
28 | #define ASM_COMMENT_START ";" | |
29 | #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section | |
30 | ||
31 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ | |
32 | asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) | |
33 | ||
34 | #undef ASM_DECLARE_FUNCTION_NAME | |
35 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ | |
36 | gcn_hsa_declare_function_name ((FILE), (NAME), (DECL)) | |
37 | ||
38 | /* Unlike GNU as, the LLVM assembler uses log2 alignments. */ | |
39 | #undef ASM_OUTPUT_ALIGNED_COMMON | |
40 | #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGNMENT) \ | |
41 | (fprintf ((FILE), "%s", COMMON_ASM_OP), \ | |
42 | assemble_name ((FILE), (NAME)), \ | |
43 | fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", \ | |
44 | (SIZE) > 0 ? (SIZE) : 1, exact_log2 ((ALIGNMENT) / BITS_PER_UNIT))) | |
45 | ||
46 | #define ASM_OUTPUT_LABEL(FILE,NAME) \ | |
47 | do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) | |
48 | ||
49 | #define ASM_OUTPUT_LABELREF(FILE, NAME) \ | |
50 | asm_fprintf (FILE, "%U%s", default_strip_name_encoding (NAME)) | |
51 | ||
52 | extern unsigned int gcn_local_sym_hash (const char *name); | |
53 | ||
54 | #define ASM_OUTPUT_SYMBOL_REF(FILE, X) gcn_asm_output_symbol_ref (FILE, X) | |
55 | ||
56 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ | |
57 | fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL) | |
58 | ||
59 | #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ | |
60 | fprintf (FILE, "\t.word .L%d\n", VALUE) | |
61 | ||
62 | #define ASM_OUTPUT_ALIGN(FILE,LOG) \ | |
63 | do { if (LOG!=0) fprintf (FILE, "\t.align\t%d\n", 1<<(LOG)); } while (0) | |
64 | #define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG) \ | |
65 | do { \ | |
66 | if (LOG!=0) \ | |
67 | fprintf (FILE, "\t.p2alignl\t%d, 0xBF800000" \ | |
68 | " ; Fill value is 's_nop 0'\n", (LOG)); \ | |
69 | } while (0) | |
70 | ||
71 | #define ASM_APP_ON "" | |
72 | #define ASM_APP_OFF "" | |
73 | ||
74 | /* Avoid the default in ../../gcc.c, which adds "-pthread", which is not | |
75 | supported for gcn. */ | |
76 | #define GOMP_SELF_SPECS "" | |
77 | ||
78 | /* Use LLVM assembler and linker options. */ | |
f062c3f1 | 79 | #define ASM_SPEC "-triple=amdgcn--amdhsa " \ |
5326695a AS |
80 | "%:last_arg(%{march=*:-mcpu=%*}) " \ |
81 | "-filetype=obj" | |
f062c3f1 | 82 | #define LINK_SPEC "--pie --export-dynamic" |
5326695a AS |
83 | #define LIB_SPEC "-lc" |
84 | ||
85 | /* Provides a _start symbol to keep the linker happy. */ | |
86 | #define STARTFILE_SPEC "crt0.o%s" | |
87 | #define ENDFILE_SPEC "" | |
88 | #define STANDARD_STARTFILE_PREFIX_2 "" | |
89 | ||
90 | /* The LLVM assembler rejects multiple -mcpu options, so we must drop | |
91 | all but the last. */ | |
92 | extern const char *last_arg_spec_function (int argc, const char **argv); | |
93 | #define EXTRA_SPEC_FUNCTIONS \ | |
94 | { "last_arg", last_arg_spec_function }, | |
95 | ||
96 | #undef LOCAL_INCLUDE_DIR | |
97 | ||
98 | /* FIXME: Review debug info settings. | |
99 | * In particular, EH_FRAME_THROUGH_COLLECT2 is probably the wrong | |
100 | * thing but stuff fails to build without it. | |
101 | * (Debug info is not a big deal until we get a debugger.) */ | |
102 | #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
103 | #define DWARF2_DEBUGGING_INFO 1 | |
104 | #define DWARF2_ASM_LINE_DEBUG_INFO 1 | |
105 | #define EH_FRAME_THROUGH_COLLECT2 1 | |
eff23b79 | 106 | #define DBX_REGISTER_NUMBER(REGNO) gcn_dwarf_register_number (REGNO) |