Fix PR gas/22738 (.dc.a directive has wrong size on SPARC 64-bit).
[deliverable/binutils-gdb.git] / gas / config / tc-sparc.h
1 /* tc-sparc.h - Macros and type defines for the sparc.
2 Copyright (C) 1989-2018 Free Software Foundation, Inc.
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
8 published by the Free Software Foundation; either version 3,
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
18 to the Free Software Foundation, 51 Franklin Street - Fifth Floor,
19 Boston, MA 02110-1301, USA. */
20
21 #ifndef TC_SPARC
22 #define TC_SPARC 1
23
24 struct frag;
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
33 extern unsigned long sparc_mach (void);
34 #define TARGET_MACH sparc_mach ()
35
36 #ifdef TE_FreeBSD
37 #define ELF_TARGET_FORMAT "elf32-sparc"
38 #define ELF64_TARGET_FORMAT "elf64-sparc-freebsd"
39 #endif
40
41 #ifdef TE_SOLARIS
42 #define ELF_TARGET_FORMAT "elf32-sparc-sol2"
43 #define ELF64_TARGET_FORMAT "elf64-sparc-sol2"
44 #endif
45
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
54 extern const char *sparc_target_format (void);
55 #define TARGET_FORMAT sparc_target_format ()
56
57 #define RELOC_EXPANSION_POSSIBLE
58 #define MAX_RELOC_EXPANSION 2
59
60 /* Make it unconditional and check if -EL is valid after option parsing */
61 #define SPARC_BIENDIAN
62
63 #define WORKING_DOT_WORD
64
65 #define md_convert_frag(b,s,f) \
66 as_fatal (_("sparc convert_frag\n"))
67 #define md_estimate_size_before_relax(f,s) \
68 (as_fatal (_("estimate_size_before_relax called")), 1)
69
70 #define LISTING_HEADER "SPARC GAS "
71
72 extern int sparc_pic_code;
73
74 /* We require .word, et. al., to be aligned correctly. */
75 #define md_cons_align(nbytes) sparc_cons_align (nbytes)
76 extern void sparc_cons_align (int);
77
78 #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
79 extern void sparc_handle_align (struct frag *);
80
81 #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4)
82
83 #define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
84
85 /* I know that "call 0" fails in sparc-coff if this doesn't return 1. I
86 don't know about other relocation types, or other formats, yet. */
87 #ifdef OBJ_COFF
88 #define TC_FORCE_RELOCATION_ABS(FIX) \
89 ((FIX)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
90 || TC_FORCE_RELOCATION (FIX))
91
92 #define RELOC_REQUIRES_SYMBOL
93 #endif
94
95 #ifdef OBJ_AOUT
96 /* This expression evaluates to true if the relocation is for a local
97 object for which we still want to do the relocation at runtime.
98 False if we are willing to perform this relocation while building
99 the .o file. */
100
101 #define TC_FORCE_RELOCATION_LOCAL(FIX) \
102 (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
103 || (sparc_pic_code \
104 && S_IS_EXTERNAL ((FIX)->fx_addsy)))
105 #endif
106
107 #ifdef OBJ_ELF
108 /* Don't turn certain relocs into relocations against sections. This
109 is required for the dynamic linker to operate properly. When
110 generating PIC, we need to keep any non PC relative reloc. The PIC
111 part of this test must be parallel to the code in tc_gen_reloc which
112 converts relocations to GOT relocations. */
113 #define tc_fix_adjustable(FIX) \
114 ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
115 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
116 && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22 \
117 || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64) \
118 && (! sparc_pic_code \
119 || ((FIX)->fx_r_type != BFD_RELOC_HI22 \
120 && (FIX)->fx_r_type != BFD_RELOC_LO10 \
121 && (FIX)->fx_r_type != BFD_RELOC_SPARC13 \
122 && ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2 \
123 || !generic_force_reloc (FIX)) \
124 && ((FIX)->fx_pcrel \
125 || ((FIX)->fx_subsy != NULL \
126 && (S_GET_SEGMENT ((FIX)->fx_subsy) \
127 == S_GET_SEGMENT ((FIX)->fx_addsy))) \
128 || S_IS_LOCAL ((FIX)->fx_addsy)))))
129
130 /* Values passed to md_apply_fix don't include the symbol value. */
131 #define MD_APPLY_SYM_VALUE(FIX) 0
132
133 /* Finish up the entire symtab. */
134 #define tc_adjust_symtab() sparc_adjust_symtab ()
135 extern void sparc_adjust_symtab (void);
136
137 /* Don't allow the generic code to convert fixups involving the
138 subtraction of a label in the current section to pc-relative if we
139 don't have the necessary pc-relative relocation. */
140 #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \
141 (!((FIX)->fx_r_type == BFD_RELOC_64 \
142 || (FIX)->fx_r_type == BFD_RELOC_32 \
143 || (FIX)->fx_r_type == BFD_RELOC_16 \
144 || (FIX)->fx_r_type == BFD_RELOC_8))
145 #endif
146
147 #ifdef OBJ_AOUT
148 /* When generating PIC code, we must not adjust any reloc which will
149 turn into a reloc against the global offset table, nor any reloc
150 which we will need if a symbol is overridden. */
151 #define tc_fix_adjustable(FIX) \
152 (! sparc_pic_code \
153 || ((FIX)->fx_pcrel \
154 && ((FIX)->fx_addsy == NULL \
155 || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
156 && ! S_IS_WEAK ((FIX)->fx_addsy)))) \
157 || (FIX)->fx_r_type == BFD_RELOC_16 \
158 || (FIX)->fx_r_type == BFD_RELOC_32)
159 #endif
160
161 #define elf_tc_final_processing sparc_elf_final_processing
162 extern void sparc_elf_final_processing (void);
163
164 #define md_operand(x)
165
166 extern void sparc_md_end (void);
167 #define md_end() sparc_md_end ()
168
169 #endif
170
171 #define TC_PARSE_CONS_RETURN_TYPE const char *
172 #define TC_PARSE_CONS_RETURN_NONE NULL
173
174 #ifdef OBJ_ELF
175 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) sparc_cons (EXP, NBYTES)
176 extern const char *sparc_cons (expressionS *, int);
177 #endif
178
179 #define TC_CONS_FIX_NEW cons_fix_new_sparc
180 extern void cons_fix_new_sparc
181 (struct frag *, int, unsigned int, struct expressionS *, const char *);
182
183 #define TC_FIX_TYPE valueT
184
185 #define TC_INIT_FIX_DATA(X) \
186 do \
187 { \
188 (X)->tc_fix_data = 0; \
189 } \
190 while (0)
191
192 #define TC_FIX_DATA_PRINT(FILE, FIX) \
193 do \
194 { \
195 fprintf ((FILE), "addend2=%ld\n", \
196 (unsigned long) (FIX)->tc_fix_data); \
197 } \
198 while (0)
199
200 #define TARGET_USE_CFIPOP 1
201
202 #define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions
203 extern void sparc_cfi_frame_initial_instructions (void);
204
205 #define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum
206 extern int sparc_regname_to_dw2regnum (char *regname);
207
208 #define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr
209 extern void sparc_cfi_emit_pcrel_expr (expressionS *, unsigned int);
210
211 extern int sparc_cie_data_alignment;
212
213 #define DWARF2_LINE_MIN_INSN_LENGTH 4
214 #define DWARF2_DEFAULT_RETURN_COLUMN 15
215 #define DWARF2_CIE_DATA_ALIGNMENT sparc_cie_data_alignment
216
217 /* cons_fix_new_sparc will chooose BFD_RELOC_SPARC_UA32 for the difference
218 expressions, but there is no corresponding PC-relative relocation; as this
219 is for debugging info though, alignment does not matter, so by disabling
220 this, BFD_RELOC_32_PCREL will be emitted directly instead. */
221 #define CFI_DIFF_EXPR_OK 0
222
223 /* end of tc-sparc.h */
This page took 0.049694 seconds and 5 git commands to generate.