Initial import from FreeBSD RELENG_4:
[dragonfly.git] / gnu / usr.bin / as / struc-symbol.h
1 /* struct_symbol.h - Internal symbol structure
2    Copyright (C) 1987, 1992 Free Software Foundation, Inc.
3
4    This file is part of GAS, the GNU Assembler.
5
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.
10
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.
15
16    oYou should have received a copy of the GNU General Public License
17    along with GAS; see the file COPYING.  If not, write to
18    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
19 /*
20  * $FreeBSD: src/gnu/usr.bin/as/struc-symbol.h,v 1.9 1999/08/27 23:34:21 peter Exp $
21  */
22
23
24 #ifndef __struc_symbol_h__
25 #define __struc_symbol_h__
26
27 struct symbol                   /* our version of an nlist node */
28 {
29         obj_symbol_type sy_symbol;      /* what we write in .o file (if permitted) */
30         unsigned long sy_name_offset;   /* 4-origin position of sy_name in symbols */
31         /* part of object file. */
32         /* 0 for (nameless) .stabd symbols. */
33         /* Not used until write_object_file() time. */
34         long    sy_number;      /* 24 bit symbol number. */
35         /* Symbol numbers start at 0 and are */
36         /* unsigned. */
37         struct symbol *sy_next; /* forward chain, or NULL */
38 #ifdef SYMBOLS_NEED_BACKPOINTERS
39         struct symbol *sy_previous;     /* backward chain, or NULL */
40 #endif /* SYMBOLS_NEED_BACKPOINTERS */
41         struct frag *sy_frag;   /* NULL or -> frag this symbol attaches to. */
42         struct symbol *sy_forward;      /* value is really that of this other symbol */
43         /* We will probably want to add a sy_segment here soon. */
44
45 #ifdef PIC
46         /* Force symbol into symbol table, even if local */
47         int     sy_forceout;
48 #endif
49         /* Size of symbol as given by the .size directive */
50         void    *sy_sizexp;     /* (expressionS *) */
51
52         /* Auxiliary type information as given by the .type directive */
53         unsigned char   sy_aux;
54 #define AUX_OBJECT      1
55 #define AUX_FUNC        2
56         unsigned char   sy_bind;
57 #define BIND_LOCAL      0       /* currently not used */
58 #define BIND_GLOBAL     1       /* currently not used */
59 #define BIND_WEAK       2
60 };
61
62 typedef struct symbol symbolS;
63
64 #ifdef PIC
65 symbolS *GOT_symbol;            /* Pre-defined "__GLOBAL_OFFSET_TABLE" */
66 int     got_referenced;
67 #endif
68
69 typedef unsigned valueT;        /* The type of n_value. Helps casting. */
70
71 #ifndef WORKING_DOT_WORD
72 struct broken_word {
73         struct broken_word *next_broken_word;/* One of these strucs per .word x-y */
74         fragS   *frag;          /* Which frag its in */
75         char    *word_goes_here;/* Where in the frag it is */
76         fragS   *dispfrag;      /* where to add the break */
77         symbolS *add;           /* symbol_x */
78         symbolS *sub;           /* - symbol_y */
79         long    addnum;         /* + addnum */
80         int     added;          /* nasty thing happend yet? */
81         /* 1: added and has a long-jump */
82         /* 2: added but uses someone elses long-jump */
83         struct broken_word *use_jump; /* points to broken_word with a similar
84                                          long-jump */
85 };
86 extern struct broken_word *broken_words;
87 #endif /* ndef WORKING_DOT_WORD */
88
89 #define SEGMENT_TO_SYMBOL_TYPE(seg)  (seg_N_TYPE[(int) (seg)])
90 extern const short seg_N_TYPE[]; /* subseg.c */
91
92 #ifdef SYMBOLS_NEED_BACKPOINTERS
93 #if __STDC__ == 1
94
95 void symbol_clear_list_pointers(symbolS *symbolP);
96 void symbol_insert(symbolS *addme, symbolS *target, symbolS **rootP, symbolS **lastP);
97 void symbol_remove(symbolS *symbolP, symbolS **rootP, symbolS **lastP);
98 void verify_symbol_chain(symbolS *rootP, symbolS *lastP);
99
100 #else /* not __STDC__ */
101
102 void symbol_clear_list_pointers();
103 void symbol_insert();
104 void symbol_remove();
105 void verify_symbol_chain();
106
107 #endif /* not __STDC__ */
108
109 #define symbol_previous(s) ((s)->sy_previous)
110
111 #else /* SYMBOLS_NEED_BACKPOINTERS */
112
113 #define symbol_clear_list_pointers(clearme) {clearme->sy_next = NULL;}
114
115 #endif /* SYMBOLS_NEED_BACKPOINTERS */
116
117 #if __STDC__ == 1
118 void symbol_append(symbolS *addme, symbolS *target, symbolS **rootP, symbolS **lastP);
119 #else /* not __STDC__ */
120 void symbol_append();
121 #endif /* not __STDC__ */
122
123 #define symbol_next(s)  ((s)->sy_next)
124
125 #endif /* __struc_symbol_h__ */
126
127 /*
128  * Local Variables:
129  * comment-column: 0
130  * fill-column: 131
131  * End:
132  */
133
134 /* end of struc-symbol.h */