1 /* Oasys object format header file for BFD.
3 Copyright (C) 2001-2023 Free Software Foundation, Inc.
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 3, or (at your option)
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.
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.
20 Contributed by Cygnus Support. */
22 #define OASYS_MAX_SEC_COUNT 16
25 typedef struct oasys_archive_header
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
;
38 oasys_archive_header_type
;
40 typedef struct oasys_extarchive_header
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];
53 oasys_extarchive_header_type
;
55 typedef struct oasys_module_table
59 unsigned int mod_size
;
60 unsigned int dep_count
;
61 unsigned int depee_count
;
63 unsigned int sect_count
;
65 unsigned int module_name_size
;
67 oasys_module_table_type
;
69 typedef struct oasys_extmodule_table_a
71 bfd_byte mod_number
[4];
72 bfd_byte mod_date
[12];
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];
80 oasys_extmodule_table_type_a_type
;
82 typedef struct oasys_extmodule_table_b
84 bfd_byte mod_number
[4];
85 bfd_byte mod_date
[12];
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];
93 oasys_extmodule_table_type_b_type
;
95 typedef enum oasys_record
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
109 oasys_record_enum_type
;
111 typedef struct oasys_record_header
113 unsigned char length
;
114 unsigned char check_sum
;
118 oasys_record_header_type
;
120 typedef struct oasys_data_record
122 oasys_record_header_type header
;
125 /* maximum total size of data record is 255 bytes */
128 oasys_data_record_type
;
130 typedef struct oasys_header_record
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];
138 oasys_header_record_type
;
140 #define OASYS_VERSION_NUMBER 0
141 #define OASYS_REV_NUMBER 0
143 typedef struct oasys_symbol_record
145 oasys_record_header_type header
;
151 oasys_symbol_record_type
;
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
162 typedef struct oasys_section_record
164 oasys_record_header_type header
;
170 oasys_section_record_type
;
172 typedef struct oasys_end_record
174 oasys_record_header_type header
;
180 oasys_end_record_type
;
182 typedef union oasys_record_union
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
;
192 oasys_record_union_type
;