Initial import from FreeBSD RELENG_4:
[games.git] / gnu / usr.bin / as / subsegs.h
1 /* subsegs.h -> subsegs.c
2
3    Copyright (C) 1987, 1992 Free Software Foundation, Inc.
4
5    This file is part of GAS, the GNU Assembler.
6
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)
10    any later version.
11
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.
16
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
19    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
20 /*
21  * $FreeBSD: src/gnu/usr.bin/as/subsegs.h,v 1.6 1999/08/27 23:34:22 peter Exp $
22  */
23
24
25 /*
26  * For every sub-segment the user mentions in the ASsembler program,
27  * we make one struct frchain. Each sub-segment has exactly one struct frchain
28  * and vice versa.
29  *
30  * Struct frchain's are forward chained (in ascending order of sub-segment
31  * code number). The chain runs through frch_next of each subsegment.
32  * This makes it hard to find a subsegment's frags
33  * if programmer uses a lot of them. Most programs only use text0 and
34  * data0, so they don't suffer. At least this way:
35  * (1)  There are no "arbitrary" restrictions on how many subsegments
36  *      can be programmed;
37  * (2)  Subsegments' frchain-s are (later) chained together in the order in
38  *      which they are emitted for object file viz text then data.
39  *
40  * From each struct frchain dangles a chain of struct frags. The frags
41  * represent code fragments, for that sub-segment, forward chained.
42  */
43
44 struct frchain                  /* control building of a frag chain */
45 {                               /* FRCH = FRagment CHain control */
46         struct frag *   frch_root;      /* 1st struct frag in chain, or NULL */
47         struct frag *   frch_last;      /* last struct frag in chain, or NULL */
48         struct frchain * frch_next;     /* next in chain of struct frchain-s */
49         segT            frch_seg;       /* SEG_TEXT or SEG_DATA. */
50         subsegT frch_subseg;    /* subsegment number of this chain */
51 };
52
53 typedef struct frchain frchainS;
54
55 extern frchainS * frchain_root; /* NULL means no frchains yet. */
56 /* all subsegments' chains hang off here */
57
58 extern frchainS * frchain_now;
59 /* Frchain we are assembling into now */
60 /* That is, the current segment's frag */
61 /* chain, even if it contains no (complete) */
62 /* frags. */
63
64
65 #ifdef MANY_SEGMENTS
66 typedef struct
67 {
68         frchainS *frchainP;
69         int hadone;
70         int user_stuff;
71         /*  struct frag *frag_root;*/
72         /*  struct frag *last_frag;*/
73         fixS *fix_root;
74         fixS *fix_tail;
75         struct internal_scnhdr scnhdr;
76         symbolS *dot;
77
78         struct lineno_list *lineno_list_head;
79         struct lineno_list *lineno_list_tail;
80
81 } segment_info_type;
82 segment_info_type segment_info[];
83 #else
84 extern frchainS * data0_frchainP;
85 extern frchainS * bss0_frchainP;
86 /* Sentinel for frchain crawling. */
87 /* Points to the 1st data-segment frchain. */
88 /* (Which is pointed to by the last text- */
89 /* segment frchain.) */
90
91 #endif
92
93 /* end of subsegs.h */