This patch fixes a flaw in the SREC parser which could cause a stack overflow
[external/binutils.git] / include / ieee.h
1 /* IEEE Standard 695-1980 "Universal Format for Object Modules" header file
2
3    Copyright (C) 2001-2014 Free Software Foundation, Inc.
4    
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street - Fifth Floor,
18    Boston, MA 02110-1301, USA.
19    
20    Contributed by Cygnus Support.  */
21
22 #define N_W_VARIABLES 8
23 #define Module_Beginning 0xe0
24
25 typedef struct ieee_module
26   {
27     char *processor;
28     char *module_name;
29   }
30 ieee_module_begin_type;
31
32 #define Address_Descriptor 0xec
33 typedef struct ieee_address
34   {
35     bfd_vma number_of_bits_mau;
36     bfd_vma number_of_maus_in_address;
37
38     unsigned char byte_order;
39 #define IEEE_LITTLE 0xcc
40 #define IEEE_BIG 0xcd
41   }
42 ieee_address_descriptor_type;
43
44 typedef union ieee_w_variable
45   {
46     file_ptr offset[N_W_VARIABLES];
47
48     struct
49       {
50         file_ptr extension_record;
51         file_ptr environmental_record;
52         file_ptr section_part;
53         file_ptr external_part;
54         file_ptr debug_information_part;
55         file_ptr data_part;
56         file_ptr trailer_part;
57         file_ptr me_record;
58       }
59     r;
60   }
61 ieee_w_variable_type;
62
63 typedef enum ieee_record
64   { 
65     ieee_number_start_enum = 0x00,
66     ieee_number_end_enum=0x7f,
67     ieee_number_repeat_start_enum = 0x80,
68     ieee_number_repeat_end_enum = 0x88,
69     ieee_number_repeat_4_enum = 0x84,
70     ieee_number_repeat_3_enum = 0x83,
71     ieee_number_repeat_2_enum = 0x82,
72     ieee_number_repeat_1_enum = 0x81,
73     ieee_module_beginning_enum = 0xe0,
74     ieee_module_end_enum = 0xe1,
75     ieee_extension_length_1_enum = 0xde,
76     ieee_extension_length_2_enum = 0xdf,
77     ieee_section_type_enum = 0xe6,
78     ieee_section_alignment_enum = 0xe7,
79     ieee_external_symbol_enum = 0xe8,
80     ieee_comma = 0x90,
81     ieee_external_reference_enum = 0xe9,
82     ieee_set_current_section_enum = 0xe5,
83     ieee_address_descriptor_enum = 0xec,
84     ieee_load_constant_bytes_enum = 0xed,
85     ieee_load_with_relocation_enum = 0xe4,
86
87     ieee_variable_A_enum = 0xc1,
88     ieee_variable_B_enum = 0xc2,
89     ieee_variable_C_enum = 0xc3,
90     ieee_variable_D_enum = 0xc4,
91     ieee_variable_E_enum = 0xc5,
92     ieee_variable_F_enum = 0xc6,
93     ieee_variable_G_enum = 0xc7,
94     ieee_variable_H_enum = 0xc8,
95     ieee_variable_I_enum = 0xc9,
96     ieee_variable_J_enum = 0xca,
97     ieee_variable_K_enum = 0xcb,
98     ieee_variable_L_enum = 0xcc,
99     ieee_variable_M_enum = 0xcd,
100     ieee_variable_N_enum = 0xce,
101     ieee_variable_O_enum = 0xcf,
102     ieee_variable_P_enum = 0xd0,
103     ieee_variable_Q_enum = 0xd1,
104     ieee_variable_R_enum = 0xd2,
105     ieee_variable_S_enum = 0xd3,
106     ieee_variable_T_enum = 0xd4,
107     ieee_variable_U_enum = 0xd5,
108     ieee_variable_V_enum = 0xd6,
109     ieee_variable_W_enum = 0xd7,
110     ieee_variable_X_enum = 0xd8,
111     ieee_variable_Y_enum = 0xd9,
112     ieee_variable_Z_enum = 0xda,
113     ieee_function_plus_enum = 0xa5,
114     ieee_function_minus_enum = 0xa6,
115     ieee_function_signed_open_b_enum = 0xba,
116     ieee_function_signed_close_b_enum = 0xbb,
117
118     ieee_function_unsigned_open_b_enum = 0xbc,
119     ieee_function_unsigned_close_b_enum = 0xbd,
120
121     ieee_function_either_open_b_enum = 0xbe,
122     ieee_function_either_close_b_enum = 0xbf,
123     ieee_record_seperator_enum = 0xdb,
124
125     ieee_e2_first_byte_enum = 0xe2,
126     ieee_section_size_enum = 0xe2d3,
127     ieee_physical_region_size_enum = 0xe2c1,
128     ieee_region_base_address_enum = 0xe2c2,
129     ieee_mau_size_enum = 0xe2c6,
130     ieee_m_value_enum = 0xe2cd,
131     ieee_section_base_address_enum = 0xe2cc,
132     ieee_asn_record_enum = 0xe2ce,
133     ieee_section_offset_enum = 0xe2d2,
134     ieee_value_starting_address_enum = 0xe2c7,
135     ieee_assign_value_to_variable_enum = 0xe2d7,
136     ieee_set_current_pc_enum = 0xe2d0,
137     ieee_value_record_enum = 0xe2c9,
138     ieee_nn_record = 0xf0,
139     ieee_at_record_enum = 0xf1,
140     ieee_ty_record_enum = 0xf2,
141     ieee_attribute_record_enum = 0xf1c9,
142     ieee_atn_record_enum = 0xf1ce,
143     ieee_external_reference_info_record_enum = 0xf1d8,
144     ieee_weak_external_reference_enum= 0xf4,
145     ieee_repeat_data_enum = 0xf7,
146     ieee_bb_record_enum = 0xf8,
147     ieee_be_record_enum = 0xf9
148   }
149 ieee_record_enum_type;
150
151 typedef struct ieee_section
152   {
153     unsigned int section_index;
154     unsigned int section_type;
155     char *       section_name;
156     unsigned int parent_section_index;
157     unsigned int sibling_section_index;
158     unsigned int context_index;
159   }
160 ieee_section_type;
161
162 #define IEEE_REFERENCE_BASE 11
163 #define IEEE_PUBLIC_BASE 32
164 #define IEEE_SECTION_NUMBER_BASE 1
165