Commit | Line | Data |
---|---|---|
fecd2382 | 1 | /* struct_symbol.h - Internal symbol structure |
3340f7e5 | 2 | Copyright (C) 1987, 1992 Free Software Foundation, Inc. |
6efd877d | 3 | |
a39116f1 | 4 | This file is part of GAS, the GNU Assembler. |
6efd877d | 5 | |
a39116f1 RP |
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. | |
6efd877d | 10 | |
a39116f1 RP |
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. | |
6efd877d | 15 | |
b17c891e | 16 | You should have received a copy of the GNU General Public License |
a39116f1 RP |
17 | along with GAS; see the file COPYING. If not, write to |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
fecd2382 | 19 | |
6efd877d KR |
20 | #ifndef __struc_symbol_h__ |
21 | #define __struc_symbol_h__ | |
22 | ||
b17c891e KR |
23 | #ifdef BFD_ASSEMBLER |
24 | /* The BFD code wants to walk the list in both directions. */ | |
25 | #undef SYMBOLS_NEED_BACKPOINTERS | |
26 | #define SYMBOLS_NEED_BACKPOINTERS | |
27 | #endif | |
28 | ||
29 | /* our version of an nlist node */ | |
30 | struct symbol | |
fecd2382 | 31 | { |
b17c891e KR |
32 | #ifndef BFD_ASSEMBLER |
33 | /* The (4-origin) position of sy_name in the symbol table of the object | |
34 | file. This will be 0 for (nameless) .stabd symbols. | |
35 | ||
36 | Not used until write_object_file() time. */ | |
37 | unsigned long sy_name_offset; | |
38 | ||
39 | /* What we write in .o file (if permitted). */ | |
40 | obj_symbol_type sy_symbol; | |
41 | ||
42 | /* The 24 bit symbol number. Symbol numbers start at 0 and are unsigned. */ | |
43 | long sy_number; | |
44 | #else | |
45 | /* BFD symbol */ | |
46 | asymbol *bsym; | |
47 | #endif | |
48 | ||
6efd877d | 49 | struct symbol *sy_next; /* forward chain, or NULL */ |
fecd2382 | 50 | #ifdef SYMBOLS_NEED_BACKPOINTERS |
6efd877d | 51 | struct symbol *sy_previous; /* backward chain, or NULL */ |
fecd2382 | 52 | #endif /* SYMBOLS_NEED_BACKPOINTERS */ |
b17c891e | 53 | |
6efd877d | 54 | struct frag *sy_frag; /* NULL or -> frag this symbol attaches to. */ |
b17c891e | 55 | |
6efd877d | 56 | struct symbol *sy_forward; /* value is really that of this other symbol */ |
b17c891e KR |
57 | |
58 | int written : 1; | |
59 | ||
60 | #ifdef TARGET_SYMBOL_FIELDS | |
61 | TARGET_SYMBOL_FIELDS | |
62 | #endif | |
fecd2382 RP |
63 | }; |
64 | ||
65 | typedef struct symbol symbolS; | |
66 | ||
fecd2382 | 67 | #ifndef WORKING_DOT_WORD |
6efd877d KR |
68 | struct broken_word |
69 | { | |
70 | struct broken_word *next_broken_word; /* One of these strucs per .word x-y */ | |
71 | fragS *frag; /* Which frag its in */ | |
72 | char *word_goes_here; /* Where in the frag it is */ | |
73 | fragS *dispfrag; /* where to add the break */ | |
74 | symbolS *add; /* symbol_x */ | |
75 | symbolS *sub; /* - symbol_y */ | |
b17c891e | 76 | offsetT addnum; /* + addnum */ |
6efd877d KR |
77 | int added; /* nasty thing happend yet? */ |
78 | /* 1: added and has a long-jump */ | |
79 | /* 2: added but uses someone elses long-jump */ | |
80 | struct broken_word *use_jump; /* points to broken_word with a similar | |
fecd2382 | 81 | long-jump */ |
6efd877d | 82 | }; |
fecd2382 RP |
83 | extern struct broken_word *broken_words; |
84 | #endif /* ndef WORKING_DOT_WORD */ | |
85 | ||
86 | /* | |
87 | * Current means for getting from symbols to segments and vice verse. | |
88 | * This will change for infinite-segments support (e.g. COFF). | |
89 | */ | |
90 | /* #define SYMBOL_TYPE_TO_SEGMENT(symP) ( N_TYPE_seg [(int) (symP)->sy_type & N_TYPE] ) */ | |
b17c891e | 91 | extern const segT N_TYPE_seg[]; /* subseg.c */ |
fecd2382 RP |
92 | |
93 | #define SEGMENT_TO_SYMBOL_TYPE(seg) ( seg_N_TYPE [(int) (seg)] ) | |
6efd877d | 94 | extern const short seg_N_TYPE[];/* subseg.c */ |
fecd2382 RP |
95 | |
96 | #define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */ | |
97 | ||
98 | #ifdef SYMBOLS_NEED_BACKPOINTERS | |
fecd2382 | 99 | |
b17c891e KR |
100 | void symbol_clear_list_pointers PARAMS ((symbolS * symbolP)); |
101 | void symbol_insert PARAMS ((symbolS * addme, symbolS * target, | |
102 | symbolS ** rootP, symbolS ** lastP)); | |
103 | void symbol_remove PARAMS ((symbolS * symbolP, symbolS ** rootP, | |
104 | symbolS ** lastP)); | |
105 | void verify_symbol_chain PARAMS ((symbolS * rootP, symbolS * lastP)); | |
fecd2382 RP |
106 | |
107 | #define symbol_previous(s) ((s)->sy_previous) | |
108 | ||
109 | #else /* SYMBOLS_NEED_BACKPOINTERS */ | |
110 | ||
111 | #define symbol_clear_list_pointers(clearme) {clearme->sy_next = NULL;} | |
112 | ||
113 | #endif /* SYMBOLS_NEED_BACKPOINTERS */ | |
114 | ||
b17c891e KR |
115 | void symbol_append PARAMS ((symbolS * addme, symbolS * target, |
116 | symbolS ** rootP, symbolS ** lastP)); | |
fecd2382 RP |
117 | |
118 | #define symbol_next(s) ((s)->sy_next) | |
119 | ||
6efd877d KR |
120 | #endif /* __struc_symbol_h__ */ |
121 | ||
fecd2382 | 122 | /* end of struc-symbol.h */ |