Back to index

cell-binutils  2.17cvs20070401
subsegs.h
Go to the documentation of this file.
00001 /* subsegs.h -> subsegs.c
00002    Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2003, 2005,
00003    2006 Free Software Foundation, Inc.
00004 
00005    This file is part of GAS, the GNU Assembler.
00006 
00007    GAS is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2, or (at your option)
00010    any later version.
00011 
00012    GAS is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with GAS; see the file COPYING.  If not, write to the Free
00019    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00020    02110-1301, USA.  */
00021 
00022 /*
00023  * For every sub-segment the user mentions in the ASsembler program,
00024  * we make one struct frchain. Each sub-segment has exactly one struct frchain
00025  * and vice versa.
00026  *
00027  * Struct frchain's are forward chained (in ascending order of sub-segment
00028  * code number). The chain runs through frch_next of each subsegment.
00029  * This makes it hard to find a subsegment's frags
00030  * if programmer uses a lot of them. Most programs only use text0 and
00031  * data0, so they don't suffer. At least this way:
00032  * (1) There are no "arbitrary" restrictions on how many subsegments
00033  *     can be programmed;
00034  * (2) Subsegments' frchain-s are (later) chained together in the order in
00035  *     which they are emitted for object file viz text then data.
00036  *
00037  * From each struct frchain dangles a chain of struct frags. The frags
00038  * represent code fragments, for that sub-segment, forward chained.
00039  */
00040 
00041 #include "obstack.h"
00042 
00043 struct frch_cfi_data;
00044 
00045 struct frchain                     /* control building of a frag chain */
00046 {                           /* FRCH = FRagment CHain control */
00047   struct frag *frch_root;   /* 1st struct frag in chain, or NULL */
00048   struct frag *frch_last;   /* last struct frag in chain, or NULL */
00049   struct frchain *frch_next;       /* next in chain of struct frchain-s */
00050   subsegT frch_subseg;             /* subsegment number of this chain */
00051   fixS *fix_root;           /* Root of fixups for this subsegment.  */
00052   fixS *fix_tail;           /* Last fixup for this subsegment.  */
00053   struct obstack frch_obstack;     /* for objects in this frag chain */
00054   fragS *frch_frag_now;            /* frag_now for this subsegment */
00055   struct frch_cfi_data *frch_cfi_data;
00056 };
00057 
00058 typedef struct frchain frchainS;
00059 
00060 /* Frchain we are assembling into now.  That is, the current segment's
00061    frag chain, even if it contains no (complete) frags.  */
00062 extern frchainS *frchain_now;
00063 
00064 typedef struct segment_info_struct {
00065   frchainS *frchainP;
00066   unsigned int hadone : 1;
00067 
00068   /* This field is set if this is a .bss section which does not really
00069      have any contents.  Once upon a time a .bss section did not have
00070      any frags, but that is no longer true.  This field prevent the
00071      SEC_HAS_CONTENTS flag from being set for the section even if
00072      there are frags.  */
00073   unsigned int bss : 1;
00074 
00075   int user_stuff;
00076 
00077   /* Fixups for this segment.  This is only valid after the frchains
00078      are run together.  */
00079   fixS *fix_root;
00080   fixS *fix_tail;
00081 
00082   symbolS *dot;
00083 
00084   struct lineno_list *lineno_list_head;
00085   struct lineno_list *lineno_list_tail;
00086 
00087   /* Which BFD section does this gas segment correspond to?  */
00088   asection *bfd_section;
00089 
00090   /* NULL, or pointer to the gas symbol that is the section symbol for
00091      this section.  sym->bsym and bfd_section->symbol should be the same.  */
00092   symbolS *sym;
00093 
00094   union {
00095     /* Current size of section holding stabs strings.  */
00096     unsigned long stab_string_size;
00097     /* Initial frag for ELF.  */
00098     char *p;
00099   }
00100   stabu;
00101 
00102 #ifdef NEED_LITERAL_POOL
00103   unsigned long literal_pool_size;
00104 #endif
00105 
00106 #ifdef TC_SEGMENT_INFO_TYPE
00107   TC_SEGMENT_INFO_TYPE tc_segment_info_data;
00108 #endif
00109 } segment_info_type;
00110 
00111 
00112 #define seg_info(sec) \
00113   ((segment_info_type *) bfd_get_section_userdata (stdoutput, sec))
00114 
00115 extern symbolS *section_symbol (segT);
00116 
00117 extern void subsegs_print_statistics (FILE *);