]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* symbols.h - |
d87bef3a | 2 | Copyright (C) 1987-2023 Free Software Foundation, Inc. |
252b5132 RH |
3 | |
4 | This file is part of GAS, the GNU Assembler. | |
5 | ||
6 | GAS is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
ec2655a6 | 8 | the Free Software Foundation; either version 3, or (at your option) |
252b5132 RH |
9 | any later version. |
10 | ||
11 | GAS is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GAS; see the file COPYING. If not, write to the Free | |
4b4da160 NC |
18 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
19 | 02110-1301, USA. */ | |
252b5132 | 20 | |
a01b9fa4 | 21 | extern struct obstack notes; /* eg FixS live here. */ |
252b5132 RH |
22 | |
23 | extern struct obstack cond_obstack; /* this is where we track .ifdef/.endif | |
24 | (if we do that at all). */ | |
25 | ||
26 | extern symbolS *symbol_rootP; /* all the symbol nodes */ | |
27 | extern symbolS *symbol_lastP; /* last struct symbol we made, or NULL */ | |
28 | ||
29 | extern symbolS abs_symbol; | |
4a826962 | 30 | extern symbolS dot_symbol; |
252b5132 RH |
31 | |
32 | extern int symbol_table_frozen; | |
33 | ||
34 | /* This is non-zero if symbols are case sensitive, which is the | |
35 | default. */ | |
36 | extern int symbols_case_sensitive; | |
37 | ||
c30081c1 AM |
38 | extern void *notes_alloc (size_t); |
39 | extern void *notes_calloc (size_t, size_t); | |
40 | extern void *notes_memdup (const void *, size_t, size_t); | |
41 | extern char *notes_strdup (const char *); | |
42 | extern char *notes_concat (const char *, ...); | |
43 | extern void notes_free (void *); | |
44 | ||
280d71bf DB |
45 | char * symbol_relc_make_expr (expressionS *); |
46 | char * symbol_relc_make_sym (symbolS *); | |
47 | char * symbol_relc_make_value (offsetT); | |
74937d39 KH |
48 | char *decode_local_label_name (char *s); |
49 | symbolS *symbol_find (const char *name); | |
06e77878 | 50 | symbolS *symbol_find_noref (const char *name, int noref); |
74937d39 | 51 | symbolS *symbol_find_exact (const char *name); |
06e77878 | 52 | symbolS *symbol_find_exact_noref (const char *name, int noref); |
74937d39 KH |
53 | symbolS *symbol_find_or_make (const char *name); |
54 | symbolS *symbol_make (const char *name); | |
e01e1cee AM |
55 | symbolS *symbol_new (const char *, segT, fragS *, valueT); |
56 | symbolS *symbol_create (const char *, segT, fragS *, valueT); | |
57 | struct local_symbol *local_symbol_make (const char *, segT, fragS *, valueT); | |
9497f5ac NC |
58 | symbolS *symbol_clone (symbolS *, int); |
59 | #undef symbol_clone_if_forward_ref | |
60 | symbolS *symbol_clone_if_forward_ref (symbolS *, int); | |
61 | #define symbol_clone_if_forward_ref(s) symbol_clone_if_forward_ref (s, 0) | |
e01e1cee | 62 | symbolS *symbol_temp_new (segT, fragS *, valueT); |
74937d39 | 63 | symbolS *symbol_temp_new_now (void); |
d18d1999 | 64 | symbolS *symbol_temp_new_now_octets (void); |
74937d39 KH |
65 | symbolS *symbol_temp_make (void); |
66 | ||
67 | symbolS *colon (const char *sym_name); | |
68 | void local_colon (int n); | |
69 | void symbol_begin (void); | |
b1822093 | 70 | void symbol_end (void); |
4a826962 | 71 | void dot_symbol_init (void); |
74937d39 KH |
72 | void symbol_print_statistics (FILE *); |
73 | void symbol_table_insert (symbolS * symbolP); | |
74 | valueT resolve_symbol_value (symbolS *); | |
75 | void resolve_local_symbol_values (void); | |
2e1e12b1 | 76 | int snapshot_symbol (symbolS **, valueT *, segT *, fragS **); |
74937d39 KH |
77 | |
78 | void print_symbol_value (symbolS *); | |
79 | void print_expr (expressionS *); | |
80 | void print_expr_1 (FILE *, expressionS *); | |
81 | void print_symbol_value_1 (FILE *, symbolS *); | |
82 | ||
19f7966e | 83 | int dollar_label_defined (unsigned int); |
74937d39 | 84 | void dollar_label_clear (void); |
19f7966e AM |
85 | void define_dollar_label (unsigned int); |
86 | char *dollar_label_name (unsigned int, unsigned int); | |
74937d39 | 87 | |
19f7966e AM |
88 | void fb_label_instance_inc (unsigned int); |
89 | char *fb_label_name (unsigned int, unsigned int); | |
74937d39 KH |
90 | |
91 | extern void copy_symbol_attributes (symbolS *, symbolS *); | |
252b5132 RH |
92 | |
93 | /* Get and set the values of symbols. These used to be macros. */ | |
74937d39 | 94 | extern valueT S_GET_VALUE (symbolS *); |
12509439 | 95 | extern valueT S_GET_VALUE_WHERE (symbolS *, const char *, unsigned int); |
74937d39 | 96 | extern void S_SET_VALUE (symbolS *, valueT); |
252b5132 | 97 | |
74937d39 KH |
98 | extern int S_IS_FUNCTION (symbolS *); |
99 | extern int S_IS_EXTERNAL (symbolS *); | |
100 | extern int S_IS_WEAK (symbolS *); | |
06e77878 AO |
101 | extern int S_IS_WEAKREFR (symbolS *); |
102 | extern int S_IS_WEAKREFD (symbolS *); | |
74937d39 KH |
103 | extern int S_IS_COMMON (symbolS *); |
104 | extern int S_IS_DEFINED (symbolS *); | |
105 | extern int S_FORCE_RELOC (symbolS *, int); | |
106 | extern int S_IS_DEBUG (symbolS *); | |
107 | extern int S_IS_LOCAL (symbolS *); | |
74937d39 | 108 | extern int S_IS_STABD (symbolS *); |
6885131b | 109 | extern int S_CAN_BE_REDEFINED (const symbolS *); |
9497f5ac NC |
110 | extern int S_IS_VOLATILE (const symbolS *); |
111 | extern int S_IS_FORWARD_REF (const symbolS *); | |
74937d39 KH |
112 | extern const char *S_GET_NAME (symbolS *); |
113 | extern segT S_GET_SEGMENT (symbolS *); | |
114 | extern void S_SET_SEGMENT (symbolS *, segT); | |
115 | extern void S_SET_EXTERNAL (symbolS *); | |
977cdf5a | 116 | extern void S_SET_NAME (symbolS *, const char *); |
74937d39 KH |
117 | extern void S_CLEAR_EXTERNAL (symbolS *); |
118 | extern void S_SET_WEAK (symbolS *); | |
06e77878 AO |
119 | extern void S_SET_WEAKREFR (symbolS *); |
120 | extern void S_CLEAR_WEAKREFR (symbolS *); | |
121 | extern void S_SET_WEAKREFD (symbolS *); | |
122 | extern void S_CLEAR_WEAKREFD (symbolS *); | |
74937d39 | 123 | extern void S_SET_THREAD_LOCAL (symbolS *); |
9497f5ac | 124 | extern void S_SET_VOLATILE (symbolS *); |
92757bc9 | 125 | extern void S_CLEAR_VOLATILE (symbolS *); |
9497f5ac | 126 | extern void S_SET_FORWARD_REF (symbolS *); |
252b5132 | 127 | |
49309057 ILT |
128 | #ifndef WORKING_DOT_WORD |
129 | struct broken_word | |
130 | { | |
131 | /* Linked list -- one of these structures per ".word x-y+C" | |
132 | expression. */ | |
133 | struct broken_word *next_broken_word; | |
134 | /* Segment and subsegment for broken word. */ | |
135 | segT seg; | |
136 | subsegT subseg; | |
137 | /* Which frag is this broken word in? */ | |
138 | fragS *frag; | |
139 | /* Where in the frag is it? */ | |
140 | char *word_goes_here; | |
141 | /* Where to add the break. */ | |
142 | fragS *dispfrag; /* where to add the break */ | |
143 | /* Operands of expression. */ | |
144 | symbolS *add; | |
145 | symbolS *sub; | |
146 | offsetT addnum; | |
147 | ||
47eebc20 | 148 | int added; /* nasty thing happened yet? */ |
49309057 ILT |
149 | /* 1: added and has a long-jump */ |
150 | /* 2: added but uses someone elses long-jump */ | |
151 | ||
152 | /* Pointer to broken_word with a similar long-jump. */ | |
153 | struct broken_word *use_jump; | |
154 | }; | |
155 | extern struct broken_word *broken_words; | |
33eaf5de | 156 | #endif /* ifdef WORKING_DOT_WORD */ |
49309057 ILT |
157 | |
158 | /* | |
159 | * Current means for getting from symbols to segments and vice verse. | |
160 | * This will change for infinite-segments support (e.g. COFF). | |
161 | */ | |
162 | extern const segT N_TYPE_seg[]; /* subseg.c */ | |
163 | ||
164 | #define SEGMENT_TO_SYMBOL_TYPE(seg) ( seg_N_TYPE [(int) (seg)] ) | |
165 | extern const short seg_N_TYPE[];/* subseg.c */ | |
166 | ||
167 | #define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */ | |
168 | ||
74937d39 | 169 | void symbol_clear_list_pointers (symbolS * symbolP); |
49309057 | 170 | |
74937d39 KH |
171 | void symbol_insert (symbolS * addme, symbolS * target, |
172 | symbolS ** rootP, symbolS ** lastP); | |
173 | void symbol_remove (symbolS * symbolP, symbolS ** rootP, | |
174 | symbolS ** lastP); | |
49309057 | 175 | |
74937d39 | 176 | extern symbolS *symbol_previous (symbolS *); |
49309057 | 177 | |
8d1015a8 AM |
178 | extern int symbol_on_chain (symbolS *s, symbolS *rootPP, symbolS *lastPP); |
179 | ||
74937d39 | 180 | void verify_symbol_chain (symbolS * rootP, symbolS * lastP); |
74937d39 KH |
181 | |
182 | void symbol_append (symbolS * addme, symbolS * target, | |
183 | symbolS ** rootP, symbolS ** lastP); | |
184 | ||
185 | extern symbolS *symbol_next (symbolS *); | |
186 | ||
187 | extern expressionS *symbol_get_value_expression (symbolS *); | |
188 | extern void symbol_set_value_expression (symbolS *, const expressionS *); | |
514d955d | 189 | extern offsetT *symbol_X_add_number (symbolS *); |
74937d39 KH |
190 | extern void symbol_set_value_now (symbolS *); |
191 | extern void symbol_set_frag (symbolS *, fragS *); | |
192 | extern fragS *symbol_get_frag (symbolS *); | |
193 | extern void symbol_mark_used (symbolS *); | |
194 | extern void symbol_clear_used (symbolS *); | |
195 | extern int symbol_used_p (symbolS *); | |
196 | extern void symbol_mark_used_in_reloc (symbolS *); | |
197 | extern void symbol_clear_used_in_reloc (symbolS *); | |
198 | extern int symbol_used_in_reloc_p (symbolS *); | |
199 | extern void symbol_mark_mri_common (symbolS *); | |
200 | extern void symbol_clear_mri_common (symbolS *); | |
201 | extern int symbol_mri_common_p (symbolS *); | |
202 | extern void symbol_mark_written (symbolS *); | |
203 | extern void symbol_clear_written (symbolS *); | |
204 | extern int symbol_written_p (symbolS *); | |
eb09df16 L |
205 | extern void symbol_mark_removed (symbolS *); |
206 | extern int symbol_removed_p (symbolS *); | |
74937d39 KH |
207 | extern void symbol_mark_resolved (symbolS *); |
208 | extern int symbol_resolved_p (symbolS *); | |
209 | extern int symbol_section_p (symbolS *); | |
210 | extern int symbol_equated_p (symbolS *); | |
211 | extern int symbol_equated_reloc_p (symbolS *); | |
212 | extern int symbol_constant_p (symbolS *); | |
bdf128d6 | 213 | extern int symbol_shadow_p (symbolS *); |
8d1015a8 | 214 | extern symbolS *symbol_symbolS (symbolS *); |
74937d39 KH |
215 | extern asymbol *symbol_get_bfdsym (symbolS *); |
216 | extern void symbol_set_bfdsym (symbolS *, asymbol *); | |
087d837e | 217 | extern int symbol_same_p (symbolS *, symbolS *); |
49309057 ILT |
218 | |
219 | #ifdef OBJ_SYMFIELD_TYPE | |
74937d39 KH |
220 | OBJ_SYMFIELD_TYPE *symbol_get_obj (symbolS *); |
221 | void symbol_set_obj (symbolS *, OBJ_SYMFIELD_TYPE *); | |
49309057 ILT |
222 | #endif |
223 | ||
224 | #ifdef TC_SYMFIELD_TYPE | |
74937d39 KH |
225 | TC_SYMFIELD_TYPE *symbol_get_tc (symbolS *); |
226 | void symbol_set_tc (symbolS *, TC_SYMFIELD_TYPE *); | |
49309057 | 227 | #endif |