Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* tc-sparc.h - Macros and type defines for the sparc. |
6f2750fe | 2 | Copyright (C) 1989-2016 Free Software Foundation, Inc. |
252b5132 RH |
3 | |
4 | This file is part of GAS, the GNU Assembler. | |
5 | ||
6 | GAS is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as | |
ec2655a6 | 8 | published by the Free Software Foundation; either version 3, |
252b5132 RH |
9 | or (at your option) any later version. |
10 | ||
11 | GAS is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
14 | the GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public | |
17 | License along with GAS; see the file COPYING. If not, write | |
4b4da160 NC |
18 | to the Free Software Foundation, 51 Franklin Street - Fifth Floor, |
19 | Boston, MA 02110-1301, USA. */ | |
252b5132 RH |
20 | |
21 | #ifndef TC_SPARC | |
22 | #define TC_SPARC 1 | |
23 | ||
252b5132 | 24 | struct frag; |
252b5132 RH |
25 | |
26 | /* This is used to set the default value for `target_big_endian'. */ | |
27 | #define TARGET_BYTES_BIG_ENDIAN 1 | |
28 | ||
29 | #define LOCAL_LABELS_FB 1 | |
30 | ||
31 | #define TARGET_ARCH bfd_arch_sparc | |
32 | ||
71a75f6f | 33 | #ifdef TE_FreeBSD |
c5d685bf | 34 | #define ELF_TARGET_FORMAT "elf32-sparc" |
71a75f6f MF |
35 | #define ELF64_TARGET_FORMAT "elf64-sparc-freebsd" |
36 | #endif | |
37 | ||
1360ba76 RO |
38 | #ifdef TE_SOLARIS |
39 | #define ELF_TARGET_FORMAT "elf32-sparc-sol2" | |
40 | #define ELF64_TARGET_FORMAT "elf64-sparc-sol2" | |
41 | #endif | |
42 | ||
71a75f6f MF |
43 | #ifndef ELF_TARGET_FORMAT |
44 | #define ELF_TARGET_FORMAT "elf32-sparc" | |
45 | #endif | |
46 | ||
47 | #ifndef ELF64_TARGET_FORMAT | |
48 | #define ELF64_TARGET_FORMAT "elf64-sparc" | |
49 | #endif | |
50 | ||
5a49b8ac | 51 | extern const char *sparc_target_format (void); |
252b5132 RH |
52 | #define TARGET_FORMAT sparc_target_format () |
53 | ||
dabe3bbc RH |
54 | #define RELOC_EXPANSION_POSSIBLE |
55 | #define MAX_RELOC_EXPANSION 2 | |
56 | ||
252b5132 RH |
57 | /* Make it unconditional and check if -EL is valid after option parsing */ |
58 | #define SPARC_BIENDIAN | |
59 | ||
60 | #define WORKING_DOT_WORD | |
61 | ||
0a9ef439 RH |
62 | #define md_convert_frag(b,s,f) \ |
63 | as_fatal (_("sparc convert_frag\n")) | |
252b5132 | 64 | #define md_estimate_size_before_relax(f,s) \ |
07726851 | 65 | (as_fatal (_("estimate_size_before_relax called")), 1) |
252b5132 RH |
66 | |
67 | #define LISTING_HEADER "SPARC GAS " | |
68 | ||
69 | extern int sparc_pic_code; | |
70 | ||
252b5132 RH |
71 | /* We require .word, et. al., to be aligned correctly. */ |
72 | #define md_cons_align(nbytes) sparc_cons_align (nbytes) | |
5a49b8ac | 73 | extern void sparc_cons_align (int); |
0a9ef439 | 74 | |
252b5132 | 75 | #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp) |
5a49b8ac | 76 | extern void sparc_handle_align (struct frag *); |
252b5132 | 77 | |
0a9ef439 RH |
78 | #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4) |
79 | ||
252b5132 RH |
80 | /* I know that "call 0" fails in sparc-coff if this doesn't return 1. I |
81 | don't know about other relocation types, or other formats, yet. */ | |
82 | #ifdef OBJ_COFF | |
a161fe53 AM |
83 | #define TC_FORCE_RELOCATION_ABS(FIX) \ |
84 | ((FIX)->fx_r_type == BFD_RELOC_32_PCREL_S2 \ | |
85 | || TC_FORCE_RELOCATION (FIX)) | |
86 | ||
252b5132 RH |
87 | #define RELOC_REQUIRES_SYMBOL |
88 | #endif | |
89 | ||
a161fe53 AM |
90 | #ifdef OBJ_AOUT |
91 | /* This expression evaluates to true if the relocation is for a local | |
92 | object for which we still want to do the relocation at runtime. | |
93 | False if we are willing to perform this relocation while building | |
94 | the .o file. */ | |
95 | ||
96 | #define TC_FORCE_RELOCATION_LOCAL(FIX) \ | |
97 | (!(FIX)->fx_pcrel \ | |
a161fe53 AM |
98 | || (sparc_pic_code \ |
99 | && S_IS_EXTERNAL ((FIX)->fx_addsy)) \ | |
100 | || TC_FORCE_RELOCATION (FIX)) | |
252b5132 RH |
101 | #endif |
102 | ||
252b5132 | 103 | #ifdef OBJ_ELF |
a161fe53 AM |
104 | /* Don't turn certain relocs into relocations against sections. This |
105 | is required for the dynamic linker to operate properly. When | |
106 | generating PIC, we need to keep any non PC relative reloc. The PIC | |
107 | part of this test must be parallel to the code in tc_gen_reloc which | |
108 | converts relocations to GOT relocations. */ | |
252b5132 | 109 | #define tc_fix_adjustable(FIX) \ |
a161fe53 | 110 | ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \ |
d2e71411 | 111 | && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \ |
b9734f35 JJ |
112 | && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22 \ |
113 | || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64) \ | |
252b5132 | 114 | && (! sparc_pic_code \ |
a1f2d742 ILT |
115 | || ((FIX)->fx_r_type != BFD_RELOC_HI22 \ |
116 | && (FIX)->fx_r_type != BFD_RELOC_LO10 \ | |
117 | && (FIX)->fx_r_type != BFD_RELOC_SPARC13 \ | |
118 | && ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2 \ | |
ae6063d4 | 119 | || !generic_force_reloc (FIX)) \ |
a1f2d742 ILT |
120 | && ((FIX)->fx_pcrel \ |
121 | || ((FIX)->fx_subsy != NULL \ | |
122 | && (S_GET_SEGMENT ((FIX)->fx_subsy) \ | |
123 | == S_GET_SEGMENT ((FIX)->fx_addsy))) \ | |
124 | || S_IS_LOCAL ((FIX)->fx_addsy))))) | |
6d8809aa | 125 | |
55cf6793 | 126 | /* Values passed to md_apply_fix don't include the symbol value. */ |
a161fe53 AM |
127 | #define MD_APPLY_SYM_VALUE(FIX) 0 |
128 | ||
6d8809aa RH |
129 | /* Finish up the entire symtab. */ |
130 | #define tc_adjust_symtab() sparc_adjust_symtab () | |
5a49b8ac | 131 | extern void sparc_adjust_symtab (void); |
252b5132 RH |
132 | #endif |
133 | ||
134 | #ifdef OBJ_AOUT | |
135 | /* When generating PIC code, we must not adjust any reloc which will | |
136 | turn into a reloc against the global offset table, nor any reloc | |
137 | which we will need if a symbol is overridden. */ | |
138 | #define tc_fix_adjustable(FIX) \ | |
139 | (! sparc_pic_code \ | |
140 | || ((FIX)->fx_pcrel \ | |
141 | && ((FIX)->fx_addsy == NULL \ | |
142 | || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \ | |
143 | && ! S_IS_WEAK ((FIX)->fx_addsy)))) \ | |
144 | || (FIX)->fx_r_type == BFD_RELOC_16 \ | |
145 | || (FIX)->fx_r_type == BFD_RELOC_32) | |
146 | #endif | |
147 | ||
148 | #define elf_tc_final_processing sparc_elf_final_processing | |
5a49b8ac | 149 | extern void sparc_elf_final_processing (void); |
252b5132 RH |
150 | |
151 | #define md_operand(x) | |
152 | ||
5a49b8ac | 153 | extern void sparc_md_end (void); |
252b5132 RH |
154 | #define md_end() sparc_md_end () |
155 | ||
156 | #endif | |
157 | ||
62ebcb5c AM |
158 | #define TC_PARSE_CONS_RETURN_TYPE const char * |
159 | #define TC_PARSE_CONS_RETURN_NONE NULL | |
160 | ||
bd5e6e7e JJ |
161 | #ifdef OBJ_ELF |
162 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) sparc_cons (EXP, NBYTES) | |
62ebcb5c | 163 | extern const char *sparc_cons (expressionS *, int); |
bd5e6e7e JJ |
164 | #endif |
165 | ||
252b5132 RH |
166 | #define TC_CONS_FIX_NEW cons_fix_new_sparc |
167 | extern void cons_fix_new_sparc | |
62ebcb5c | 168 | (struct frag *, int, unsigned int, struct expressionS *, const char *); |
252b5132 | 169 | |
dabe3bbc RH |
170 | #define TC_FIX_TYPE valueT |
171 | ||
172 | #define TC_INIT_FIX_DATA(X) \ | |
173 | do \ | |
174 | { \ | |
175 | (X)->tc_fix_data = 0; \ | |
176 | } \ | |
814f6641 | 177 | while (0) |
dabe3bbc | 178 | |
a161fe53 | 179 | #define TC_FIX_DATA_PRINT(FILE, FIX) \ |
dabe3bbc RH |
180 | do \ |
181 | { \ | |
814f6641 | 182 | fprintf ((FILE), "addend2=%ld\n", \ |
a161fe53 | 183 | (unsigned long) (FIX)->tc_fix_data); \ |
dabe3bbc | 184 | } \ |
814f6641 | 185 | while (0) |
dabe3bbc | 186 | |
364b6d8b JJ |
187 | #define TARGET_USE_CFIPOP 1 |
188 | ||
189 | #define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions | |
5a49b8ac | 190 | extern void sparc_cfi_frame_initial_instructions (void); |
364b6d8b JJ |
191 | |
192 | #define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum | |
5a49b8ac | 193 | extern int sparc_regname_to_dw2regnum (char *regname); |
364b6d8b JJ |
194 | |
195 | #define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr | |
5a49b8ac | 196 | extern void sparc_cfi_emit_pcrel_expr (expressionS *, unsigned int); |
364b6d8b JJ |
197 | |
198 | extern int sparc_cie_data_alignment; | |
199 | ||
200 | #define DWARF2_LINE_MIN_INSN_LENGTH 4 | |
201 | #define DWARF2_DEFAULT_RETURN_COLUMN 15 | |
202 | #define DWARF2_CIE_DATA_ALIGNMENT sparc_cie_data_alignment | |
b8e904dc | 203 | |
252b5132 | 204 | /* end of tc-sparc.h */ |