1 /* subsegs.h -> subsegs.c 2 Copyright (C) 1987 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 1, 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 You 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 /* 21 * For every sub-segment the user mentions in the ASsembler program, 22 * we make one struct frchain. Each sub-segment has exactly one struct frchain 23 * and vice versa. 24 * 25 * Struct frchain's are forward chained (in ascending order of sub-segment 26 * code number). The chain runs through frch_next of each subsegment. 27 * This makes it hard to find a subsegment's frags 28 * if programmer uses a lot of them. Most programs only use text0 and 29 * data0, so they don't suffer. At least this way: 30 * (1) There are no "arbitrary" restrictions on how many subsegments 31 * can be programmed; 32 * (2) Subsegments' frchain-s are (later) chained together in the order in 33 * which they are emitted for object file viz text then data. 34 * 35 * From each struct frchain dangles a chain of struct frags. The frags 36 * represent code fragments, for that sub-segment, forward chained. 37 */ 38 39 struct frchain /* control building of a frag chain */ 40 { /* FRCH = FRagment CHain control */ 41 struct frag * frch_root; /* 1st struct frag in chain, or NULL */ 42 struct frag * frch_last; /* last struct frag in chain, or NULL */ 43 struct frchain * frch_next; /* next in chain of struct frchain-s */ 44 segT frch_seg; /* SEG_TEXT or SEG_DATA. */ 45 subsegT frch_subseg; /* subsegment number of this chain */ 46 }; 47 48 typedef struct frchain frchainS; 49 50 extern frchainS * frchain_root; /* NULL means no frchains yet. */ 51 /* all subsegments' chains hang off here */ 52 53 extern frchainS * frchain_now; 54 /* Frchain we are assembling into now */ 55 /* That is, the current segment's frag */ 56 /* chain, even if it contains no (complete) */ 57 /* frags. */ 58 59 extern frchainS * data0_frchainP; 60 /* Sentinel for frchain crawling. */ 61 /* Points to the 1st data-segment frchain. */ 62 /* (Which is pointed to by the last text- */ 63 /* segment frchain.) */ 64 65 /* end: subsegs.h */ 66