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