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