1 /* symbols.h - 2 Copyright (C) 1987-2014 Free Software Foundation, Inc. 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 8 the Free Software Foundation; either version 3, or (at your option) 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 18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 19 02110-1301, USA. */ 20 21 extern struct obstack notes; /* eg FixS live here. */ 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; 30 extern symbolS dot_symbol; 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 38 char * symbol_relc_make_expr (expressionS *); 39 char * symbol_relc_make_sym (symbolS *); 40 char * symbol_relc_make_value (offsetT); 41 char *decode_local_label_name (char *s); 42 symbolS *symbol_find (const char *name); 43 symbolS *symbol_find_noref (const char *name, int noref); 44 symbolS *symbol_find_exact (const char *name); 45 symbolS *symbol_find_exact_noref (const char *name, int noref); 46 symbolS *symbol_find_or_make (const char *name); 47 symbolS *symbol_make (const char *name); 48 symbolS *symbol_new (const char *name, segT segment, valueT value, 49 fragS * frag); 50 symbolS *symbol_create (const char *name, segT segment, valueT value, 51 fragS * frag); 52 struct local_symbol *local_symbol_make (const char *name, segT section, 53 valueT val, fragS *frag); 54 symbolS *symbol_clone (symbolS *, int); 55 #undef symbol_clone_if_forward_ref 56 symbolS *symbol_clone_if_forward_ref (symbolS *, int); 57 #define symbol_clone_if_forward_ref(s) symbol_clone_if_forward_ref (s, 0) 58 symbolS *symbol_temp_new (segT, valueT, fragS *); 59 symbolS *symbol_temp_new_now (void); 60 symbolS *symbol_temp_make (void); 61 62 symbolS *colon (const char *sym_name); 63 void local_colon (int n); 64 void symbol_begin (void); 65 void dot_symbol_init (void); 66 void symbol_print_statistics (FILE *); 67 void symbol_table_insert (symbolS * symbolP); 68 valueT resolve_symbol_value (symbolS *); 69 void resolve_local_symbol_values (void); 70 int snapshot_symbol (symbolS **, valueT *, segT *, fragS **); 71 72 void print_symbol_value (symbolS *); 73 void print_expr (expressionS *); 74 void print_expr_1 (FILE *, expressionS *); 75 void print_symbol_value_1 (FILE *, symbolS *); 76 77 int dollar_label_defined (long l); 78 void dollar_label_clear (void); 79 void define_dollar_label (long l); 80 char *dollar_label_name (long l, int augend); 81 82 void fb_label_instance_inc (long label); 83 char *fb_label_name (long n, long augend); 84 85 extern void copy_symbol_attributes (symbolS *, symbolS *); 86 87 /* Get and set the values of symbols. These used to be macros. */ 88 extern valueT S_GET_VALUE (symbolS *); 89 extern void S_SET_VALUE (symbolS *, valueT); 90 91 extern int S_IS_FUNCTION (symbolS *); 92 extern int S_IS_EXTERNAL (symbolS *); 93 extern int S_IS_WEAK (symbolS *); 94 extern int S_IS_WEAKREFR (symbolS *); 95 extern int S_IS_WEAKREFD (symbolS *); 96 extern int S_IS_COMMON (symbolS *); 97 extern int S_IS_DEFINED (symbolS *); 98 extern int S_FORCE_RELOC (symbolS *, int); 99 extern int S_IS_DEBUG (symbolS *); 100 extern int S_IS_LOCAL (symbolS *); 101 extern int S_IS_STABD (symbolS *); 102 extern int S_CAN_BE_REDEFINED (const symbolS *); 103 extern int S_IS_VOLATILE (const symbolS *); 104 extern int S_IS_FORWARD_REF (const symbolS *); 105 extern const char *S_GET_NAME (symbolS *); 106 extern segT S_GET_SEGMENT (symbolS *); 107 extern void S_SET_SEGMENT (symbolS *, segT); 108 extern void S_SET_EXTERNAL (symbolS *); 109 extern void S_SET_NAME (symbolS *, const char *); 110 extern void S_CLEAR_EXTERNAL (symbolS *); 111 extern void S_SET_WEAK (symbolS *); 112 extern void S_SET_WEAKREFR (symbolS *); 113 extern void S_CLEAR_WEAKREFR (symbolS *); 114 extern void S_SET_WEAKREFD (symbolS *); 115 extern void S_CLEAR_WEAKREFD (symbolS *); 116 extern void S_SET_THREAD_LOCAL (symbolS *); 117 extern void S_SET_VOLATILE (symbolS *); 118 extern void S_CLEAR_VOLATILE (symbolS *); 119 extern void S_SET_FORWARD_REF (symbolS *); 120 121 #ifndef WORKING_DOT_WORD 122 struct broken_word 123 { 124 /* Linked list -- one of these structures per ".word x-y+C" 125 expression. */ 126 struct broken_word *next_broken_word; 127 /* Segment and subsegment for broken word. */ 128 segT seg; 129 subsegT subseg; 130 /* Which frag is this broken word in? */ 131 fragS *frag; 132 /* Where in the frag is it? */ 133 char *word_goes_here; 134 /* Where to add the break. */ 135 fragS *dispfrag; /* where to add the break */ 136 /* Operands of expression. */ 137 symbolS *add; 138 symbolS *sub; 139 offsetT addnum; 140 141 int added; /* nasty thing happened yet? */ 142 /* 1: added and has a long-jump */ 143 /* 2: added but uses someone elses long-jump */ 144 145 /* Pointer to broken_word with a similar long-jump. */ 146 struct broken_word *use_jump; 147 }; 148 extern struct broken_word *broken_words; 149 #endif /* ndef WORKING_DOT_WORD */ 150 151 /* 152 * Current means for getting from symbols to segments and vice verse. 153 * This will change for infinite-segments support (e.g. COFF). 154 */ 155 extern const segT N_TYPE_seg[]; /* subseg.c */ 156 157 #define SEGMENT_TO_SYMBOL_TYPE(seg) ( seg_N_TYPE [(int) (seg)] ) 158 extern const short seg_N_TYPE[];/* subseg.c */ 159 160 #define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */ 161 162 void symbol_clear_list_pointers (symbolS * symbolP); 163 164 void symbol_insert (symbolS * addme, symbolS * target, 165 symbolS ** rootP, symbolS ** lastP); 166 void symbol_remove (symbolS * symbolP, symbolS ** rootP, 167 symbolS ** lastP); 168 169 extern symbolS *symbol_previous (symbolS *); 170 171 void verify_symbol_chain (symbolS * rootP, symbolS * lastP); 172 173 void symbol_append (symbolS * addme, symbolS * target, 174 symbolS ** rootP, symbolS ** lastP); 175 176 extern symbolS *symbol_next (symbolS *); 177 178 extern expressionS *symbol_get_value_expression (symbolS *); 179 extern void symbol_set_value_expression (symbolS *, const expressionS *); 180 extern offsetT *symbol_X_add_number (symbolS *); 181 extern void symbol_set_value_now (symbolS *); 182 extern void symbol_set_frag (symbolS *, fragS *); 183 extern fragS *symbol_get_frag (symbolS *); 184 extern void symbol_mark_used (symbolS *); 185 extern void symbol_clear_used (symbolS *); 186 extern int symbol_used_p (symbolS *); 187 extern void symbol_mark_used_in_reloc (symbolS *); 188 extern void symbol_clear_used_in_reloc (symbolS *); 189 extern int symbol_used_in_reloc_p (symbolS *); 190 extern void symbol_mark_mri_common (symbolS *); 191 extern void symbol_clear_mri_common (symbolS *); 192 extern int symbol_mri_common_p (symbolS *); 193 extern void symbol_mark_written (symbolS *); 194 extern void symbol_clear_written (symbolS *); 195 extern int symbol_written_p (symbolS *); 196 extern void symbol_mark_resolved (symbolS *); 197 extern int symbol_resolved_p (symbolS *); 198 extern int symbol_section_p (symbolS *); 199 extern int symbol_equated_p (symbolS *); 200 extern int symbol_equated_reloc_p (symbolS *); 201 extern int symbol_constant_p (symbolS *); 202 extern int symbol_shadow_p (symbolS *); 203 extern asymbol *symbol_get_bfdsym (symbolS *); 204 extern void symbol_set_bfdsym (symbolS *, asymbol *); 205 extern int symbol_same_p (symbolS *, symbolS *); 206 207 #ifdef OBJ_SYMFIELD_TYPE 208 OBJ_SYMFIELD_TYPE *symbol_get_obj (symbolS *); 209 void symbol_set_obj (symbolS *, OBJ_SYMFIELD_TYPE *); 210 #endif 211 212 #ifdef TC_SYMFIELD_TYPE 213 TC_SYMFIELD_TYPE *symbol_get_tc (symbolS *); 214 void symbol_set_tc (symbolS *, TC_SYMFIELD_TYPE *); 215 #endif 216