1/* sections.h (was subsegs.h in the original GAS) 2 Copyright (C) 1987 Free Software Foundation, Inc. 3 4This file is part of GAS, the GNU Assembler. 5 6GAS is free software; you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation; either version 1, or (at your option) 9any later version. 10 11GAS is distributed in the hope that it will be useful, 12but WITHOUT ANY WARRANTY; without even the implied warranty of 13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14GNU General Public License for more details. 15 16You should have received a copy of the GNU General Public License 17along with GAS; see the file COPYING. If not, write to 18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 20#include <stdint.h> 21#include <mach-o/loader.h> 22#include "struc-symbol.h" 23 24/* 25 * For every section the user mentions in the assembley program, we make one 26 * struct frchain. Each section has exactly one struct frchain and vice versa. 27 * 28 * Struct frchain's are forward chained (in ascending order of section number). 29 * The chain runs through frch_next of each section. 30 * 31 * From each struct frchain dangles a chain of struct frags. The frags 32 * represent code fragments, for that section, forward chained. 33 */ 34 35struct frchain { /* control building of a frag chain */ 36 struct frag *frch_root; /* 1st struct frag in chain, or NULL */ 37 struct frag *frch_last; /* last struct frag in chain, or NULL */ 38 struct frchain *frch_next; /* next in chain of struct frchain-s */ 39 40 section_t frch_section; /* section info, name, type, etc. */ 41 uint32_t frch_nsect; /* section number (1,2,3,...) */ 42 struct fix *frch_fix_root; /* section fixups */ 43 isymbolS *frch_isym_root; /* 1st indirect symbol in chain */ 44 isymbolS *frch_isym_last; /* last indirect symbol in chain */ 45 symbolS *section_symbol; /* section symbol for dwarf if set */ 46 uint32_t has_rs_leb128s; /* section has some rs_leb128 frags */ 47 uint32_t layout_pass; /* pass order for layout_addresses() */ 48}; 49 50typedef struct frchain frchainS; 51 52/* 53 * All sections' chains hang off here. NULL means no frchains yet. 54 */ 55extern frchainS *frchain_root; 56 57/* 58 * The frchain we are assembling into now. That is, the current section's 59 * frag chain, even if it contains no (complete) frags. 60 */ 61extern frchainS *frchain_now; 62 63/* 64 * These are used to inteface to the code in dwarf2dbg.c . The first is the 65 * frch_nsect value from the current frchain or current section. The second 66 * is always zero. 67 */ 68extern int now_seg; 69extern int now_subseg; 70 71/* 72 * The global routines defined in sections.c 73 */ 74extern void sections_begin( 75 void); 76 77extern frchainS *section_new( 78 char *segname, 79 char *sectname, 80 uint32_t type, 81 uint32_t attributes, 82 uint32_t sizeof_stub); 83 84extern void section_set( 85 frchainS *frcP); 86 87extern symbolS *section_symbol( 88 frchainS *frcP); 89 90extern int seg_not_empty_p( 91 frchainS *frcP); 92 93extern struct frchain *get_section_by_nsect( 94 uint32_t nsect); 95 96extern struct frchain *get_section_by_name( 97 char *segname, 98 char *sectname); 99 100extern uint32_t is_section_coalesced( 101 uint32_t n_sect); 102 103extern uint32_t is_section_non_lazy_symbol_pointers( 104 uint32_t n_sect); 105 106extern uint32_t is_section_debug( 107 uint32_t n_sect); 108 109extern uint32_t is_section_cstring_literals( 110 uint32_t n_sect); 111 112extern uint32_t is_end_section_address( 113 uint32_t n_sect, 114 addressT addr); 115 116extern uint32_t section_has_fixed_size_data( 117 uint32_t n_sect); 118