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