1999-10-27 Andreas Jaeger <aj@suse.de>
[binutils.git] / gas / symbols.h
blobf3b73af9660249b86a12feeb3fcc1362161a9d63
1 /* symbols.h -
2 Copyright (C) 1987, 90, 92, 93, 94, 95, 97, 1999
3 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 PARAMS ((char *s));
51 symbolS *symbol_find PARAMS ((CONST char *name));
52 symbolS *symbol_find_base PARAMS ((CONST char *name, int strip_underscore));
53 symbolS *symbol_find_or_make PARAMS ((const char *name));
54 symbolS *symbol_make PARAMS ((CONST char *name));
55 symbolS *symbol_new PARAMS ((CONST char *name, segT segment, valueT value,
56 fragS * frag));
57 symbolS *symbol_create PARAMS ((CONST char *name, segT segment, valueT value,
58 fragS * frag));
59 symbolS *colon PARAMS ((const char *sym_name));
60 void local_colon PARAMS ((int n));
61 void symbol_begin PARAMS ((void));
62 void symbol_print_statistics PARAMS ((FILE *));
63 void symbol_table_insert PARAMS ((symbolS * symbolP));
64 valueT resolve_symbol_value PARAMS ((symbolS *, int));
65 void resolve_local_symbol_values PARAMS ((void));
67 void print_symbol_value PARAMS ((symbolS *));
68 void print_expr PARAMS ((expressionS *));
69 void print_expr_1 PARAMS ((FILE *, expressionS *));
70 void print_symbol_value_1 PARAMS ((FILE *, symbolS *));
72 int dollar_label_defined PARAMS ((long l));
73 void dollar_label_clear PARAMS ((void));
74 void define_dollar_label PARAMS ((long l));
75 char *dollar_label_name PARAMS ((long l, int augend));
77 void fb_label_instance_inc PARAMS ((long label));
78 char *fb_label_name PARAMS ((long n, long augend));
80 extern void copy_symbol_attributes PARAMS ((symbolS *, symbolS *));
82 /* Get and set the values of symbols. These used to be macros. */
83 extern valueT S_GET_VALUE PARAMS ((symbolS *));
84 extern void S_SET_VALUE PARAMS ((symbolS *, valueT));
86 #ifdef BFD_ASSEMBLER
87 extern int S_IS_FUNCTION PARAMS ((symbolS *));
88 extern int S_IS_EXTERNAL PARAMS ((symbolS *));
89 extern int S_IS_WEAK PARAMS ((symbolS *));
90 extern int S_IS_COMMON PARAMS ((symbolS *));
91 extern int S_IS_DEFINED PARAMS ((symbolS *));
92 extern int S_IS_DEBUG PARAMS ((symbolS *));
93 extern int S_IS_LOCAL PARAMS ((symbolS *));
94 extern int S_IS_EXTERN PARAMS ((symbolS *));
95 extern int S_IS_STABD PARAMS ((symbolS *));
96 extern CONST char *S_GET_NAME PARAMS ((symbolS *));
97 extern segT S_GET_SEGMENT PARAMS ((symbolS *));
98 extern void S_SET_SEGMENT PARAMS ((symbolS *, segT));
99 extern void S_SET_EXTERNAL PARAMS ((symbolS *));
100 extern void S_SET_NAME PARAMS ((symbolS *, char *));
101 extern void S_CLEAR_EXTERNAL PARAMS ((symbolS *));
102 extern void S_SET_WEAK PARAMS ((symbolS *));
103 #endif
105 #ifndef WORKING_DOT_WORD
106 struct broken_word
108 /* Linked list -- one of these structures per ".word x-y+C"
109 expression. */
110 struct broken_word *next_broken_word;
111 /* Segment and subsegment for broken word. */
112 segT seg;
113 subsegT subseg;
114 /* Which frag is this broken word in? */
115 fragS *frag;
116 /* Where in the frag is it? */
117 char *word_goes_here;
118 /* Where to add the break. */
119 fragS *dispfrag; /* where to add the break */
120 /* Operands of expression. */
121 symbolS *add;
122 symbolS *sub;
123 offsetT addnum;
125 int added; /* nasty thing happend yet? */
126 /* 1: added and has a long-jump */
127 /* 2: added but uses someone elses long-jump */
129 /* Pointer to broken_word with a similar long-jump. */
130 struct broken_word *use_jump;
132 extern struct broken_word *broken_words;
133 #endif /* ndef WORKING_DOT_WORD */
136 * Current means for getting from symbols to segments and vice verse.
137 * This will change for infinite-segments support (e.g. COFF).
139 extern const segT N_TYPE_seg[]; /* subseg.c */
141 #define SEGMENT_TO_SYMBOL_TYPE(seg) ( seg_N_TYPE [(int) (seg)] )
142 extern const short seg_N_TYPE[];/* subseg.c */
144 #define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */
146 void symbol_clear_list_pointers PARAMS ((symbolS * symbolP));
148 #ifdef SYMBOLS_NEED_BACKPOINTERS
150 void symbol_insert PARAMS ((symbolS * addme, symbolS * target,
151 symbolS ** rootP, symbolS ** lastP));
152 void symbol_remove PARAMS ((symbolS * symbolP, symbolS ** rootP,
153 symbolS ** lastP));
155 extern symbolS *symbol_previous PARAMS ((symbolS *));
157 #endif /* SYMBOLS_NEED_BACKPOINTERS */
159 void verify_symbol_chain PARAMS ((symbolS * rootP, symbolS * lastP));
160 void verify_symbol_chain_2 PARAMS ((symbolS * symP));
162 void symbol_append PARAMS ((symbolS * addme, symbolS * target,
163 symbolS ** rootP, symbolS ** lastP));
165 extern symbolS *symbol_next PARAMS ((symbolS *));
167 extern expressionS *symbol_get_value_expression PARAMS ((symbolS *));
168 extern void symbol_set_value_expression PARAMS ((symbolS *,
169 const expressionS *));
170 extern void symbol_set_frag PARAMS ((symbolS *, fragS *));
171 extern fragS *symbol_get_frag PARAMS ((symbolS *));
172 extern void symbol_mark_used PARAMS ((symbolS *));
173 extern void symbol_clear_used PARAMS ((symbolS *));
174 extern int symbol_used_p PARAMS ((symbolS *));
175 extern void symbol_mark_used_in_reloc PARAMS ((symbolS *));
176 extern void symbol_clear_used_in_reloc PARAMS ((symbolS *));
177 extern int symbol_used_in_reloc_p PARAMS ((symbolS *));
178 extern void symbol_mark_mri_common PARAMS ((symbolS *));
179 extern void symbol_clear_mri_common PARAMS ((symbolS *));
180 extern int symbol_mri_common_p PARAMS ((symbolS *));
181 extern void symbol_mark_written PARAMS ((symbolS *));
182 extern void symbol_clear_written PARAMS ((symbolS *));
183 extern int symbol_written_p PARAMS ((symbolS *));
184 extern void symbol_mark_resolved PARAMS ((symbolS *));
185 extern int symbol_resolved_p PARAMS ((symbolS *));
186 extern int symbol_section_p PARAMS ((symbolS *));
187 extern int symbol_equated_p PARAMS ((symbolS *));
188 extern int symbol_constant_p PARAMS ((symbolS *));
190 #ifdef BFD_ASSEMBLER
191 extern asymbol *symbol_get_bfdsym PARAMS ((symbolS *));
192 extern void symbol_set_bfdsym PARAMS ((symbolS *, asymbol *));
193 #endif
195 #ifdef OBJ_SYMFIELD_TYPE
196 OBJ_SYMFIELD_TYPE *symbol_get_obj PARAMS ((symbolS *));
197 void symbol_set_obj PARAMS ((symbolS *, OBJ_SYMFIELD_TYPE *));
198 #endif
200 #ifdef TC_SYMFIELD_TYPE
201 TC_SYMFIELD_TYPE *symbol_get_tc PARAMS ((symbolS *));
202 void symbol_set_tc PARAMS ((symbolS *, TC_SYMFIELD_TYPE *));
203 #endif
205 /* end of symbols.h */