Rev 5191 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5191 | Rev 6324 | ||
---|---|---|---|
1 | /* Oasys object format header file for BFD. |
1 | /* Oasys object format header file for BFD. |
2 | 2 | ||
3 | Copyright 2001, 2010 Free Software Foundation, Inc. |
3 | Copyright (C) 2001-2015 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify |
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 |
6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 3, or (at your option) |
7 | the Free Software Foundation; either version 3, or (at your option) |
8 | any later version. |
8 | any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, |
10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. |
13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License |
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 |
16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 51 Franklin Street - Fifth Floor, |
17 | Foundation, Inc., 51 Franklin Street - Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
18 | Boston, MA 02110-1301, USA. |
19 | 19 | ||
20 | Contributed by Cygnus Support. */ |
20 | Contributed by Cygnus Support. */ |
21 | 21 | ||
22 | #define OASYS_MAX_SEC_COUNT 16 |
22 | #define OASYS_MAX_SEC_COUNT 16 |
23 | /* **** */ |
23 | /* **** */ |
24 | 24 | ||
25 | typedef struct oasys_archive_header |
25 | typedef struct oasys_archive_header |
26 | { |
26 | { |
27 | unsigned int version; |
27 | unsigned int version; |
28 | char create_date[12]; |
28 | char create_date[12]; |
29 | char revision_date[12]; |
29 | char revision_date[12]; |
30 | unsigned int mod_count; |
30 | unsigned int mod_count; |
31 | file_ptr mod_tbl_offset; |
31 | file_ptr mod_tbl_offset; |
32 | unsigned int sym_tbl_size; |
32 | unsigned int sym_tbl_size; |
33 | unsigned int sym_count; |
33 | unsigned int sym_count; |
34 | file_ptr sym_tbl_offset; |
34 | file_ptr sym_tbl_offset; |
35 | unsigned int xref_count; |
35 | unsigned int xref_count; |
36 | file_ptr xref_lst_offset; |
36 | file_ptr xref_lst_offset; |
37 | } |
37 | } |
38 | oasys_archive_header_type; |
38 | oasys_archive_header_type; |
39 | 39 | ||
40 | typedef struct oasys_extarchive_header |
40 | typedef struct oasys_extarchive_header |
41 | { |
41 | { |
42 | bfd_byte version[4]; |
42 | bfd_byte version[4]; |
43 | bfd_byte create_date[12]; |
43 | bfd_byte create_date[12]; |
44 | bfd_byte revision_date[12]; |
44 | bfd_byte revision_date[12]; |
45 | bfd_byte mod_count[4]; |
45 | bfd_byte mod_count[4]; |
46 | bfd_byte mod_tbl_offset[4]; |
46 | bfd_byte mod_tbl_offset[4]; |
47 | bfd_byte sym_tbl_size[4]; |
47 | bfd_byte sym_tbl_size[4]; |
48 | bfd_byte sym_count[4]; |
48 | bfd_byte sym_count[4]; |
49 | bfd_byte sym_tbl_offset[4]; |
49 | bfd_byte sym_tbl_offset[4]; |
50 | bfd_byte xref_count[4]; |
50 | bfd_byte xref_count[4]; |
51 | bfd_byte xref_lst_offset[4]; |
51 | bfd_byte xref_lst_offset[4]; |
52 | } |
52 | } |
53 | oasys_extarchive_header_type; |
53 | oasys_extarchive_header_type; |
54 | 54 | ||
55 | typedef struct oasys_module_table |
55 | typedef struct oasys_module_table |
56 | { |
56 | { |
57 | int mod_number; |
57 | int mod_number; |
58 | char mod_date[12]; |
58 | char mod_date[12]; |
59 | unsigned int mod_size; |
59 | unsigned int mod_size; |
60 | unsigned int dep_count; |
60 | unsigned int dep_count; |
61 | unsigned int depee_count; |
61 | unsigned int depee_count; |
62 | file_ptr file_offset; |
62 | file_ptr file_offset; |
63 | unsigned int sect_count; |
63 | unsigned int sect_count; |
64 | char *module_name; |
64 | char *module_name; |
65 | unsigned int module_name_size; |
65 | unsigned int module_name_size; |
66 | } |
66 | } |
67 | oasys_module_table_type; |
67 | oasys_module_table_type; |
68 | 68 | ||
69 | typedef struct oasys_extmodule_table_a |
69 | typedef struct oasys_extmodule_table_a |
70 | { |
70 | { |
71 | bfd_byte mod_number[4]; |
71 | bfd_byte mod_number[4]; |
72 | bfd_byte mod_date[12]; |
72 | bfd_byte mod_date[12]; |
73 | bfd_byte mod_size[4]; |
73 | bfd_byte mod_size[4]; |
74 | bfd_byte dep_count[4]; |
74 | bfd_byte dep_count[4]; |
75 | bfd_byte depee_count[4]; |
75 | bfd_byte depee_count[4]; |
76 | bfd_byte sect_count[4]; |
76 | bfd_byte sect_count[4]; |
77 | bfd_byte file_offset[4]; |
77 | bfd_byte file_offset[4]; |
78 | bfd_byte mod_name[32]; |
78 | bfd_byte mod_name[32]; |
79 | } |
79 | } |
80 | oasys_extmodule_table_type_a_type; |
80 | oasys_extmodule_table_type_a_type; |
81 | 81 | ||
82 | typedef struct oasys_extmodule_table_b |
82 | typedef struct oasys_extmodule_table_b |
83 | { |
83 | { |
84 | bfd_byte mod_number[4]; |
84 | bfd_byte mod_number[4]; |
85 | bfd_byte mod_date[12]; |
85 | bfd_byte mod_date[12]; |
86 | bfd_byte mod_size[4]; |
86 | bfd_byte mod_size[4]; |
87 | bfd_byte dep_count[4]; |
87 | bfd_byte dep_count[4]; |
88 | bfd_byte depee_count[4]; |
88 | bfd_byte depee_count[4]; |
89 | bfd_byte sect_count[4]; |
89 | bfd_byte sect_count[4]; |
90 | bfd_byte file_offset[4]; |
90 | bfd_byte file_offset[4]; |
91 | bfd_byte mod_name_length[4]; |
91 | bfd_byte mod_name_length[4]; |
92 | } |
92 | } |
93 | oasys_extmodule_table_type_b_type; |
93 | oasys_extmodule_table_type_b_type; |
94 | 94 | ||
95 | typedef enum oasys_record |
95 | typedef enum oasys_record |
96 | { |
96 | { |
97 | oasys_record_is_end_enum = 0, |
97 | oasys_record_is_end_enum = 0, |
98 | oasys_record_is_data_enum = 1, |
98 | oasys_record_is_data_enum = 1, |
99 | oasys_record_is_symbol_enum = 2, |
99 | oasys_record_is_symbol_enum = 2, |
100 | oasys_record_is_header_enum = 3, |
100 | oasys_record_is_header_enum = 3, |
101 | oasys_record_is_named_section_enum = 4, |
101 | oasys_record_is_named_section_enum = 4, |
102 | oasys_record_is_com_enum = 5, |
102 | oasys_record_is_com_enum = 5, |
103 | oasys_record_is_debug_enum = 6, |
103 | oasys_record_is_debug_enum = 6, |
104 | oasys_record_is_section_enum = 7, |
104 | oasys_record_is_section_enum = 7, |
105 | oasys_record_is_debug_file_enum = 8, |
105 | oasys_record_is_debug_file_enum = 8, |
106 | oasys_record_is_module_enum = 9, |
106 | oasys_record_is_module_enum = 9, |
107 | oasys_record_is_local_enum = 10 |
107 | oasys_record_is_local_enum = 10 |
108 | } |
108 | } |
109 | oasys_record_enum_type; |
109 | oasys_record_enum_type; |
110 | 110 | ||
111 | typedef struct oasys_record_header |
111 | typedef struct oasys_record_header |
112 | { |
112 | { |
113 | unsigned char length; |
113 | unsigned char length; |
114 | unsigned char check_sum; |
114 | unsigned char check_sum; |
115 | unsigned char type; |
115 | unsigned char type; |
116 | unsigned char fill; |
116 | unsigned char fill; |
117 | } |
117 | } |
118 | oasys_record_header_type; |
118 | oasys_record_header_type; |
119 | 119 | ||
120 | typedef struct oasys_data_record |
120 | typedef struct oasys_data_record |
121 | { |
121 | { |
122 | oasys_record_header_type header; |
122 | oasys_record_header_type header; |
123 | unsigned char relb; |
123 | unsigned char relb; |
124 | bfd_byte addr[4]; |
124 | bfd_byte addr[4]; |
125 | /* maximum total size of data record is 255 bytes */ |
125 | /* maximum total size of data record is 255 bytes */ |
126 | bfd_byte data[246]; |
126 | bfd_byte data[246]; |
127 | } |
127 | } |
128 | oasys_data_record_type; |
128 | oasys_data_record_type; |
129 | 129 | ||
130 | typedef struct oasys_header_record |
130 | typedef struct oasys_header_record |
131 | { |
131 | { |
132 | oasys_record_header_type header; |
132 | oasys_record_header_type header; |
133 | unsigned char version_number; |
133 | unsigned char version_number; |
134 | unsigned char rev_number; |
134 | unsigned char rev_number; |
135 | char module_name[26-6]; |
135 | char module_name[26-6]; |
136 | char description[64-26]; |
136 | char description[64-26]; |
137 | } |
137 | } |
138 | oasys_header_record_type; |
138 | oasys_header_record_type; |
139 | 139 | ||
140 | #define OASYS_VERSION_NUMBER 0 |
140 | #define OASYS_VERSION_NUMBER 0 |
141 | #define OASYS_REV_NUMBER 0 |
141 | #define OASYS_REV_NUMBER 0 |
142 | 142 | ||
143 | typedef struct oasys_symbol_record |
143 | typedef struct oasys_symbol_record |
144 | { |
144 | { |
145 | oasys_record_header_type header; |
145 | oasys_record_header_type header; |
146 | unsigned char relb; |
146 | unsigned char relb; |
147 | bfd_byte value[4]; |
147 | bfd_byte value[4]; |
148 | bfd_byte refno[2]; |
148 | bfd_byte refno[2]; |
149 | char name[64]; |
149 | char name[64]; |
150 | } |
150 | } |
151 | oasys_symbol_record_type; |
151 | oasys_symbol_record_type; |
152 | 152 | ||
153 | #define RELOCATION_PCREL_BIT 0x80 |
153 | #define RELOCATION_PCREL_BIT 0x80 |
154 | #define RELOCATION_32BIT_BIT 0x40 |
154 | #define RELOCATION_32BIT_BIT 0x40 |
155 | #define RELOCATION_TYPE_BITS 0x30 |
155 | #define RELOCATION_TYPE_BITS 0x30 |
156 | #define RELOCATION_TYPE_ABS 0x00 |
156 | #define RELOCATION_TYPE_ABS 0x00 |
157 | #define RELOCATION_TYPE_REL 0x10 |
157 | #define RELOCATION_TYPE_REL 0x10 |
158 | #define RELOCATION_TYPE_UND 0x20 |
158 | #define RELOCATION_TYPE_UND 0x20 |
159 | #define RELOCATION_TYPE_COM 0x30 |
159 | #define RELOCATION_TYPE_COM 0x30 |
160 | #define RELOCATION_SECT_BITS 0x0f |
160 | #define RELOCATION_SECT_BITS 0x0f |
161 | 161 | ||
162 | typedef struct oasys_section_record |
162 | typedef struct oasys_section_record |
163 | { |
163 | { |
164 | oasys_record_header_type header; |
164 | oasys_record_header_type header; |
165 | unsigned char relb; |
165 | unsigned char relb; |
166 | bfd_byte value[4]; |
166 | bfd_byte value[4]; |
167 | bfd_byte vma[4]; |
167 | bfd_byte vma[4]; |
168 | bfd_byte fill[3]; |
168 | bfd_byte fill[3]; |
169 | } |
169 | } |
170 | oasys_section_record_type; |
170 | oasys_section_record_type; |
171 | 171 | ||
172 | typedef struct oasys_end_record |
172 | typedef struct oasys_end_record |
173 | { |
173 | { |
174 | oasys_record_header_type header; |
174 | oasys_record_header_type header; |
175 | unsigned char relb; |
175 | unsigned char relb; |
176 | bfd_byte entry[4]; |
176 | bfd_byte entry[4]; |
177 | bfd_byte fill[2]; |
177 | bfd_byte fill[2]; |
178 | bfd_byte zero; |
178 | bfd_byte zero; |
179 | } |
179 | } |
180 | oasys_end_record_type; |
180 | oasys_end_record_type; |
181 | 181 | ||
182 | typedef union oasys_record_union |
182 | typedef union oasys_record_union |
183 | { |
183 | { |
184 | oasys_record_header_type header; |
184 | oasys_record_header_type header; |
185 | oasys_data_record_type data; |
185 | oasys_data_record_type data; |
186 | oasys_section_record_type section; |
186 | oasys_section_record_type section; |
187 | oasys_symbol_record_type symbol; |
187 | oasys_symbol_record_type symbol; |
188 | oasys_header_record_type first; |
188 | oasys_header_record_type first; |
189 | oasys_end_record_type end; |
189 | oasys_end_record_type end; |
190 | bfd_byte pad[256]; |
190 | bfd_byte pad[256]; |
191 | } |
191 | } |
192 | oasys_record_union_type; |
192 | oasys_record_union_type; |