198b9484cSchristos /* Oasys object format header file for BFD. 298b9484cSchristos 3*e663ba6eSchristos Copyright (C) 2001-2024 Free Software Foundation, Inc. 498b9484cSchristos 598b9484cSchristos This program is free software; you can redistribute it and/or modify 698b9484cSchristos it under the terms of the GNU General Public License as published by 798b9484cSchristos the Free Software Foundation; either version 3, or (at your option) 898b9484cSchristos any later version. 998b9484cSchristos 1098b9484cSchristos This program is distributed in the hope that it will be useful, 1198b9484cSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1298b9484cSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1398b9484cSchristos GNU General Public License for more details. 1498b9484cSchristos 1598b9484cSchristos You should have received a copy of the GNU General Public License 1698b9484cSchristos along with this program; if not, write to the Free Software 1798b9484cSchristos Foundation, Inc., 51 Franklin Street - Fifth Floor, 1898b9484cSchristos Boston, MA 02110-1301, USA. 1998b9484cSchristos 2098b9484cSchristos Contributed by Cygnus Support. */ 2198b9484cSchristos 2298b9484cSchristos #define OASYS_MAX_SEC_COUNT 16 2398b9484cSchristos /* **** */ 2498b9484cSchristos 2598b9484cSchristos typedef struct oasys_archive_header 2698b9484cSchristos { 2798b9484cSchristos unsigned int version; 2898b9484cSchristos char create_date[12]; 2998b9484cSchristos char revision_date[12]; 3098b9484cSchristos unsigned int mod_count; 3198b9484cSchristos file_ptr mod_tbl_offset; 3298b9484cSchristos unsigned int sym_tbl_size; 3398b9484cSchristos unsigned int sym_count; 3498b9484cSchristos file_ptr sym_tbl_offset; 3598b9484cSchristos unsigned int xref_count; 3698b9484cSchristos file_ptr xref_lst_offset; 3798b9484cSchristos } 3898b9484cSchristos oasys_archive_header_type; 3998b9484cSchristos 4098b9484cSchristos typedef struct oasys_extarchive_header 4198b9484cSchristos { 4298b9484cSchristos bfd_byte version[4]; 4398b9484cSchristos bfd_byte create_date[12]; 4498b9484cSchristos bfd_byte revision_date[12]; 4598b9484cSchristos bfd_byte mod_count[4]; 4698b9484cSchristos bfd_byte mod_tbl_offset[4]; 4798b9484cSchristos bfd_byte sym_tbl_size[4]; 4898b9484cSchristos bfd_byte sym_count[4]; 4998b9484cSchristos bfd_byte sym_tbl_offset[4]; 5098b9484cSchristos bfd_byte xref_count[4]; 5198b9484cSchristos bfd_byte xref_lst_offset[4]; 5298b9484cSchristos } 5398b9484cSchristos oasys_extarchive_header_type; 5498b9484cSchristos 5598b9484cSchristos typedef struct oasys_module_table 5698b9484cSchristos { 5798b9484cSchristos int mod_number; 5898b9484cSchristos char mod_date[12]; 5998b9484cSchristos unsigned int mod_size; 6098b9484cSchristos unsigned int dep_count; 6198b9484cSchristos unsigned int depee_count; 6298b9484cSchristos file_ptr file_offset; 6398b9484cSchristos unsigned int sect_count; 6498b9484cSchristos char *module_name; 6598b9484cSchristos unsigned int module_name_size; 6698b9484cSchristos } 6798b9484cSchristos oasys_module_table_type; 6898b9484cSchristos 6998b9484cSchristos typedef struct oasys_extmodule_table_a 7098b9484cSchristos { 7198b9484cSchristos bfd_byte mod_number[4]; 7298b9484cSchristos bfd_byte mod_date[12]; 7398b9484cSchristos bfd_byte mod_size[4]; 7498b9484cSchristos bfd_byte dep_count[4]; 7598b9484cSchristos bfd_byte depee_count[4]; 7698b9484cSchristos bfd_byte sect_count[4]; 7798b9484cSchristos bfd_byte file_offset[4]; 7898b9484cSchristos bfd_byte mod_name[32]; 7998b9484cSchristos } 8098b9484cSchristos oasys_extmodule_table_type_a_type; 8198b9484cSchristos 8298b9484cSchristos typedef struct oasys_extmodule_table_b 8398b9484cSchristos { 8498b9484cSchristos bfd_byte mod_number[4]; 8598b9484cSchristos bfd_byte mod_date[12]; 8698b9484cSchristos bfd_byte mod_size[4]; 8798b9484cSchristos bfd_byte dep_count[4]; 8898b9484cSchristos bfd_byte depee_count[4]; 8998b9484cSchristos bfd_byte sect_count[4]; 9098b9484cSchristos bfd_byte file_offset[4]; 9198b9484cSchristos bfd_byte mod_name_length[4]; 9298b9484cSchristos } 9398b9484cSchristos oasys_extmodule_table_type_b_type; 9498b9484cSchristos 9598b9484cSchristos typedef enum oasys_record 9698b9484cSchristos { 9798b9484cSchristos oasys_record_is_end_enum = 0, 9898b9484cSchristos oasys_record_is_data_enum = 1, 9998b9484cSchristos oasys_record_is_symbol_enum = 2, 10098b9484cSchristos oasys_record_is_header_enum = 3, 10198b9484cSchristos oasys_record_is_named_section_enum = 4, 10298b9484cSchristos oasys_record_is_com_enum = 5, 10398b9484cSchristos oasys_record_is_debug_enum = 6, 10498b9484cSchristos oasys_record_is_section_enum = 7, 10598b9484cSchristos oasys_record_is_debug_file_enum = 8, 10698b9484cSchristos oasys_record_is_module_enum = 9, 10798b9484cSchristos oasys_record_is_local_enum = 10 10898b9484cSchristos } 10998b9484cSchristos oasys_record_enum_type; 11098b9484cSchristos 11198b9484cSchristos typedef struct oasys_record_header 11298b9484cSchristos { 11398b9484cSchristos unsigned char length; 11498b9484cSchristos unsigned char check_sum; 11598b9484cSchristos unsigned char type; 11698b9484cSchristos unsigned char fill; 11798b9484cSchristos } 11898b9484cSchristos oasys_record_header_type; 11998b9484cSchristos 12098b9484cSchristos typedef struct oasys_data_record 12198b9484cSchristos { 12298b9484cSchristos oasys_record_header_type header; 12398b9484cSchristos unsigned char relb; 12498b9484cSchristos bfd_byte addr[4]; 12598b9484cSchristos /* maximum total size of data record is 255 bytes */ 12698b9484cSchristos bfd_byte data[246]; 12798b9484cSchristos } 12898b9484cSchristos oasys_data_record_type; 12998b9484cSchristos 13098b9484cSchristos typedef struct oasys_header_record 13198b9484cSchristos { 13298b9484cSchristos oasys_record_header_type header; 13398b9484cSchristos unsigned char version_number; 13498b9484cSchristos unsigned char rev_number; 13598b9484cSchristos char module_name[26-6]; 13698b9484cSchristos char description[64-26]; 13798b9484cSchristos } 13898b9484cSchristos oasys_header_record_type; 13998b9484cSchristos 14098b9484cSchristos #define OASYS_VERSION_NUMBER 0 14198b9484cSchristos #define OASYS_REV_NUMBER 0 14298b9484cSchristos 14398b9484cSchristos typedef struct oasys_symbol_record 14498b9484cSchristos { 14598b9484cSchristos oasys_record_header_type header; 14698b9484cSchristos unsigned char relb; 14798b9484cSchristos bfd_byte value[4]; 14898b9484cSchristos bfd_byte refno[2]; 14998b9484cSchristos char name[64]; 15098b9484cSchristos } 15198b9484cSchristos oasys_symbol_record_type; 15298b9484cSchristos 15398b9484cSchristos #define RELOCATION_PCREL_BIT 0x80 15498b9484cSchristos #define RELOCATION_32BIT_BIT 0x40 15598b9484cSchristos #define RELOCATION_TYPE_BITS 0x30 15698b9484cSchristos #define RELOCATION_TYPE_ABS 0x00 15798b9484cSchristos #define RELOCATION_TYPE_REL 0x10 15898b9484cSchristos #define RELOCATION_TYPE_UND 0x20 15998b9484cSchristos #define RELOCATION_TYPE_COM 0x30 16098b9484cSchristos #define RELOCATION_SECT_BITS 0x0f 16198b9484cSchristos 16298b9484cSchristos typedef struct oasys_section_record 16398b9484cSchristos { 16498b9484cSchristos oasys_record_header_type header; 16598b9484cSchristos unsigned char relb; 16698b9484cSchristos bfd_byte value[4]; 16798b9484cSchristos bfd_byte vma[4]; 16898b9484cSchristos bfd_byte fill[3]; 16998b9484cSchristos } 17098b9484cSchristos oasys_section_record_type; 17198b9484cSchristos 17298b9484cSchristos typedef struct oasys_end_record 17398b9484cSchristos { 17498b9484cSchristos oasys_record_header_type header; 17598b9484cSchristos unsigned char relb; 17698b9484cSchristos bfd_byte entry[4]; 17798b9484cSchristos bfd_byte fill[2]; 17898b9484cSchristos bfd_byte zero; 17998b9484cSchristos } 18098b9484cSchristos oasys_end_record_type; 18198b9484cSchristos 18298b9484cSchristos typedef union oasys_record_union 18398b9484cSchristos { 18498b9484cSchristos oasys_record_header_type header; 18598b9484cSchristos oasys_data_record_type data; 18698b9484cSchristos oasys_section_record_type section; 18798b9484cSchristos oasys_symbol_record_type symbol; 18898b9484cSchristos oasys_header_record_type first; 18998b9484cSchristos oasys_end_record_type end; 19098b9484cSchristos bfd_byte pad[256]; 19198b9484cSchristos } 19298b9484cSchristos oasys_record_union_type; 193