(test4): Test for presence of foo__1B, not absence
[binutils.git] / gas / struc-symbol.h
blob75735661bf2c01b22ebcf064b9ad4e59cf3d439d
1 /* struct_symbol.h - Internal symbol structure
2 Copyright (C) 1987, 92, 93, 94, 95, 98, 1999 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
21 #ifndef __struc_symbol_h__
22 #define __struc_symbol_h__
24 /* The information we keep for a symbol. Note that the symbol table
25 holds pointers both to this and to local_symbol structures. See
26 below. */
28 struct symbol
30 #ifdef BFD_ASSEMBLER
31 /* BFD symbol */
32 asymbol *bsym;
33 #else
34 /* The (4-origin) position of sy_name in the symbol table of the object
35 file. This will be 0 for (nameless) .stabd symbols.
37 Not used until write_object_file() time. */
38 unsigned long sy_name_offset;
40 /* What we write in .o file (if permitted). */
41 obj_symbol_type sy_symbol;
43 /* The 24 bit symbol number. Symbol numbers start at 0 and are unsigned. */
44 long sy_number;
45 #endif
47 /* The value of the symbol. */
48 expressionS sy_value;
50 /* Forwards and (optionally) backwards chain pointers. */
51 struct symbol *sy_next;
52 #ifdef SYMBOLS_NEED_BACKPOINTERS
53 struct symbol *sy_previous;
54 #endif /* SYMBOLS_NEED_BACKPOINTERS */
56 /* Pointer to the frag this symbol is attached to, if any.
57 Otherwise, NULL. */
58 struct frag *sy_frag;
60 unsigned int written : 1;
61 /* Whether symbol value has been completely resolved (used during
62 final pass over symbol table). */
63 unsigned int sy_resolved : 1;
64 /* Whether the symbol value is currently being resolved (used to
65 detect loops in symbol dependencies). */
66 unsigned int sy_resolving : 1;
67 /* Whether the symbol value is used in a reloc. This is used to
68 ensure that symbols used in relocs are written out, even if they
69 are local and would otherwise not be. */
70 unsigned int sy_used_in_reloc : 1;
72 /* Whether the symbol is used as an operand or in an expression.
73 NOTE: Not all the backends keep this information accurate;
74 backends which use this bit are responsible for setting it when
75 a symbol is used in backend routines. */
76 unsigned int sy_used : 1;
78 /* This is set if the symbol is defined in an MRI common section.
79 We handle such sections as single common symbols, so symbols
80 defined within them must be treated specially by the relocation
81 routines. */
82 unsigned int sy_mri_common : 1;
84 #ifdef OBJ_SYMFIELD_TYPE
85 OBJ_SYMFIELD_TYPE sy_obj;
86 #endif
88 #ifdef TC_SYMFIELD_TYPE
89 TC_SYMFIELD_TYPE sy_tc;
90 #endif
93 #ifdef BFD_ASSEMBLER
95 /* A pointer in the symbol may point to either a complete symbol
96 (struct symbol above) or to a local symbol (struct local_symbol
97 defined here). The symbol code can detect the case by examining
98 the first field. It is always NULL for a local symbol.
100 We do this because we ordinarily only need a small amount of
101 information for a local symbol. The symbol table takes up a lot of
102 space, and storing less information for a local symbol can make a
103 big difference in assembler memory usage when assembling a large
104 file. */
106 struct local_symbol
108 /* This pointer is always NULL to indicate that this is a local
109 symbol. */
110 asymbol *lsy_marker;
112 /* The symbol section. This also serves as a flag. If this is
113 reg_section, then this symbol has been converted into a regular
114 symbol, and sy_sym points to it. */
115 segT lsy_section;
117 /* The symbol name. */
118 const char *lsy_name;
120 /* The symbol frag or the real symbol, depending upon the value in
121 sy_section. If the symbol has been fully resolved, lsy_frag is
122 set to NULL. */
123 union
125 fragS *lsy_frag;
126 symbolS *lsy_sym;
127 } u;
129 /* The offset within the frag. */
130 valueT lsy_offset;
133 #define local_symbol_converted_p(l) ((l)->lsy_section == reg_section)
134 #define local_symbol_mark_converted(l) ((l)->lsy_section = reg_section)
135 #define local_symbol_resolved_p(l) ((l)->u.lsy_frag == NULL)
136 #define local_symbol_mark_resolved(l) ((l)->u.lsy_frag = NULL)
137 #define local_symbol_get_frag(l) ((l)->u.lsy_frag)
138 #define local_symbol_set_frag(l, f) ((l)->u.lsy_frag = (f))
139 #define local_symbol_get_real_symbol(l) ((l)->u.lsy_sym)
140 #define local_symbol_set_real_symbol(l, s) ((l)->u.lsy_sym = (s))
142 #endif /* BFD_ASSEMBLER */
144 #endif /* __struc_symbol_h__ */
146 /* end of struc-symbol.h */