Commit | Line | Data |
---|---|---|
305a3af6 | 1 | /* This file is tc-arm.h |
9ac8e451 | 2 | Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
305a3af6 SC |
3 | Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) |
4 | Modified by David Taylor (dtaylor@armltd.co.uk) | |
5 | ||
305a3af6 SC |
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 published by | |
10 | the Free Software Foundation; either version 2, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GAS is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
23604921 ILT |
19 | along with GAS; see the file COPYING. If not, write to the Free |
20 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
21 | 02111-1307, USA. */ | |
305a3af6 SC |
22 | |
23 | #define TC_ARM 1 | |
24 | ||
23604921 ILT |
25 | #ifndef TARGET_BYTES_BIG_ENDIAN |
26 | #define TARGET_BYTES_BIG_ENDIAN 0 | |
27 | #endif | |
28 | ||
1667e4c2 CM |
29 | #define WORKING_DOT_WORD |
30 | ||
305a3af6 SC |
31 | #define COFF_MAGIC ARMMAGIC |
32 | #define TARGET_ARCH bfd_arch_arm | |
33 | ||
34 | #define AOUT_MACHTYPE 0 | |
35 | ||
36 | #define DIFF_EXPR_OK | |
37 | ||
f8a21443 NC |
38 | #ifdef LITTLE_ENDIAN |
39 | #undef LITTLE_ENDIAN | |
40 | #endif | |
41 | #ifdef BIG_ENDIAN | |
42 | #undef BIG_ENDIAN | |
43 | #endif | |
44 | ||
305a3af6 SC |
45 | #define LITTLE_ENDIAN 1234 |
46 | #define BIG_ENDIAN 4321 | |
47 | ||
305a3af6 SC |
48 | #ifdef OBJ_AOUT |
49 | #ifdef TE_RISCIX | |
50 | #define TARGET_FORMAT "a.out-riscix" | |
51 | #else | |
1667e4c2 CM |
52 | #define ARM_BI_ENDIAN |
53 | #define TARGET_FORMAT \ | |
54 | (target_big_endian ? "a.out-arm-big" : "a.out-arm-little") | |
305a3af6 SC |
55 | #endif |
56 | #endif | |
57 | ||
58 | #ifdef OBJ_AIF | |
59 | #define TARGET_FORMAT "aif" | |
60 | #endif | |
61 | ||
62 | #ifdef OBJ_COFF | |
1667e4c2 CM |
63 | # define ARM_BI_ENDIAN |
64 | extern boolean arm_validate_fix (); | |
65 | # define TC_VALIDATE_FIX(fixP,segType,Label) if (arm_validate_fix (fixP)) add_symbolP = fixP->fx_addsy | |
66 | # ifdef TE_PE | |
67 | # define TC_FORCE_RELOCATION(x) ((x)->fx_r_type==BFD_RELOC_RVA) | |
68 | # define TARGET_FORMAT (target_big_endian ? "pe-arm-big" : "pe-arm-little") | |
69 | # else | |
70 | # define TARGET_FORMAT (target_big_endian ? "coff-arm-big" : "coff-arm-little") | |
71 | /* Tell tc-arm.c to support runtime endian selection. */ | |
72 | # endif | |
305a3af6 | 73 | #endif |
1667e4c2 | 74 | |
9ac8e451 CM |
75 | #ifdef OBJ_ELF |
76 | #define TC_FORCE_RELOCATION(fixp) elf32_arm_force_relocation(fixp) | |
77 | extern int elf32_arm_force_relocation PARAMS ((struct fix *)); | |
78 | #endif | |
79 | ||
1667e4c2 CM |
80 | #ifdef OBJ_ELF |
81 | extern boolean arm_validate_fix (); | |
82 | #define TC_VALIDATE_FIX(fixP,segType,Label) if (arm_validate_fix (fixP)) add_symbolP = fixP->fx_addsy | |
83 | #define ARM_BI_ENDIAN | |
9ac8e451 CM |
84 | #define TARGET_FORMAT elf32_arm_target_format() |
85 | extern const char *elf32_arm_target_format PARAMS ((void)); | |
305a3af6 SC |
86 | #endif |
87 | ||
1667e4c2 | 88 | #define md_convert_frag(b,s,f) {as_fatal (_("arm convert_frag\n"));} |
305a3af6 | 89 | |
1667e4c2 CM |
90 | extern void arm_cleanup PARAMS ((void)); |
91 | extern void arm_start_line_hook PARAMS ((void)); | |
92 | extern void arm_frob_label PARAMS ((struct symbol *)); | |
93 | #define md_cleanup() arm_cleanup () | |
305a3af6 | 94 | #define md_start_line_hook() arm_start_line_hook () |
f8a21443 NC |
95 | #define tc_frob_label(S) arm_frob_label (S) |
96 | /* We also need to mark assembler created symbols: */ | |
97 | #define tc_frob_fake_label(S) arm_frob_label (S) | |
98 | /* NOTE: The fake label creation in stabs.c:s_stab_generic() has | |
99 | deliberately not been updated to mark assembler created stabs | |
100 | symbols as Thumb. */ | |
305a3af6 | 101 | |
aae39e37 CM |
102 | #ifdef OBJ_ELF |
103 | #define obj_fix_adjustable(fixP) arm_fix_adjustable(fixP) | |
104 | #else | |
305a3af6 | 105 | #define obj_fix_adjustable(fixP) 0 |
aae39e37 | 106 | #endif |
305a3af6 | 107 | |
1667e4c2 CM |
108 | /* We need to keep some local information on symbols. */ |
109 | ||
f8a21443 | 110 | #define TC_SYMFIELD_TYPE unsigned int |
1667e4c2 CM |
111 | #define ARM_GET_FLAG(s) ((s)->sy_tc) |
112 | #define ARM_SET_FLAG(s,v) ((s)->sy_tc |= (v)) | |
113 | #define ARM_RESET_FLAG(s,v) ((s)->sy_tc &= ~(v)) | |
114 | ||
115 | #define ARM_FLAG_THUMB (1 << 0) /* The symbol is a Thumb symbol rather than an Arm symbol. */ | |
116 | #define ARM_FLAG_INTERWORK (1 << 1) /* The symbol is attached to code that suppports interworking. */ | |
117 | #define THUMB_FLAG_FUNC (1 << 2) /* The symbol is attached to the start of a Thumb function. */ | |
118 | ||
119 | #define ARM_IS_THUMB(s) (ARM_GET_FLAG (s) & ARM_FLAG_THUMB) | |
120 | #define ARM_IS_INTERWORK(s) (ARM_GET_FLAG (s) & ARM_FLAG_INTERWORK) | |
121 | #define THUMB_IS_FUNC(s) (ARM_GET_FLAG (s) & THUMB_FLAG_FUNC) | |
122 | ||
123 | #define ARM_SET_THUMB(s,t) ((t) ? ARM_SET_FLAG (s, ARM_FLAG_THUMB) : ARM_RESET_FLAG (s, ARM_FLAG_THUMB)) | |
124 | #define ARM_SET_INTERWORK(s,t) ((t) ? ARM_SET_FLAG (s, ARM_FLAG_INTERWORK) : ARM_RESET_FLAG (s, ARM_FLAG_INTERWORK)) | |
125 | #define THUMB_SET_FUNC(s,t) ((t) ? ARM_SET_FLAG (s, THUMB_FLAG_FUNC) : ARM_RESET_FLAG (s, THUMB_FLAG_FUNC)) | |
126 | ||
f8a21443 | 127 | |
af16e411 FF |
128 | #define TC_FIX_TYPE PTR |
129 | #define TC_INIT_FIX_DATA(FIXP) ((FIXP)->tc_fix_data = NULL) | |
130 | ||
131 | #define TC_START_LABEL(C,STR) \ | |
132 | (c == ':' || (c == '/' && arm_data_in_code ())) | |
133 | int arm_data_in_code PARAMS ((void)); | |
134 | ||
135 | #define tc_canonicalize_symbol_name(str) \ | |
136 | arm_canonicalize_symbol_name (str); | |
137 | char *arm_canonicalize_symbol_name PARAMS ((char *)); | |
138 | ||
305a3af6 SC |
139 | #if 0 /* It isn't as simple as this */ |
140 | #define tc_frob_symbol(sym,punt) \ | |
141 | { if (S_IS_LOCAL (sym)) \ | |
142 | { \ | |
143 | punt = 1; \ | |
144 | sym->sy_used_in_reloc = 0; \ | |
145 | }} | |
146 | #endif | |
147 | ||
aae39e37 CM |
148 | #ifdef OBJ_ELF |
149 | #define obj_frob_symbol(sym, punt) armelf_frob_symbol (sym, punt) | |
150 | #endif | |
151 | ||
f8a21443 | 152 | /* Finish processing the entire symbol table: */ |
cdb3d5f9 | 153 | #ifdef OBJ_ELF |
9ac8e451 | 154 | #define obj_adjust_symtab() armelf_adjust_symtab () |
cdb3d5f9 CM |
155 | extern void armelf_adjust_symtab PARAMS ((void)); |
156 | #else | |
9ac8e451 | 157 | #define obj_adjust_symtab() arm_adjust_symtab () |
f8a21443 | 158 | extern void arm_adjust_symtab PARAMS ((void)); |
cdb3d5f9 | 159 | #endif |
f8a21443 | 160 | |
305a3af6 SC |
161 | #if 0 |
162 | #define tc_crawl_symbol_chain(a) {;} /* not used */ | |
163 | #define tc_headers_hook(a) {;} /* not used */ | |
164 | #endif | |
165 | ||
166 | #define tc_aout_pre_write_hook(x) {;} /* not used */ | |
167 | ||
168 | #define LISTING_HEADER "ARM GAS " | |
169 | ||
170 | #define OPTIONAL_REGISTER_PREFIX '%' | |
171 | ||
172 | #define md_operand(x) | |
173 | ||
af16e411 FF |
174 | #define TC_HANDLES_FX_DONE |
175 | ||
176 | #define MD_APPLY_FIX3 | |
177 | ||
aae39e37 CM |
178 | #define LOCAL_LABEL(name) (name[0] == '.' \ |
179 | && (name[1] == 'L')) | |
305a3af6 SC |
180 | #define LOCAL_LABELS_FB 1 |
181 | ||
305a3af6 | 182 | /* end of tc-arm.h */ |