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