ld/testsuite/
[binutils.git] / gas / config / tc-sparc.h
blob3feac4f36207011cb540d742f13f9e7a30bd6d09
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 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
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.
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.
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, 51 Franklin Street - Fifth Floor,
20 Boston, MA 02110-1301, USA. */
22 #ifndef TC_SPARC
23 #define TC_SPARC 1
25 struct frag;
27 /* This is used to set the default value for `target_big_endian'. */
28 #define TARGET_BYTES_BIG_ENDIAN 1
30 #define LOCAL_LABELS_FB 1
32 #define TARGET_ARCH bfd_arch_sparc
34 extern const char *sparc_target_format PARAMS ((void));
35 #define TARGET_FORMAT sparc_target_format ()
37 #define RELOC_EXPANSION_POSSIBLE
38 #define MAX_RELOC_EXPANSION 2
40 /* Make it unconditional and check if -EL is valid after option parsing */
41 #define SPARC_BIENDIAN
43 #define WORKING_DOT_WORD
45 #define md_convert_frag(b,s,f) \
46 as_fatal (_("sparc convert_frag\n"))
47 #define md_estimate_size_before_relax(f,s) \
48 (as_fatal (_("estimate_size_before_relax called")), 1)
50 #define LISTING_HEADER "SPARC GAS "
52 extern int sparc_pic_code;
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));
58 #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
59 extern void sparc_handle_align PARAMS ((struct frag *));
61 #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4)
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
66 #define TC_FORCE_RELOCATION_ABS(FIX) \
67 ((FIX)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
68 || TC_FORCE_RELOCATION (FIX))
70 #define RELOC_REQUIRES_SYMBOL
71 #endif
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. */
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))
85 #endif
87 #ifdef OBJ_ELF
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. */
93 #define tc_fix_adjustable(FIX) \
94 ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
95 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
96 && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22 \
97 || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64) \
98 && (! sparc_pic_code \
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 \
103 || !generic_force_reloc (FIX)) \
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)))))
110 /* Values passed to md_apply_fix don't include the symbol value. */
111 #define MD_APPLY_SYM_VALUE(FIX) 0
113 /* Finish up the entire symtab. */
114 #define tc_adjust_symtab() sparc_adjust_symtab ()
115 extern void sparc_adjust_symtab PARAMS ((void));
116 #endif
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
132 #define elf_tc_final_processing sparc_elf_final_processing
133 extern void sparc_elf_final_processing PARAMS ((void));
135 #define md_operand(x)
137 extern void sparc_md_end PARAMS ((void));
138 #define md_end() sparc_md_end ()
140 #endif
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
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 *));
151 #define TC_FIX_TYPE valueT
153 #define TC_INIT_FIX_DATA(X) \
154 do \
156 (X)->tc_fix_data = 0; \
158 while (0)
160 #define TC_FIX_DATA_PRINT(FILE, FIX) \
161 do \
163 fprintf ((FILE), "addend2=%ld\n", \
164 (unsigned long) (FIX)->tc_fix_data); \
166 while (0)
168 #define TARGET_USE_CFIPOP 1
170 #define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions
171 extern void sparc_cfi_frame_initial_instructions PARAMS ((void));
173 #define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum
174 extern int sparc_regname_to_dw2regnum PARAMS ((char *regname));
176 #define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr
177 extern void sparc_cfi_emit_pcrel_expr PARAMS ((expressionS *, unsigned int));
179 extern int sparc_cie_data_alignment;
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
185 /* end of tc-sparc.h */