diff options
Diffstat (limited to 'contrib/binutils/gas/frags.h')
-rw-r--r-- | contrib/binutils/gas/frags.h | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/contrib/binutils/gas/frags.h b/contrib/binutils/gas/frags.h index 53877a9..fa834ee 100644 --- a/contrib/binutils/gas/frags.h +++ b/contrib/binutils/gas/frags.h @@ -1,5 +1,6 @@ /* frags.h - Header file for the frag concept. - Copyright (C) 1987, 92, 93, 94, 95, 1997 Free Software Foundation, Inc. + Copyright (C) 1987, 92, 93, 94, 95, 97, 1998 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -18,10 +19,90 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef FRAGS_H +#define FRAGS_H + #ifdef ANSI_PROTOTYPES struct obstack; #endif +/* + * A code fragment (frag) is some known number of chars, followed by some + * unknown number of chars. Typically the unknown number of chars is an + * instruction address whose size is yet unknown. We always know the greatest + * possible size the unknown number of chars may become, and reserve that + * much room at the end of the frag. + * Once created, frags do not change address during assembly. + * We chain the frags in (a) forward-linked list(s). The object-file address + * of the 1st char of a frag is generally not known until after relax(). + * Many things at assembly time describe an address by {object-file-address + * of a particular frag}+offset. + + BUG: it may be smarter to have a single pointer off to various different + notes for different frag kinds. See how code pans + */ + +struct frag +{ + /* Object file address. */ + addressT fr_address; + /* Chain forward; ascending address order. Rooted in frch_root. */ + struct frag *fr_next; + + /* (Fixed) number of chars we know we have. May be 0. */ + offsetT fr_fix; + /* (Variable) number of chars after above. May be 0. */ + offsetT fr_var; + /* For variable-length tail. */ + struct symbol *fr_symbol; + /* For variable-length tail. */ + offsetT fr_offset; + /* Points to opcode low addr byte, for relaxation. */ + char *fr_opcode; + +#ifndef NO_LISTING + struct list_info_struct *line; +#endif + + /* What state is my tail in? */ + relax_stateT fr_type; + relax_substateT fr_subtype; + +#ifdef USING_CGEN + /* Don't include this unless using CGEN to keep frag size down. */ + struct { + const struct cgen_insn *insn; + unsigned char opindex, opinfo; + } fr_cgen; +#endif + +#ifdef TC_FRAG_TYPE + TC_FRAG_TYPE tc_frag_data; +#endif + + /* Where the frag was created, or where it became a variant frag. */ + char *fr_file; + unsigned int fr_line; + + /* Data begins here. */ + char fr_literal[1]; +}; + +#define SIZEOF_STRUCT_FRAG \ +((char *)zero_address_frag.fr_literal-(char *)&zero_address_frag) +/* We want to say fr_literal[0] above. */ + +/* Current frag we are building. This frag is incomplete. It is, + however, included in frchain_now. The fr_fix field is bogus; + instead, use frag_now_fix (). */ +COMMON fragS *frag_now; +extern addressT frag_now_fix PARAMS ((void)); + +/* For foreign-segment symbol fixups. */ +COMMON fragS zero_address_frag; +/* For local common (N_BSS segment) fixups. */ +COMMON fragS bss_address_frag; + #if 0 /* * A macro to speed up appending exactly 1 char @@ -70,4 +151,4 @@ char *frag_var PARAMS ((relax_stateT type, offsetT offset, char *opcode)); -/* end of frags.h */ +#endif /* FRAGS_H */ |