Merge from vendor branch GCC:
[dragonfly.git] / contrib / binutils / bfd / libieee.h
1 /* IEEE-695 object file formats:  definitions internal to BFD.
2    Copyright 1990, 1991, 1992, 1994, 1996, 2001
3    Free Software Foundation, Inc.
4    Written by Cygnus Support.  Mostly Steve Chamberlain's fault.
5
6 This file is part of BFD, the Binary File Descriptor library.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
21
22 typedef struct {
23   unsigned int index:24;
24   char letter;
25 } ieee_symbol_index_type;
26
27 typedef struct ct {
28   bfd *this;
29   struct ct *next;
30 } bfd_chain_type;
31
32 typedef struct ieee_symbol
33 {
34   asymbol symbol;
35   struct ieee_symbol *next;
36
37   unsigned int index;
38 } ieee_symbol_type;
39
40
41 typedef struct ieee_reloc {
42   arelent relent;
43   struct ieee_reloc *next;
44   ieee_symbol_index_type symbol;
45
46 } ieee_reloc_type;
47
48 #define ieee_symbol(x) ((ieee_symbol_type *)(x))
49
50 typedef struct ieee_per_section
51 {
52   asection *section;
53   bfd_byte *data;
54   bfd_vma offset;
55   bfd_vma pc;
56   /* For output */
57   file_ptr current_pos;
58   unsigned int current_byte;
59   boolean initialized;
60   ieee_reloc_type **reloc_tail_ptr;
61 } ieee_per_section_type;
62
63 #define ieee_per_section(x) ((ieee_per_section_type *)((x)->used_by_bfd))
64
65 typedef struct {
66   unsigned char *input_p;
67   unsigned char *first_byte;
68   unsigned char *last_byte;
69   bfd *abfd;
70 } common_header_type ;
71
72 typedef struct ieee_data_struct
73 {
74   common_header_type h;
75   boolean read_symbols;
76   boolean read_data;
77   file_ptr output_cursor;
78   /* Map of section indexes to section ptrs */
79   asection **section_table;
80   unsigned int section_table_size;
81   ieee_address_descriptor_type ad;
82   ieee_module_begin_type mb;
83   ieee_w_variable_type w;
84
85   unsigned int section_count;
86
87   unsigned int map_idx;
88   /* List of GLOBAL EXPORT symbols */
89   ieee_symbol_type *external_symbols;
90   /* List of UNDEFINED symbols */
91   ieee_symbol_type *external_reference;
92
93   /* When the symbols have been canonicalized, they are in a
94     * special order, we remember various bases here.. */
95   unsigned int external_symbol_max_index;
96   unsigned int external_symbol_min_index;
97   unsigned int external_symbol_count;
98   int external_symbol_base_offset;
99
100   unsigned int external_reference_max_index;
101   unsigned int external_reference_min_index;
102   unsigned int external_reference_count;
103   int external_reference_base_offset;
104
105
106   boolean symbol_table_full;
107
108
109 boolean done_debug;
110
111
112 bfd_chain_type *chain_head;
113 bfd_chain_type *chain_root;
114
115 } ieee_data_type;
116
117 typedef struct {
118   file_ptr file_offset;
119   bfd *abfd;
120 } ieee_ar_obstack_type;
121
122 typedef struct ieee_ar_data_struct
123 {
124   common_header_type h;
125   ieee_ar_obstack_type *elements;
126
127   unsigned  int element_index ;
128   unsigned int element_count;
129
130 } ieee_ar_data_type;
131
132 #define IEEE_DATA(abfd) ((abfd)->tdata.ieee_data)
133 #define IEEE_AR_DATA(abfd) ((abfd)->tdata.ieee_ar_data)
134
135 #define ptr(abfd) (ieee_data(abfd)->input_p)