Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* tc-sparc.h - Macros and type defines for the sparc. |
219d1afa | 2 | Copyright (C) 1989-2018 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 | ||
d85815e2 EB |
33 | extern unsigned long sparc_mach (void); |
34 | #define TARGET_MACH sparc_mach () | |
35 | ||
71a75f6f | 36 | #ifdef TE_FreeBSD |
c5d685bf | 37 | #define ELF_TARGET_FORMAT "elf32-sparc" |
71a75f6f MF |
38 | #define ELF64_TARGET_FORMAT "elf64-sparc-freebsd" |
39 | #endif | |
40 | ||
1360ba76 RO |
41 | #ifdef TE_SOLARIS |
42 | #define ELF_TARGET_FORMAT "elf32-sparc-sol2" | |
43 | #define ELF64_TARGET_FORMAT "elf64-sparc-sol2" | |
44 | #endif | |
45 | ||
71a75f6f MF |
46 | #ifndef ELF_TARGET_FORMAT |
47 | #define ELF_TARGET_FORMAT "elf32-sparc" | |
48 | #endif | |
49 | ||
50 | #ifndef ELF64_TARGET_FORMAT | |
51 | #define ELF64_TARGET_FORMAT "elf64-sparc" | |
52 | #endif | |
53 | ||
5a49b8ac | 54 | extern const char *sparc_target_format (void); |
252b5132 RH |
55 | #define TARGET_FORMAT sparc_target_format () |
56 | ||
dabe3bbc RH |
57 | #define RELOC_EXPANSION_POSSIBLE |
58 | #define MAX_RELOC_EXPANSION 2 | |
59 | ||
252b5132 RH |
60 | /* Make it unconditional and check if -EL is valid after option parsing */ |
61 | #define SPARC_BIENDIAN | |
62 | ||
63 | #define WORKING_DOT_WORD | |
64 | ||
0a9ef439 RH |
65 | #define md_convert_frag(b,s,f) \ |
66 | as_fatal (_("sparc convert_frag\n")) | |
252b5132 | 67 | #define md_estimate_size_before_relax(f,s) \ |
07726851 | 68 | (as_fatal (_("estimate_size_before_relax called")), 1) |
252b5132 RH |
69 | |
70 | #define LISTING_HEADER "SPARC GAS " | |
71 | ||
72 | extern int sparc_pic_code; | |
73 | ||
252b5132 RH |
74 | /* We require .word, et. al., to be aligned correctly. */ |
75 | #define md_cons_align(nbytes) sparc_cons_align (nbytes) | |
5a49b8ac | 76 | extern void sparc_cons_align (int); |
0a9ef439 | 77 | |
252b5132 | 78 | #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp) |
5a49b8ac | 79 | extern void sparc_handle_align (struct frag *); |
252b5132 | 80 | |
0a9ef439 RH |
81 | #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4) |
82 | ||
f6a36b0c JC |
83 | #define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */ |
84 | ||
a161fe53 AM |
85 | /* Don't turn certain relocs into relocations against sections. This |
86 | is required for the dynamic linker to operate properly. When | |
87 | generating PIC, we need to keep any non PC relative reloc. The PIC | |
88 | part of this test must be parallel to the code in tc_gen_reloc which | |
89 | converts relocations to GOT relocations. */ | |
252b5132 | 90 | #define tc_fix_adjustable(FIX) \ |
a161fe53 | 91 | ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \ |
d2e71411 | 92 | && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \ |
b9734f35 JJ |
93 | && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22 \ |
94 | || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64) \ | |
252b5132 | 95 | && (! sparc_pic_code \ |
a1f2d742 ILT |
96 | || ((FIX)->fx_r_type != BFD_RELOC_HI22 \ |
97 | && (FIX)->fx_r_type != BFD_RELOC_LO10 \ | |
98 | && (FIX)->fx_r_type != BFD_RELOC_SPARC13 \ | |
99 | && ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2 \ | |
ae6063d4 | 100 | || !generic_force_reloc (FIX)) \ |
a1f2d742 ILT |
101 | && ((FIX)->fx_pcrel \ |
102 | || ((FIX)->fx_subsy != NULL \ | |
103 | && (S_GET_SEGMENT ((FIX)->fx_subsy) \ | |
104 | == S_GET_SEGMENT ((FIX)->fx_addsy))) \ | |
105 | || S_IS_LOCAL ((FIX)->fx_addsy))))) | |
6d8809aa | 106 | |
55cf6793 | 107 | /* Values passed to md_apply_fix don't include the symbol value. */ |
a161fe53 AM |
108 | #define MD_APPLY_SYM_VALUE(FIX) 0 |
109 | ||
6d8809aa RH |
110 | /* Finish up the entire symtab. */ |
111 | #define tc_adjust_symtab() sparc_adjust_symtab () | |
5a49b8ac | 112 | extern void sparc_adjust_symtab (void); |
f6a36b0c JC |
113 | |
114 | /* Don't allow the generic code to convert fixups involving the | |
115 | subtraction of a label in the current section to pc-relative if we | |
116 | don't have the necessary pc-relative relocation. */ | |
117 | #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \ | |
118 | (!((FIX)->fx_r_type == BFD_RELOC_64 \ | |
119 | || (FIX)->fx_r_type == BFD_RELOC_32 \ | |
120 | || (FIX)->fx_r_type == BFD_RELOC_16 \ | |
121 | || (FIX)->fx_r_type == BFD_RELOC_8)) | |
252b5132 RH |
122 | |
123 | #define elf_tc_final_processing sparc_elf_final_processing | |
5a49b8ac | 124 | extern void sparc_elf_final_processing (void); |
252b5132 RH |
125 | |
126 | #define md_operand(x) | |
127 | ||
5a49b8ac | 128 | extern void sparc_md_end (void); |
252b5132 RH |
129 | #define md_end() sparc_md_end () |
130 | ||
62ebcb5c AM |
131 | #define TC_PARSE_CONS_RETURN_TYPE const char * |
132 | #define TC_PARSE_CONS_RETURN_NONE NULL | |
133 | ||
bd5e6e7e | 134 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) sparc_cons (EXP, NBYTES) |
62ebcb5c | 135 | extern const char *sparc_cons (expressionS *, int); |
bd5e6e7e | 136 | |
252b5132 RH |
137 | #define TC_CONS_FIX_NEW cons_fix_new_sparc |
138 | extern void cons_fix_new_sparc | |
62ebcb5c | 139 | (struct frag *, int, unsigned int, struct expressionS *, const char *); |
252b5132 | 140 | |
dabe3bbc RH |
141 | #define TC_FIX_TYPE valueT |
142 | ||
143 | #define TC_INIT_FIX_DATA(X) \ | |
144 | do \ | |
145 | { \ | |
146 | (X)->tc_fix_data = 0; \ | |
147 | } \ | |
814f6641 | 148 | while (0) |
dabe3bbc | 149 | |
a161fe53 | 150 | #define TC_FIX_DATA_PRINT(FILE, FIX) \ |
dabe3bbc RH |
151 | do \ |
152 | { \ | |
814f6641 | 153 | fprintf ((FILE), "addend2=%ld\n", \ |
a161fe53 | 154 | (unsigned long) (FIX)->tc_fix_data); \ |
dabe3bbc | 155 | } \ |
814f6641 | 156 | while (0) |
dabe3bbc | 157 | |
364b6d8b JJ |
158 | #define TARGET_USE_CFIPOP 1 |
159 | ||
160 | #define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions | |
5a49b8ac | 161 | extern void sparc_cfi_frame_initial_instructions (void); |
364b6d8b JJ |
162 | |
163 | #define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum | |
5a49b8ac | 164 | extern int sparc_regname_to_dw2regnum (char *regname); |
364b6d8b JJ |
165 | |
166 | #define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr | |
5a49b8ac | 167 | extern void sparc_cfi_emit_pcrel_expr (expressionS *, unsigned int); |
364b6d8b JJ |
168 | |
169 | extern int sparc_cie_data_alignment; | |
170 | ||
171 | #define DWARF2_LINE_MIN_INSN_LENGTH 4 | |
172 | #define DWARF2_DEFAULT_RETURN_COLUMN 15 | |
173 | #define DWARF2_CIE_DATA_ALIGNMENT sparc_cie_data_alignment | |
b8e904dc | 174 | |
f6a36b0c JC |
175 | /* cons_fix_new_sparc will chooose BFD_RELOC_SPARC_UA32 for the difference |
176 | expressions, but there is no corresponding PC-relative relocation; as this | |
177 | is for debugging info though, alignment does not matter, so by disabling | |
178 | this, BFD_RELOC_32_PCREL will be emitted directly instead. */ | |
179 | #define CFI_DIFF_EXPR_OK 0 | |
180 | ||
c9098af4 | 181 | #endif |