xref: /openbsd/gnu/usr.bin/binutils/bfd/libieee.h (revision c074d1c9)
12159047fSniklas /* IEEE-695 object file formats:  definitions internal to BFD.
2*c074d1c9Sdrahn    Copyright 1990, 1991, 1992, 1994, 1996, 2001, 2002
3*c074d1c9Sdrahn    Free Software Foundation, Inc.
42159047fSniklas    Written by Cygnus Support.  Mostly Steve Chamberlain's fault.
52159047fSniklas 
62159047fSniklas This file is part of BFD, the Binary File Descriptor library.
72159047fSniklas 
82159047fSniklas This program is free software; you can redistribute it and/or modify
92159047fSniklas it under the terms of the GNU General Public License as published by
102159047fSniklas the Free Software Foundation; either version 2 of the License, or
112159047fSniklas (at your option) any later version.
122159047fSniklas 
132159047fSniklas This program is distributed in the hope that it will be useful,
142159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of
152159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
162159047fSniklas GNU General Public License for more details.
172159047fSniklas 
182159047fSniklas You should have received a copy of the GNU General Public License
192159047fSniklas along with this program; if not, write to the Free Software
202159047fSniklas Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
212159047fSniklas 
222159047fSniklas typedef struct {
232159047fSniklas   unsigned int index:24;
242159047fSniklas   char letter;
252159047fSniklas } ieee_symbol_index_type;
262159047fSniklas 
272159047fSniklas typedef struct ct {
282159047fSniklas   bfd *this;
292159047fSniklas   struct ct *next;
302159047fSniklas } bfd_chain_type;
312159047fSniklas 
322159047fSniklas typedef struct ieee_symbol
332159047fSniklas {
342159047fSniklas   asymbol symbol;
352159047fSniklas   struct ieee_symbol *next;
362159047fSniklas 
372159047fSniklas   unsigned int index;
382159047fSniklas } ieee_symbol_type;
392159047fSniklas 
402159047fSniklas 
412159047fSniklas typedef struct ieee_reloc {
422159047fSniklas   arelent relent;
432159047fSniklas   struct ieee_reloc *next;
442159047fSniklas   ieee_symbol_index_type symbol;
452159047fSniklas 
462159047fSniklas } ieee_reloc_type;
472159047fSniklas 
482159047fSniklas #define ieee_symbol(x) ((ieee_symbol_type *)(x))
492159047fSniklas 
502159047fSniklas typedef struct ieee_per_section
512159047fSniklas {
522159047fSniklas   asection *section;
532159047fSniklas   bfd_byte *data;
542159047fSniklas   bfd_vma offset;
552159047fSniklas   bfd_vma pc;
562159047fSniklas   /* For output */
572159047fSniklas   file_ptr current_pos;
582159047fSniklas   unsigned int current_byte;
59*c074d1c9Sdrahn   bfd_boolean initialized;
602159047fSniklas   ieee_reloc_type **reloc_tail_ptr;
612159047fSniklas } ieee_per_section_type;
622159047fSniklas 
632159047fSniklas #define ieee_per_section(x) ((ieee_per_section_type *)((x)->used_by_bfd))
642159047fSniklas 
652159047fSniklas typedef struct {
662159047fSniklas   unsigned char *input_p;
672159047fSniklas   unsigned char *first_byte;
68*c074d1c9Sdrahn   unsigned char *last_byte;
692159047fSniklas   bfd *abfd;
702159047fSniklas } common_header_type ;
712159047fSniklas 
722159047fSniklas typedef struct ieee_data_struct
732159047fSniklas {
742159047fSniklas   common_header_type h;
75*c074d1c9Sdrahn   bfd_boolean read_symbols;
76*c074d1c9Sdrahn   bfd_boolean read_data;
772159047fSniklas   file_ptr output_cursor;
782159047fSniklas   /* Map of section indexes to section ptrs */
794361b62eSniklas   asection **section_table;
804361b62eSniklas   unsigned int section_table_size;
812159047fSniklas   ieee_address_descriptor_type ad;
822159047fSniklas   ieee_module_begin_type mb;
832159047fSniklas   ieee_w_variable_type w;
842159047fSniklas 
852159047fSniklas   unsigned int section_count;
862159047fSniklas 
872159047fSniklas   unsigned int map_idx;
882159047fSniklas   /* List of GLOBAL EXPORT symbols */
892159047fSniklas   ieee_symbol_type *external_symbols;
902159047fSniklas   /* List of UNDEFINED symbols */
912159047fSniklas   ieee_symbol_type *external_reference;
922159047fSniklas 
932159047fSniklas   /* When the symbols have been canonicalized, they are in a
942159047fSniklas     * special order, we remember various bases here.. */
952159047fSniklas   unsigned int external_symbol_max_index;
962159047fSniklas   unsigned int external_symbol_min_index;
972159047fSniklas   unsigned int external_symbol_count;
982159047fSniklas   int external_symbol_base_offset;
992159047fSniklas 
1002159047fSniklas   unsigned int external_reference_max_index;
1012159047fSniklas   unsigned int external_reference_min_index;
1022159047fSniklas   unsigned int external_reference_count;
1032159047fSniklas   int external_reference_base_offset;
1042159047fSniklas 
1052159047fSniklas 
106*c074d1c9Sdrahn   bfd_boolean symbol_table_full;
1072159047fSniklas 
1082159047fSniklas 
109*c074d1c9Sdrahn bfd_boolean done_debug;
1102159047fSniklas 
1112159047fSniklas 
1122159047fSniklas bfd_chain_type *chain_head;
1132159047fSniklas bfd_chain_type *chain_root;
1142159047fSniklas 
1152159047fSniklas } ieee_data_type;
1162159047fSniklas 
1172159047fSniklas typedef struct {
1182159047fSniklas   file_ptr file_offset;
1192159047fSniklas   bfd *abfd;
1202159047fSniklas } ieee_ar_obstack_type;
1212159047fSniklas 
1222159047fSniklas typedef struct ieee_ar_data_struct
1232159047fSniklas {
1242159047fSniklas   common_header_type h;
1252159047fSniklas   ieee_ar_obstack_type *elements;
1262159047fSniklas 
1272159047fSniklas   unsigned  int element_index ;
1282159047fSniklas   unsigned int element_count;
1292159047fSniklas 
1302159047fSniklas } ieee_ar_data_type;
1312159047fSniklas 
1322159047fSniklas #define IEEE_DATA(abfd) ((abfd)->tdata.ieee_data)
1332159047fSniklas #define IEEE_AR_DATA(abfd) ((abfd)->tdata.ieee_ar_data)
1342159047fSniklas 
1352159047fSniklas #define ptr(abfd) (ieee_data(abfd)->input_p)
136