Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* Oasys object format header file for BFD. |
4f1d9bd8 | 2 | |
82704155 | 3 | Copyright (C) 2001-2019 Free Software Foundation, Inc. |
e4e42b45 | 4 | |
4f1d9bd8 NC |
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 | |
e4e42b45 | 7 | the Free Software Foundation; either version 3, or (at your option) |
4f1d9bd8 NC |
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 | |
e172dbf8 NC |
17 | Foundation, Inc., 51 Franklin Street - Fifth Floor, |
18 | Boston, MA 02110-1301, USA. | |
e4e42b45 | 19 | |
252b5132 RH |
20 | Contributed by Cygnus Support. */ |
21 | ||
22 | #define OASYS_MAX_SEC_COUNT 16 | |
23 | /* **** */ | |
24 | ||
4f1d9bd8 NC |
25 | typedef struct oasys_archive_header |
26 | { | |
27 | unsigned int version; | |
28 | char create_date[12]; | |
29 | char revision_date[12]; | |
30 | unsigned int mod_count; | |
31 | file_ptr mod_tbl_offset; | |
32 | unsigned int sym_tbl_size; | |
33 | unsigned int sym_count; | |
34 | file_ptr sym_tbl_offset; | |
35 | unsigned int xref_count; | |
36 | file_ptr xref_lst_offset; | |
37 | } | |
38 | oasys_archive_header_type; | |
39 | ||
40 | typedef struct oasys_extarchive_header | |
41 | { | |
42 | bfd_byte version[4]; | |
43 | bfd_byte create_date[12]; | |
44 | bfd_byte revision_date[12]; | |
45 | bfd_byte mod_count[4]; | |
46 | bfd_byte mod_tbl_offset[4]; | |
47 | bfd_byte sym_tbl_size[4]; | |
48 | bfd_byte sym_count[4]; | |
49 | bfd_byte sym_tbl_offset[4]; | |
50 | bfd_byte xref_count[4]; | |
51 | bfd_byte xref_lst_offset[4]; | |
52 | } | |
53 | oasys_extarchive_header_type; | |
54 | ||
55 | typedef struct oasys_module_table | |
56 | { | |
57 | int mod_number; | |
58 | char mod_date[12]; | |
59 | unsigned int mod_size; | |
60 | unsigned int dep_count; | |
61 | unsigned int depee_count; | |
62 | file_ptr file_offset; | |
63 | unsigned int sect_count; | |
64 | char *module_name; | |
65 | unsigned int module_name_size; | |
66 | } | |
67 | oasys_module_table_type; | |
68 | ||
69 | typedef struct oasys_extmodule_table_a | |
70 | { | |
71 | bfd_byte mod_number[4]; | |
72 | bfd_byte mod_date[12]; | |
73 | bfd_byte mod_size[4]; | |
74 | bfd_byte dep_count[4]; | |
75 | bfd_byte depee_count[4]; | |
76 | bfd_byte sect_count[4]; | |
77 | bfd_byte file_offset[4]; | |
78 | bfd_byte mod_name[32]; | |
79 | } | |
80 | oasys_extmodule_table_type_a_type; | |
81 | ||
82 | typedef struct oasys_extmodule_table_b | |
83 | { | |
84 | bfd_byte mod_number[4]; | |
85 | bfd_byte mod_date[12]; | |
86 | bfd_byte mod_size[4]; | |
87 | bfd_byte dep_count[4]; | |
88 | bfd_byte depee_count[4]; | |
89 | bfd_byte sect_count[4]; | |
90 | bfd_byte file_offset[4]; | |
91 | bfd_byte mod_name_length[4]; | |
92 | } | |
93 | oasys_extmodule_table_type_b_type; | |
94 | ||
95 | typedef enum oasys_record | |
96 | { | |
97 | oasys_record_is_end_enum = 0, | |
98 | oasys_record_is_data_enum = 1, | |
99 | oasys_record_is_symbol_enum = 2, | |
100 | oasys_record_is_header_enum = 3, | |
101 | oasys_record_is_named_section_enum = 4, | |
102 | oasys_record_is_com_enum = 5, | |
103 | oasys_record_is_debug_enum = 6, | |
104 | oasys_record_is_section_enum = 7, | |
105 | oasys_record_is_debug_file_enum = 8, | |
106 | oasys_record_is_module_enum = 9, | |
107 | oasys_record_is_local_enum = 10 | |
108 | } | |
109 | oasys_record_enum_type; | |
110 | ||
111 | typedef struct oasys_record_header | |
112 | { | |
113 | unsigned char length; | |
114 | unsigned char check_sum; | |
115 | unsigned char type; | |
116 | unsigned char fill; | |
117 | } | |
118 | oasys_record_header_type; | |
119 | ||
120 | typedef struct oasys_data_record | |
121 | { | |
122 | oasys_record_header_type header; | |
123 | unsigned char relb; | |
124 | bfd_byte addr[4]; | |
125 | /* maximum total size of data record is 255 bytes */ | |
126 | bfd_byte data[246]; | |
127 | } | |
128 | oasys_data_record_type; | |
129 | ||
130 | typedef struct oasys_header_record | |
131 | { | |
132 | oasys_record_header_type header; | |
133 | unsigned char version_number; | |
134 | unsigned char rev_number; | |
135 | char module_name[26-6]; | |
136 | char description[64-26]; | |
137 | } | |
138 | oasys_header_record_type; | |
252b5132 RH |
139 | |
140 | #define OASYS_VERSION_NUMBER 0 | |
141 | #define OASYS_REV_NUMBER 0 | |
142 | ||
4f1d9bd8 NC |
143 | typedef struct oasys_symbol_record |
144 | { | |
145 | oasys_record_header_type header; | |
146 | unsigned char relb; | |
147 | bfd_byte value[4]; | |
148 | bfd_byte refno[2]; | |
149 | char name[64]; | |
150 | } | |
151 | oasys_symbol_record_type; | |
252b5132 RH |
152 | |
153 | #define RELOCATION_PCREL_BIT 0x80 | |
154 | #define RELOCATION_32BIT_BIT 0x40 | |
155 | #define RELOCATION_TYPE_BITS 0x30 | |
156 | #define RELOCATION_TYPE_ABS 0x00 | |
157 | #define RELOCATION_TYPE_REL 0x10 | |
158 | #define RELOCATION_TYPE_UND 0x20 | |
159 | #define RELOCATION_TYPE_COM 0x30 | |
160 | #define RELOCATION_SECT_BITS 0x0f | |
161 | ||
4f1d9bd8 NC |
162 | typedef struct oasys_section_record |
163 | { | |
164 | oasys_record_header_type header; | |
165 | unsigned char relb; | |
166 | bfd_byte value[4]; | |
167 | bfd_byte vma[4]; | |
168 | bfd_byte fill[3]; | |
169 | } | |
170 | oasys_section_record_type; | |
171 | ||
172 | typedef struct oasys_end_record | |
173 | { | |
174 | oasys_record_header_type header; | |
175 | unsigned char relb; | |
176 | bfd_byte entry[4]; | |
177 | bfd_byte fill[2]; | |
178 | bfd_byte zero; | |
179 | } | |
180 | oasys_end_record_type; | |
181 | ||
182 | typedef union oasys_record_union | |
183 | { | |
184 | oasys_record_header_type header; | |
185 | oasys_data_record_type data; | |
186 | oasys_section_record_type section; | |
187 | oasys_symbol_record_type symbol; | |
188 | oasys_header_record_type first; | |
189 | oasys_end_record_type end; | |
190 | bfd_byte pad[256]; | |
191 | } | |
192 | oasys_record_union_type; |