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