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