Commit | Line | Data |
---|---|---|
305a3af6 | 1 | /* This file is tc-arm.h |
1667e4c2 | 2 | Copyright (C) 1994, 1995, 1996, 1997, 1998 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 CM |
74 | |
75 | /* start-sanitize-armelf */ | |
76 | #ifdef OBJ_ELF | |
77 | extern boolean arm_validate_fix (); | |
78 | #define TC_VALIDATE_FIX(fixP,segType,Label) if (arm_validate_fix (fixP)) add_symbolP = fixP->fx_addsy | |
79 | #define ARM_BI_ENDIAN | |
80 | #define TARGET_FORMAT (target_big_endian ? "elf32-bigarm" : "elf32-littlearm") | |
305a3af6 | 81 | #endif |
1667e4c2 | 82 | /* end-sanitize-armelf */ |
305a3af6 | 83 | |
1667e4c2 | 84 | #define md_convert_frag(b,s,f) {as_fatal (_("arm convert_frag\n"));} |
305a3af6 | 85 | |
1667e4c2 CM |
86 | extern void arm_cleanup PARAMS ((void)); |
87 | extern void arm_start_line_hook PARAMS ((void)); | |
88 | extern void arm_frob_label PARAMS ((struct symbol *)); | |
89 | #define md_cleanup() arm_cleanup () | |
305a3af6 | 90 | #define md_start_line_hook() arm_start_line_hook () |
f8a21443 NC |
91 | #define tc_frob_label(S) arm_frob_label (S) |
92 | /* We also need to mark assembler created symbols: */ | |
93 | #define tc_frob_fake_label(S) arm_frob_label (S) | |
94 | /* NOTE: The fake label creation in stabs.c:s_stab_generic() has | |
95 | deliberately not been updated to mark assembler created stabs | |
96 | symbols as Thumb. */ | |
305a3af6 | 97 | |
38a29f02 | 98 | /* start-sanitize-armelf */ |
aae39e37 CM |
99 | #ifdef OBJ_ELF |
100 | #define obj_fix_adjustable(fixP) arm_fix_adjustable(fixP) | |
101 | #else | |
38a29f02 | 102 | /* end-sanitize-armelf */ |
305a3af6 | 103 | #define obj_fix_adjustable(fixP) 0 |
38a29f02 | 104 | /* start-sanitize-armelf */ |
aae39e37 | 105 | #endif |
38a29f02 | 106 | /* end-sanitize-armelf */ |
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 NC |
152 | /* Finish processing the entire symbol table: */ |
153 | #define tc_adjust_symtab() arm_adjust_symtab () | |
154 | extern void arm_adjust_symtab PARAMS ((void)); | |
155 | ||
305a3af6 SC |
156 | #if 0 |
157 | #define tc_crawl_symbol_chain(a) {;} /* not used */ | |
158 | #define tc_headers_hook(a) {;} /* not used */ | |
159 | #endif | |
160 | ||
161 | #define tc_aout_pre_write_hook(x) {;} /* not used */ | |
162 | ||
163 | #define LISTING_HEADER "ARM GAS " | |
164 | ||
165 | #define OPTIONAL_REGISTER_PREFIX '%' | |
166 | ||
167 | #define md_operand(x) | |
168 | ||
af16e411 FF |
169 | #define TC_HANDLES_FX_DONE |
170 | ||
171 | #define MD_APPLY_FIX3 | |
172 | ||
aae39e37 CM |
173 | #define LOCAL_LABEL(name) (name[0] == '.' \ |
174 | && (name[1] == 'L')) | |
305a3af6 SC |
175 | #define LOCAL_LABELS_FB 1 |
176 | ||
305a3af6 | 177 | /* end of tc-arm.h */ |