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