PR ld/12549
[deliverable/binutils-gdb.git] / gas / config / tc-sparc.h
CommitLineData
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,
1360ba76 3 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2010
20ee54e8 4 Free Software Foundation, Inc.
252b5132
RH
5
6 This file is part of GAS, the GNU Assembler.
7
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as
ec2655a6 10 published by the Free Software Foundation; either version 3,
252b5132
RH
11 or (at your option) any later version.
12
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.
17
18 You should have received a copy of the GNU General Public
19 License along with GAS; see the file COPYING. If not, write
4b4da160
NC
20 to the Free Software Foundation, 51 Franklin Street - Fifth Floor,
21 Boston, MA 02110-1301, USA. */
252b5132
RH
22
23#ifndef TC_SPARC
24#define TC_SPARC 1
25
252b5132 26struct frag;
252b5132
RH
27
28/* This is used to set the default value for `target_big_endian'. */
29#define TARGET_BYTES_BIG_ENDIAN 1
30
31#define LOCAL_LABELS_FB 1
32
33#define TARGET_ARCH bfd_arch_sparc
34
71a75f6f
MF
35#ifdef TE_FreeBSD
36#define ELF_TARGET_FORMAT "elf32-sparc-freebsd"
37#define ELF64_TARGET_FORMAT "elf64-sparc-freebsd"
38#endif
39
1360ba76
RO
40#ifdef TE_SOLARIS
41#define ELF_TARGET_FORMAT "elf32-sparc-sol2"
42#define ELF64_TARGET_FORMAT "elf64-sparc-sol2"
43#endif
44
71a75f6f
MF
45#ifndef ELF_TARGET_FORMAT
46#define ELF_TARGET_FORMAT "elf32-sparc"
47#endif
48
49#ifndef ELF64_TARGET_FORMAT
50#define ELF64_TARGET_FORMAT "elf64-sparc"
51#endif
52
5a49b8ac 53extern const char *sparc_target_format (void);
252b5132
RH
54#define TARGET_FORMAT sparc_target_format ()
55
dabe3bbc
RH
56#define RELOC_EXPANSION_POSSIBLE
57#define MAX_RELOC_EXPANSION 2
58
252b5132
RH
59/* Make it unconditional and check if -EL is valid after option parsing */
60#define SPARC_BIENDIAN
61
62#define WORKING_DOT_WORD
63
0a9ef439
RH
64#define md_convert_frag(b,s,f) \
65 as_fatal (_("sparc convert_frag\n"))
252b5132 66#define md_estimate_size_before_relax(f,s) \
07726851 67 (as_fatal (_("estimate_size_before_relax called")), 1)
252b5132
RH
68
69#define LISTING_HEADER "SPARC GAS "
70
71extern int sparc_pic_code;
72
252b5132
RH
73/* We require .word, et. al., to be aligned correctly. */
74#define md_cons_align(nbytes) sparc_cons_align (nbytes)
5a49b8ac 75extern void sparc_cons_align (int);
0a9ef439 76
252b5132 77#define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
5a49b8ac 78extern void sparc_handle_align (struct frag *);
252b5132 79
0a9ef439
RH
80#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4)
81
252b5132
RH
82/* I know that "call 0" fails in sparc-coff if this doesn't return 1. I
83 don't know about other relocation types, or other formats, yet. */
84#ifdef OBJ_COFF
a161fe53
AM
85#define TC_FORCE_RELOCATION_ABS(FIX) \
86 ((FIX)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
87 || TC_FORCE_RELOCATION (FIX))
88
252b5132
RH
89#define RELOC_REQUIRES_SYMBOL
90#endif
91
a161fe53
AM
92#ifdef OBJ_AOUT
93/* This expression evaluates to true if the relocation is for a local
94 object for which we still want to do the relocation at runtime.
95 False if we are willing to perform this relocation while building
96 the .o file. */
97
98#define TC_FORCE_RELOCATION_LOCAL(FIX) \
99 (!(FIX)->fx_pcrel \
a161fe53
AM
100 || (sparc_pic_code \
101 && S_IS_EXTERNAL ((FIX)->fx_addsy)) \
102 || TC_FORCE_RELOCATION (FIX))
252b5132
RH
103#endif
104
252b5132 105#ifdef OBJ_ELF
a161fe53
AM
106/* Don't turn certain relocs into relocations against sections. This
107 is required for the dynamic linker to operate properly. When
108 generating PIC, we need to keep any non PC relative reloc. The PIC
109 part of this test must be parallel to the code in tc_gen_reloc which
110 converts relocations to GOT relocations. */
252b5132 111#define tc_fix_adjustable(FIX) \
a161fe53 112 ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
d2e71411 113 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
b9734f35
JJ
114 && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22 \
115 || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64) \
252b5132 116 && (! sparc_pic_code \
a1f2d742
ILT
117 || ((FIX)->fx_r_type != BFD_RELOC_HI22 \
118 && (FIX)->fx_r_type != BFD_RELOC_LO10 \
119 && (FIX)->fx_r_type != BFD_RELOC_SPARC13 \
120 && ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2 \
ae6063d4 121 || !generic_force_reloc (FIX)) \
a1f2d742
ILT
122 && ((FIX)->fx_pcrel \
123 || ((FIX)->fx_subsy != NULL \
124 && (S_GET_SEGMENT ((FIX)->fx_subsy) \
125 == S_GET_SEGMENT ((FIX)->fx_addsy))) \
126 || S_IS_LOCAL ((FIX)->fx_addsy)))))
6d8809aa 127
55cf6793 128/* Values passed to md_apply_fix don't include the symbol value. */
a161fe53
AM
129#define MD_APPLY_SYM_VALUE(FIX) 0
130
6d8809aa
RH
131/* Finish up the entire symtab. */
132#define tc_adjust_symtab() sparc_adjust_symtab ()
5a49b8ac 133extern void sparc_adjust_symtab (void);
252b5132
RH
134#endif
135
136#ifdef OBJ_AOUT
137/* When generating PIC code, we must not adjust any reloc which will
138 turn into a reloc against the global offset table, nor any reloc
139 which we will need if a symbol is overridden. */
140#define tc_fix_adjustable(FIX) \
141 (! sparc_pic_code \
142 || ((FIX)->fx_pcrel \
143 && ((FIX)->fx_addsy == NULL \
144 || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
145 && ! S_IS_WEAK ((FIX)->fx_addsy)))) \
146 || (FIX)->fx_r_type == BFD_RELOC_16 \
147 || (FIX)->fx_r_type == BFD_RELOC_32)
148#endif
149
150#define elf_tc_final_processing sparc_elf_final_processing
5a49b8ac 151extern void sparc_elf_final_processing (void);
252b5132
RH
152
153#define md_operand(x)
154
5a49b8ac 155extern void sparc_md_end (void);
252b5132
RH
156#define md_end() sparc_md_end ()
157
158#endif
159
bd5e6e7e
JJ
160#ifdef OBJ_ELF
161#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) sparc_cons (EXP, NBYTES)
5a49b8ac 162extern void sparc_cons (expressionS *, int);
bd5e6e7e
JJ
163#endif
164
252b5132
RH
165#define TC_CONS_FIX_NEW cons_fix_new_sparc
166extern void cons_fix_new_sparc
5a49b8ac 167 (struct frag *, int, unsigned int, struct expressionS *);
252b5132 168
dabe3bbc
RH
169#define TC_FIX_TYPE valueT
170
171#define TC_INIT_FIX_DATA(X) \
172 do \
173 { \
174 (X)->tc_fix_data = 0; \
175 } \
814f6641 176 while (0)
dabe3bbc 177
a161fe53 178#define TC_FIX_DATA_PRINT(FILE, FIX) \
dabe3bbc
RH
179 do \
180 { \
814f6641 181 fprintf ((FILE), "addend2=%ld\n", \
a161fe53 182 (unsigned long) (FIX)->tc_fix_data); \
dabe3bbc 183 } \
814f6641 184 while (0)
dabe3bbc 185
364b6d8b
JJ
186#define TARGET_USE_CFIPOP 1
187
188#define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions
5a49b8ac 189extern void sparc_cfi_frame_initial_instructions (void);
364b6d8b
JJ
190
191#define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum
5a49b8ac 192extern int sparc_regname_to_dw2regnum (char *regname);
364b6d8b
JJ
193
194#define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr
5a49b8ac 195extern void sparc_cfi_emit_pcrel_expr (expressionS *, unsigned int);
364b6d8b
JJ
196
197extern int sparc_cie_data_alignment;
198
199#define DWARF2_LINE_MIN_INSN_LENGTH 4
200#define DWARF2_DEFAULT_RETURN_COLUMN 15
201#define DWARF2_CIE_DATA_ALIGNMENT sparc_cie_data_alignment
b8e904dc 202
252b5132 203/* end of tc-sparc.h */
This page took 0.63725 seconds and 4 git commands to generate.