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