*** empty log message ***
[deliverable/binutils-gdb.git] / gas / subsegs.h
CommitLineData
252b5132 1/* subsegs.h -> subsegs.c
c9049d30
AM
2 Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2003, 2005,
3 2006 Free Software Foundation, Inc.
252b5132
RH
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 the Free
4b4da160
NC
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
252b5132
RH
21
22/*
23 * For every sub-segment the user mentions in the ASsembler program,
24 * we make one struct frchain. Each sub-segment has exactly one struct frchain
25 * and vice versa.
26 *
27 * Struct frchain's are forward chained (in ascending order of sub-segment
28 * code number). The chain runs through frch_next of each subsegment.
29 * This makes it hard to find a subsegment's frags
30 * if programmer uses a lot of them. Most programs only use text0 and
31 * data0, so they don't suffer. At least this way:
32 * (1) There are no "arbitrary" restrictions on how many subsegments
33 * can be programmed;
34 * (2) Subsegments' frchain-s are (later) chained together in the order in
35 * which they are emitted for object file viz text then data.
36 *
37 * From each struct frchain dangles a chain of struct frags. The frags
38 * represent code fragments, for that sub-segment, forward chained.
39 */
40
41#include "obstack.h"
42
43struct frchain /* control building of a frag chain */
44{ /* FRCH = FRagment CHain control */
45 struct frag *frch_root; /* 1st struct frag in chain, or NULL */
46 struct frag *frch_last; /* last struct frag in chain, or NULL */
47 struct frchain *frch_next; /* next in chain of struct frchain-s */
252b5132 48 subsegT frch_subseg; /* subsegment number of this chain */
252b5132
RH
49 fixS *fix_root; /* Root of fixups for this subsegment. */
50 fixS *fix_tail; /* Last fixup for this subsegment. */
252b5132
RH
51 struct obstack frch_obstack; /* for objects in this frag chain */
52 fragS *frch_frag_now; /* frag_now for this subsegment */
53};
54
55typedef struct frchain frchainS;
56
252b5132 57/* Frchain we are assembling into now. That is, the current segment's
a01b9fa4 58 frag chain, even if it contains no (complete) frags. */
252b5132
RH
59extern frchainS *frchain_now;
60
ef99799a 61typedef struct segment_info_struct {
252b5132
RH
62 frchainS *frchainP;
63 unsigned int hadone : 1;
64
65 /* This field is set if this is a .bss section which does not really
66 have any contents. Once upon a time a .bss section did not have
67 any frags, but that is no longer true. This field prevent the
68 SEC_HAS_CONTENTS flag from being set for the section even if
69 there are frags. */
70 unsigned int bss : 1;
71
72 int user_stuff;
73
7be1c489
AM
74 /* Fixups for this segment. This is only valid after the frchains
75 are run together. */
252b5132
RH
76 fixS *fix_root;
77 fixS *fix_tail;
78
252b5132
RH
79 symbolS *dot;
80
81 struct lineno_list *lineno_list_head;
82 struct lineno_list *lineno_list_tail;
83
252b5132
RH
84 /* Which BFD section does this gas segment correspond to? */
85 asection *bfd_section;
86
87 /* NULL, or pointer to the gas symbol that is the section symbol for
88 this section. sym->bsym and bfd_section->symbol should be the same. */
89 symbolS *sym;
252b5132 90
ef99799a
KH
91 union {
92 /* Current size of section holding stabs strings. */
93 unsigned long stab_string_size;
94 /* Initial frag for ELF. */
95 char *p;
96 }
252b5132
RH
97 stabu;
98
99#ifdef NEED_LITERAL_POOL
100 unsigned long literal_pool_size;
101#endif
102
103#ifdef TC_SEGMENT_INFO_TYPE
104 TC_SEGMENT_INFO_TYPE tc_segment_info_data;
105#endif
106} segment_info_type;
107
c9049d30
AM
108
109#define seg_info(sec) \
110 ((segment_info_type *) bfd_get_section_userdata (stdoutput, sec))
111
24361518 112extern symbolS *section_symbol (segT);
252b5132 113
24361518 114extern void subsegs_print_statistics (FILE *);
This page took 0.338547 seconds and 4 git commands to generate.