struc-symbol.h revision 33965
133965Sjdp/* struct_symbol.h - Internal symbol structure 233965Sjdp Copyright (C) 1987, 1992, 1993, 1994 Free Software Foundation, Inc. 333965Sjdp 433965Sjdp This file is part of GAS, the GNU Assembler. 533965Sjdp 633965Sjdp GAS is free software; you can redistribute it and/or modify 733965Sjdp it under the terms of the GNU General Public License as published by 833965Sjdp the Free Software Foundation; either version 2, or (at your option) 933965Sjdp any later version. 1033965Sjdp 1133965Sjdp GAS is distributed in the hope that it will be useful, 1233965Sjdp but WITHOUT ANY WARRANTY; without even the implied warranty of 1333965Sjdp MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1433965Sjdp GNU General Public License for more details. 1533965Sjdp 1633965Sjdp You should have received a copy of the GNU General Public License 1733965Sjdp along with GAS; see the file COPYING. If not, write to 1833965Sjdp the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 1933965Sjdp 2033965Sjdp#ifndef __struc_symbol_h__ 2133965Sjdp#define __struc_symbol_h__ 2233965Sjdp 2333965Sjdp#ifdef BFD_ASSEMBLER 2433965Sjdp/* The BFD code wants to walk the list in both directions. */ 2533965Sjdp#undef SYMBOLS_NEED_BACKPOINTERS 2633965Sjdp#define SYMBOLS_NEED_BACKPOINTERS 2733965Sjdp#endif 2833965Sjdp 2933965Sjdp/* our version of an nlist node */ 3033965Sjdpstruct symbol 3133965Sjdp{ 3233965Sjdp#ifndef BFD_ASSEMBLER 3333965Sjdp /* The (4-origin) position of sy_name in the symbol table of the object 3433965Sjdp file. This will be 0 for (nameless) .stabd symbols. 3533965Sjdp 3633965Sjdp Not used until write_object_file() time. */ 3733965Sjdp unsigned long sy_name_offset; 3833965Sjdp 3933965Sjdp /* What we write in .o file (if permitted). */ 4033965Sjdp obj_symbol_type sy_symbol; 4133965Sjdp 4233965Sjdp /* The 24 bit symbol number. Symbol numbers start at 0 and are unsigned. */ 4333965Sjdp long sy_number; 4433965Sjdp#else 4533965Sjdp /* BFD symbol */ 4633965Sjdp asymbol *bsym; 4733965Sjdp#endif 4833965Sjdp 4933965Sjdp /* The value of the symbol. */ 5033965Sjdp expressionS sy_value; 5133965Sjdp 5233965Sjdp /* Forwards and (optionally) backwards chain pointers. */ 5333965Sjdp struct symbol *sy_next; 5433965Sjdp#ifdef SYMBOLS_NEED_BACKPOINTERS 5533965Sjdp struct symbol *sy_previous; 5633965Sjdp#endif /* SYMBOLS_NEED_BACKPOINTERS */ 5733965Sjdp 5833965Sjdp /* Pointer to the frag this symbol is attached to, if any. 5933965Sjdp Otherwise, NULL. */ 6033965Sjdp struct frag *sy_frag; 6133965Sjdp 6233965Sjdp unsigned int written : 1; 6333965Sjdp /* Whether symbol value has been completely resolved (used during 6433965Sjdp final pass over symbol table). */ 6533965Sjdp unsigned int sy_resolved : 1; 6633965Sjdp /* Whether the symbol value is currently being resolved (used to 6733965Sjdp detect loops in symbol dependencies). */ 6833965Sjdp unsigned int sy_resolving : 1; 6933965Sjdp /* Whether the symbol value is used in a reloc. This is used to 7033965Sjdp ensure that symbols used in relocs are written out, even if they 7133965Sjdp are local and would otherwise not be. */ 7233965Sjdp unsigned int sy_used_in_reloc : 1; 7333965Sjdp 7433965Sjdp /* Whether the symbol is used as an operand or in an expression. 7533965Sjdp NOTE: Not all the backends keep this information accurate; 7633965Sjdp backends which use this bit are responsible for setting it when 7733965Sjdp a symbol is used in backend routines. */ 7833965Sjdp unsigned int sy_used : 1; 7933965Sjdp 8033965Sjdp /* This is set if the symbol is defined in an MRI common section. 8133965Sjdp We handle such sections as single common symbols, so symbols 8233965Sjdp defined within them must be treated specially by the relocation 8333965Sjdp routines. */ 8433965Sjdp unsigned int sy_mri_common : 1; 8533965Sjdp 8633965Sjdp#ifdef OBJ_SYMFIELD_TYPE 8733965Sjdp OBJ_SYMFIELD_TYPE sy_obj; 8833965Sjdp#endif 8933965Sjdp 9033965Sjdp#ifdef TC_SYMFIELD_TYPE 9133965Sjdp TC_SYMFIELD_TYPE sy_tc; 9233965Sjdp#endif 9333965Sjdp 9433965Sjdp#ifdef TARGET_SYMBOL_FIELDS 9533965Sjdp TARGET_SYMBOL_FIELDS 9633965Sjdp#endif 9733965Sjdp}; 9833965Sjdp 9933965Sjdptypedef struct symbol symbolS; 10033965Sjdp 10133965Sjdp#ifndef WORKING_DOT_WORD 10233965Sjdpstruct broken_word 10333965Sjdp { 10433965Sjdp /* Linked list -- one of these structures per ".word x-y+C" 10533965Sjdp expression. */ 10633965Sjdp struct broken_word *next_broken_word; 10733965Sjdp /* Which frag is this broken word in? */ 10833965Sjdp fragS *frag; 10933965Sjdp /* Where in the frag is it? */ 11033965Sjdp char *word_goes_here; 11133965Sjdp /* Where to add the break. */ 11233965Sjdp fragS *dispfrag; /* where to add the break */ 11333965Sjdp /* Operands of expression. */ 11433965Sjdp symbolS *add; 11533965Sjdp symbolS *sub; 11633965Sjdp offsetT addnum; 11733965Sjdp 11833965Sjdp int added; /* nasty thing happend yet? */ 11933965Sjdp /* 1: added and has a long-jump */ 12033965Sjdp /* 2: added but uses someone elses long-jump */ 12133965Sjdp 12233965Sjdp /* Pointer to broken_word with a similar long-jump. */ 12333965Sjdp struct broken_word *use_jump; 12433965Sjdp }; 12533965Sjdpextern struct broken_word *broken_words; 12633965Sjdp#endif /* ndef WORKING_DOT_WORD */ 12733965Sjdp 12833965Sjdp/* 12933965Sjdp * Current means for getting from symbols to segments and vice verse. 13033965Sjdp * This will change for infinite-segments support (e.g. COFF). 13133965Sjdp */ 13233965Sjdpextern const segT N_TYPE_seg[]; /* subseg.c */ 13333965Sjdp 13433965Sjdp#define SEGMENT_TO_SYMBOL_TYPE(seg) ( seg_N_TYPE [(int) (seg)] ) 13533965Sjdpextern const short seg_N_TYPE[];/* subseg.c */ 13633965Sjdp 13733965Sjdp#define N_REGISTER 30 /* Fake N_TYPE value for SEG_REGISTER */ 13833965Sjdp 13933965Sjdpvoid symbol_clear_list_pointers PARAMS ((symbolS * symbolP)); 14033965Sjdp 14133965Sjdp#ifdef SYMBOLS_NEED_BACKPOINTERS 14233965Sjdp 14333965Sjdpvoid symbol_insert PARAMS ((symbolS * addme, symbolS * target, 14433965Sjdp symbolS ** rootP, symbolS ** lastP)); 14533965Sjdpvoid symbol_remove PARAMS ((symbolS * symbolP, symbolS ** rootP, 14633965Sjdp symbolS ** lastP)); 14733965Sjdp 14833965Sjdp#define symbol_previous(s) ((s)->sy_previous) 14933965Sjdp 15033965Sjdp#endif /* SYMBOLS_NEED_BACKPOINTERS */ 15133965Sjdp 15233965Sjdpvoid verify_symbol_chain PARAMS ((symbolS * rootP, symbolS * lastP)); 15333965Sjdpvoid verify_symbol_chain_2 PARAMS ((symbolS * symP)); 15433965Sjdp 15533965Sjdpvoid symbol_append PARAMS ((symbolS * addme, symbolS * target, 15633965Sjdp symbolS ** rootP, symbolS ** lastP)); 15733965Sjdp 15833965Sjdp#define symbol_next(s) ((s)->sy_next) 15933965Sjdp 16033965Sjdp#endif /* __struc_symbol_h__ */ 16133965Sjdp 16233965Sjdp/* end of struc-symbol.h */ 163