1 /* struct_symbol.h - Internal symbol structure
2 Copyright (C) 1987, 92, 93, 94, 95, 1998 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)
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
21 #ifndef __struc_symbol_h__
22 #define __struc_symbol_h__
25 /* The BFD code wants to walk the list in both directions. */
26 #undef SYMBOLS_NEED_BACKPOINTERS
27 #define SYMBOLS_NEED_BACKPOINTERS
30 /* our version of an nlist node */
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. */
50 /* The value of the symbol. */
53 /* Forwards and (optionally) backwards chain pointers. */
54 struct symbol
*sy_next
;
55 #ifdef SYMBOLS_NEED_BACKPOINTERS
56 struct symbol
*sy_previous
;
57 #endif /* SYMBOLS_NEED_BACKPOINTERS */
59 /* Pointer to the frag this symbol is attached to, if any.
63 unsigned int written
: 1;
64 /* Whether symbol value has been completely resolved (used during
65 final pass over symbol table). */
66 unsigned int sy_resolved
: 1;
67 /* Whether the symbol value is currently being resolved (used to
68 detect loops in symbol dependencies). */
69 unsigned int sy_resolving
: 1;
70 /* Whether the symbol value is used in a reloc. This is used to
71 ensure that symbols used in relocs are written out, even if they
72 are local and would otherwise not be. */
73 unsigned int sy_used_in_reloc
: 1;
75 /* Whether the symbol is used as an operand or in an expression.
76 NOTE: Not all the backends keep this information accurate;
77 backends which use this bit are responsible for setting it when
78 a symbol is used in backend routines. */
79 unsigned int sy_used
: 1;
81 /* This is set if the symbol is defined in an MRI common section.
82 We handle such sections as single common symbols, so symbols
83 defined within them must be treated specially by the relocation
85 unsigned int sy_mri_common
: 1;
87 #ifdef OBJ_SYMFIELD_TYPE
88 OBJ_SYMFIELD_TYPE sy_obj
;
91 #ifdef TC_SYMFIELD_TYPE
92 TC_SYMFIELD_TYPE sy_tc
;
95 #ifdef TARGET_SYMBOL_FIELDS
100 typedef struct symbol symbolS
;
102 #ifndef WORKING_DOT_WORD
105 /* Linked list -- one of these structures per ".word x-y+C"
107 struct broken_word
*next_broken_word
;
108 /* Segment and subsegment for broken word. */
111 /* Which frag is this broken word in? */
113 /* Where in the frag is it? */
114 char *word_goes_here
;
115 /* Where to add the break. */
116 fragS
*dispfrag
; /* where to add the break */
117 /* Operands of expression. */
122 int added
; /* nasty thing happend yet? */
123 /* 1: added and has a long-jump */
124 /* 2: added but uses someone elses long-jump */
126 /* Pointer to broken_word with a similar long-jump. */
127 struct broken_word
*use_jump
;
129 extern struct broken_word
*broken_words
;
130 #endif /* ndef WORKING_DOT_WORD */
133 * Current means for getting from symbols to segments and vice verse.
134 * This will change for infinite-segments support (e.g. COFF).
136 extern const segT N_TYPE_seg
[]; /* subseg.c */
138 #define SEGMENT_TO_SYMBOL_TYPE(seg) ( seg_N_TYPE [(int) (seg)] )
139 extern const short seg_N_TYPE
[];/* subseg.c */
141 #define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */
143 void symbol_clear_list_pointers
PARAMS ((symbolS
* symbolP
));
145 #ifdef SYMBOLS_NEED_BACKPOINTERS
147 void symbol_insert
PARAMS ((symbolS
* addme
, symbolS
* target
,
148 symbolS
** rootP
, symbolS
** lastP
));
149 void symbol_remove
PARAMS ((symbolS
* symbolP
, symbolS
** rootP
,
152 #define symbol_previous(s) ((s)->sy_previous)
154 #endif /* SYMBOLS_NEED_BACKPOINTERS */
156 void verify_symbol_chain
PARAMS ((symbolS
* rootP
, symbolS
* lastP
));
157 void verify_symbol_chain_2
PARAMS ((symbolS
* symP
));
159 void symbol_append
PARAMS ((symbolS
* addme
, symbolS
* target
,
160 symbolS
** rootP
, symbolS
** lastP
));
162 #define symbol_next(s) ((s)->sy_next)
164 #endif /* __struc_symbol_h__ */
166 /* end of struc-symbol.h */