* gas/arm/arm.exp: Add "undefined" test.
[binutils.git] / gas / symbols.h
blob15dc2639bf8d2e18c5acaba0d7ceb4e3f14dbcc1
1 /* symbols.h -
2 Copyright 1987, 1990, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001,
3 2002, 2003 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
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.
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.
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, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #ifdef BFD_ASSEMBLER
23 /* The BFD code wants to walk the list in both directions. */
24 #undef SYMBOLS_NEED_BACKPOINTERS
25 #define SYMBOLS_NEED_BACKPOINTERS
26 #endif
28 #ifndef BFD_ASSEMBLER
29 /* The non-BFD code expects to be able to manipulate the symbol fields
30 directly. */
31 #include "struc-symbol.h"
32 #endif
34 extern struct obstack notes; /* eg FixS live here. */
36 extern struct obstack cond_obstack; /* this is where we track .ifdef/.endif
37 (if we do that at all). */
39 extern symbolS *symbol_rootP; /* all the symbol nodes */
40 extern symbolS *symbol_lastP; /* last struct symbol we made, or NULL */
42 extern symbolS abs_symbol;
44 extern int symbol_table_frozen;
46 /* This is non-zero if symbols are case sensitive, which is the
47 default. */
48 extern int symbols_case_sensitive;
50 char *decode_local_label_name (char *s);
51 symbolS *symbol_find (const char *name);
52 symbolS *symbol_find_exact (const char *name);
53 symbolS *symbol_find_base (const char *name, int strip_underscore);
54 symbolS *symbol_find_or_make (const char *name);
55 symbolS *symbol_make (const char *name);
56 symbolS *symbol_new (const char *name, segT segment, valueT value,
57 fragS * frag);
58 symbolS *symbol_create (const char *name, segT segment, valueT value,
59 fragS * frag);
60 struct local_symbol *local_symbol_make (const char *name, segT section,
61 valueT value, fragS * frag);
62 symbolS *symbol_temp_new (segT, valueT, fragS *);
63 symbolS *symbol_temp_new_now (void);
64 symbolS *symbol_temp_make (void);
66 symbolS *colon (const char *sym_name);
67 void local_colon (int n);
68 void symbol_begin (void);
69 void symbol_print_statistics (FILE *);
70 void symbol_table_insert (symbolS * symbolP);
71 valueT resolve_symbol_value (symbolS *);
72 void resolve_local_symbol_values (void);
74 void print_symbol_value (symbolS *);
75 void print_expr (expressionS *);
76 void print_expr_1 (FILE *, expressionS *);
77 void print_symbol_value_1 (FILE *, symbolS *);
79 int dollar_label_defined (long l);
80 void dollar_label_clear (void);
81 void define_dollar_label (long l);
82 char *dollar_label_name (long l, int augend);
84 void fb_label_instance_inc (long label);
85 char *fb_label_name (long n, long augend);
87 extern void copy_symbol_attributes (symbolS *, symbolS *);
89 /* Get and set the values of symbols. These used to be macros. */
90 extern valueT S_GET_VALUE (symbolS *);
91 extern void S_SET_VALUE (symbolS *, valueT);
93 #ifdef BFD_ASSEMBLER
94 extern int S_IS_FUNCTION (symbolS *);
95 extern int S_IS_EXTERNAL (symbolS *);
96 extern int S_IS_WEAK (symbolS *);
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 *);
102 extern int S_IS_EXTERN (symbolS *);
103 extern int S_IS_STABD (symbolS *);
104 extern const char *S_GET_NAME (symbolS *);
105 extern segT S_GET_SEGMENT (symbolS *);
106 extern void S_SET_SEGMENT (symbolS *, segT);
107 extern void S_SET_EXTERNAL (symbolS *);
108 extern void S_SET_NAME (symbolS *, char *);
109 extern void S_CLEAR_EXTERNAL (symbolS *);
110 extern void S_SET_WEAK (symbolS *);
111 extern void S_SET_THREAD_LOCAL (symbolS *);
112 #endif
114 #ifndef WORKING_DOT_WORD
115 struct broken_word
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;
134 int added; /* nasty thing happened yet? */
135 /* 1: added and has a long-jump */
136 /* 2: added but uses someone elses long-jump */
138 /* Pointer to broken_word with a similar long-jump. */
139 struct broken_word *use_jump;
141 extern struct broken_word *broken_words;
142 #endif /* ndef WORKING_DOT_WORD */
145 * Current means for getting from symbols to segments and vice verse.
146 * This will change for infinite-segments support (e.g. COFF).
148 extern const segT N_TYPE_seg[]; /* subseg.c */
150 #define SEGMENT_TO_SYMBOL_TYPE(seg) ( seg_N_TYPE [(int) (seg)] )
151 extern const short seg_N_TYPE[];/* subseg.c */
153 #define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */
155 void symbol_clear_list_pointers (symbolS * symbolP);
157 #ifdef SYMBOLS_NEED_BACKPOINTERS
159 void symbol_insert (symbolS * addme, symbolS * target,
160 symbolS ** rootP, symbolS ** lastP);
161 void symbol_remove (symbolS * symbolP, symbolS ** rootP,
162 symbolS ** lastP);
164 extern symbolS *symbol_previous (symbolS *);
166 #endif /* SYMBOLS_NEED_BACKPOINTERS */
168 void verify_symbol_chain (symbolS * rootP, symbolS * lastP);
169 void verify_symbol_chain_2 (symbolS * symP);
171 void symbol_append (symbolS * addme, symbolS * target,
172 symbolS ** rootP, symbolS ** lastP);
174 extern symbolS *symbol_next (symbolS *);
176 extern expressionS *symbol_get_value_expression (symbolS *);
177 extern void symbol_set_value_expression (symbolS *, const expressionS *);
178 extern void symbol_set_value_now (symbolS *);
179 extern void symbol_set_frag (symbolS *, fragS *);
180 extern fragS *symbol_get_frag (symbolS *);
181 extern void symbol_mark_used (symbolS *);
182 extern void symbol_clear_used (symbolS *);
183 extern int symbol_used_p (symbolS *);
184 extern void symbol_mark_used_in_reloc (symbolS *);
185 extern void symbol_clear_used_in_reloc (symbolS *);
186 extern int symbol_used_in_reloc_p (symbolS *);
187 extern void symbol_mark_mri_common (symbolS *);
188 extern void symbol_clear_mri_common (symbolS *);
189 extern int symbol_mri_common_p (symbolS *);
190 extern void symbol_mark_written (symbolS *);
191 extern void symbol_clear_written (symbolS *);
192 extern int symbol_written_p (symbolS *);
193 extern void symbol_mark_resolved (symbolS *);
194 extern int symbol_resolved_p (symbolS *);
195 extern int symbol_section_p (symbolS *);
196 extern int symbol_equated_p (symbolS *);
197 extern int symbol_equated_reloc_p (symbolS *);
198 extern int symbol_constant_p (symbolS *);
200 #ifdef BFD_ASSEMBLER
201 extern asymbol *symbol_get_bfdsym (symbolS *);
202 extern void symbol_set_bfdsym (symbolS *, asymbol *);
203 #endif
205 #ifdef OBJ_SYMFIELD_TYPE
206 OBJ_SYMFIELD_TYPE *symbol_get_obj (symbolS *);
207 void symbol_set_obj (symbolS *, OBJ_SYMFIELD_TYPE *);
208 #endif
210 #ifdef TC_SYMFIELD_TYPE
211 TC_SYMFIELD_TYPE *symbol_get_tc (symbolS *);
212 void symbol_set_tc (symbolS *, TC_SYMFIELD_TYPE *);
213 #endif