2005-04-05 Paolo Bonzini <bonzini@gnu.org>
[binutils.git] / gas / config / tc-sparc.h
blob3bcee422a0cb1f5e3212427335e32c2849c1bfe1
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, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #ifndef TC_SPARC
23 #define TC_SPARC 1
25 #ifdef ANSI_PROTOTYPES
26 struct frag;
27 #endif
29 /* This is used to set the default value for `target_big_endian'. */
30 #define TARGET_BYTES_BIG_ENDIAN 1
32 #define LOCAL_LABELS_FB 1
34 #define TARGET_ARCH bfd_arch_sparc
36 extern const char *sparc_target_format PARAMS ((void));
37 #define TARGET_FORMAT sparc_target_format ()
39 #define RELOC_EXPANSION_POSSIBLE
40 #define MAX_RELOC_EXPANSION 2
42 /* Make it unconditional and check if -EL is valid after option parsing */
43 #define SPARC_BIENDIAN
45 #define WORKING_DOT_WORD
47 #define md_convert_frag(b,s,f) \
48 as_fatal (_("sparc convert_frag\n"))
49 #define md_estimate_size_before_relax(f,s) \
50 (as_fatal (_("estimate_size_before_relax called")), 1)
52 #define LISTING_HEADER "SPARC GAS "
54 extern int sparc_pic_code;
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));
60 #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
61 extern void sparc_handle_align PARAMS ((struct frag *));
63 #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4)
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
68 #define TC_FORCE_RELOCATION_ABS(FIX) \
69 ((FIX)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
70 || TC_FORCE_RELOCATION (FIX))
72 #define RELOC_REQUIRES_SYMBOL
73 #endif
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. */
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))
87 #endif
89 #ifdef OBJ_ELF
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. */
95 #define tc_fix_adjustable(FIX) \
96 ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
97 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
98 && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22 \
99 || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64) \
100 && (! sparc_pic_code \
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 \
105 || !generic_force_reloc (FIX)) \
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)))))
112 /* Values passed to md_apply_fix3 don't include the symbol value. */
113 #define MD_APPLY_SYM_VALUE(FIX) 0
115 /* Finish up the entire symtab. */
116 #define tc_adjust_symtab() sparc_adjust_symtab ()
117 extern void sparc_adjust_symtab PARAMS ((void));
118 #endif
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
134 #define elf_tc_final_processing sparc_elf_final_processing
135 extern void sparc_elf_final_processing PARAMS ((void));
137 #define md_operand(x)
139 extern void sparc_md_end PARAMS ((void));
140 #define md_end() sparc_md_end ()
142 #endif
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
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 *));
153 #define TC_FIX_TYPE valueT
155 #define TC_INIT_FIX_DATA(X) \
156 do \
158 (X)->tc_fix_data = 0; \
160 while (0)
162 #define TC_FIX_DATA_PRINT(FILE, FIX) \
163 do \
165 fprintf ((FILE), "addend2=%ld\n", \
166 (unsigned long) (FIX)->tc_fix_data); \
168 while (0)
170 #define TARGET_USE_CFIPOP 1
172 #define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions
173 extern void sparc_cfi_frame_initial_instructions PARAMS ((void));
175 #define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum
176 extern int sparc_regname_to_dw2regnum PARAMS ((const char *regname));
178 #define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr
179 extern void sparc_cfi_emit_pcrel_expr PARAMS ((expressionS *, unsigned int));
181 extern int sparc_cie_data_alignment;
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
187 /* end of tc-sparc.h */