1 /* struct_symbol.h - Internal symbol structure
2 Copyright 1987, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2005
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)
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, 51 Franklin Street - Fifth Floor, Boston, MA
22 #ifndef __struc_symbol_h__
23 #define __struc_symbol_h__
25 /* The information we keep for a symbol. Note that the symbol table
26 holds pointers both to this and to local_symbol structures. See
34 /* The value of the symbol. */
37 /* Forwards and (optionally) backwards chain pointers. */
38 struct symbol
*sy_next
;
39 struct symbol
*sy_previous
;
41 /* Pointer to the frag this symbol is attached to, if any.
45 unsigned int written
: 1;
46 /* Whether symbol value has been completely resolved (used during
47 final pass over symbol table). */
48 unsigned int sy_resolved
: 1;
49 /* Whether the symbol value is currently being resolved (used to
50 detect loops in symbol dependencies). */
51 unsigned int sy_resolving
: 1;
52 /* Whether the symbol value is used in a reloc. This is used to
53 ensure that symbols used in relocs are written out, even if they
54 are local and would otherwise not be. */
55 unsigned int sy_used_in_reloc
: 1;
57 /* Whether the symbol is used as an operand or in an expression.
58 NOTE: Not all the backends keep this information accurate;
59 backends which use this bit are responsible for setting it when
60 a symbol is used in backend routines. */
61 unsigned int sy_used
: 1;
63 /* This is set if the symbol is defined in an MRI common section.
64 We handle such sections as single common symbols, so symbols
65 defined within them must be treated specially by the relocation
67 unsigned int sy_mri_common
: 1;
69 #ifdef OBJ_SYMFIELD_TYPE
70 OBJ_SYMFIELD_TYPE sy_obj
;
73 #ifdef TC_SYMFIELD_TYPE
74 TC_SYMFIELD_TYPE sy_tc
;
77 #ifdef TARGET_SYMBOL_FIELDS
82 /* A pointer in the symbol may point to either a complete symbol
83 (struct symbol above) or to a local symbol (struct local_symbol
84 defined here). The symbol code can detect the case by examining
85 the first field. It is always NULL for a local symbol.
87 We do this because we ordinarily only need a small amount of
88 information for a local symbol. The symbol table takes up a lot of
89 space, and storing less information for a local symbol can make a
90 big difference in assembler memory usage when assembling a large
95 /* This pointer is always NULL to indicate that this is a local
99 /* The symbol section. This also serves as a flag. If this is
100 reg_section, then this symbol has been converted into a regular
101 symbol, and lsy_sym points to it. */
104 /* The symbol name. */
105 const char *lsy_name
;
107 /* The symbol frag or the real symbol, depending upon the value in
108 lsy_section. If the symbol has been fully resolved, lsy_frag is
116 /* The value of the symbol. */
119 #ifdef TC_LOCAL_SYMFIELD_TYPE
120 TC_LOCAL_SYMFIELD_TYPE lsy_tc
;
124 #define local_symbol_converted_p(l) ((l)->lsy_section == reg_section)
125 #define local_symbol_mark_converted(l) ((l)->lsy_section = reg_section)
126 #define local_symbol_resolved_p(l) ((l)->u.lsy_frag == NULL)
127 #define local_symbol_mark_resolved(l) ((l)->u.lsy_frag = NULL)
128 #define local_symbol_get_frag(l) ((l)->u.lsy_frag)
129 #define local_symbol_set_frag(l, f) ((l)->u.lsy_frag = (f))
130 #define local_symbol_get_real_symbol(l) ((l)->u.lsy_sym)
131 #define local_symbol_set_real_symbol(l, s) ((l)->u.lsy_sym = (s))
133 #endif /* __struc_symbol_h__ */