12159047fSniklas /* Oasys object format header file for BFD. 2*5f210c2aSfgsch 3*5f210c2aSfgsch Copyright 2001 Free Software Foundation, Inc. 4*5f210c2aSfgsch 5*5f210c2aSfgsch This program is free software; you can redistribute it and/or modify 6*5f210c2aSfgsch it under the terms of the GNU General Public License as published by 7*5f210c2aSfgsch the Free Software Foundation; either version 2, or (at your option) 8*5f210c2aSfgsch any later version. 9*5f210c2aSfgsch 10*5f210c2aSfgsch This program is distributed in the hope that it will be useful, 11*5f210c2aSfgsch but WITHOUT ANY WARRANTY; without even the implied warranty of 12*5f210c2aSfgsch MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*5f210c2aSfgsch GNU General Public License for more details. 14*5f210c2aSfgsch 15*5f210c2aSfgsch You should have received a copy of the GNU General Public License 16*5f210c2aSfgsch along with this program; if not, write to the Free Software 17*5f210c2aSfgsch Foundation, Inc., 59 Temple Place - Suite 330, 18*5f210c2aSfgsch Boston, MA 02111-1307, USA. 19*5f210c2aSfgsch 202159047fSniklas Contributed by Cygnus Support. */ 212159047fSniklas 222159047fSniklas #define OASYS_MAX_SEC_COUNT 16 232159047fSniklas /* **** */ 242159047fSniklas 25*5f210c2aSfgsch typedef struct oasys_archive_header 26*5f210c2aSfgsch { 272159047fSniklas unsigned int version; 282159047fSniklas char create_date[12]; 292159047fSniklas char revision_date[12]; 302159047fSniklas unsigned int mod_count; 312159047fSniklas file_ptr mod_tbl_offset; 322159047fSniklas unsigned int sym_tbl_size; 332159047fSniklas unsigned int sym_count; 342159047fSniklas file_ptr sym_tbl_offset; 352159047fSniklas unsigned int xref_count; 362159047fSniklas file_ptr xref_lst_offset; 37*5f210c2aSfgsch } 38*5f210c2aSfgsch oasys_archive_header_type; 392159047fSniklas 40*5f210c2aSfgsch typedef struct oasys_extarchive_header 41*5f210c2aSfgsch { 422159047fSniklas bfd_byte version[4]; 432159047fSniklas bfd_byte create_date[12]; 442159047fSniklas bfd_byte revision_date[12]; 452159047fSniklas bfd_byte mod_count[4]; 462159047fSniklas bfd_byte mod_tbl_offset[4]; 472159047fSniklas bfd_byte sym_tbl_size[4]; 482159047fSniklas bfd_byte sym_count[4]; 492159047fSniklas bfd_byte sym_tbl_offset[4]; 502159047fSniklas bfd_byte xref_count[4]; 512159047fSniklas bfd_byte xref_lst_offset[4]; 52*5f210c2aSfgsch } 53*5f210c2aSfgsch oasys_extarchive_header_type; 542159047fSniklas 55*5f210c2aSfgsch typedef struct oasys_module_table 56*5f210c2aSfgsch { 572159047fSniklas int mod_number; 582159047fSniklas char mod_date[12]; 592159047fSniklas unsigned int mod_size; 602159047fSniklas unsigned int dep_count; 612159047fSniklas unsigned int depee_count; 622159047fSniklas file_ptr file_offset; 632159047fSniklas unsigned int sect_count; 642159047fSniklas char *module_name; 652159047fSniklas unsigned int module_name_size; 66*5f210c2aSfgsch } 67*5f210c2aSfgsch oasys_module_table_type; 682159047fSniklas 69*5f210c2aSfgsch typedef struct oasys_extmodule_table_a 70*5f210c2aSfgsch { 712159047fSniklas bfd_byte mod_number[4]; 722159047fSniklas bfd_byte mod_date[12]; 732159047fSniklas bfd_byte mod_size[4]; 742159047fSniklas bfd_byte dep_count[4]; 752159047fSniklas bfd_byte depee_count[4]; 762159047fSniklas bfd_byte sect_count[4]; 772159047fSniklas bfd_byte file_offset[4]; 782159047fSniklas bfd_byte mod_name[32]; 79*5f210c2aSfgsch } 80*5f210c2aSfgsch oasys_extmodule_table_type_a_type; 812159047fSniklas 82*5f210c2aSfgsch typedef struct oasys_extmodule_table_b 83*5f210c2aSfgsch { 842159047fSniklas bfd_byte mod_number[4]; 852159047fSniklas bfd_byte mod_date[12]; 862159047fSniklas bfd_byte mod_size[4]; 872159047fSniklas bfd_byte dep_count[4]; 882159047fSniklas bfd_byte depee_count[4]; 892159047fSniklas bfd_byte sect_count[4]; 902159047fSniklas bfd_byte file_offset[4]; 912159047fSniklas bfd_byte mod_name_length[4]; 92*5f210c2aSfgsch } 93*5f210c2aSfgsch oasys_extmodule_table_type_b_type; 942159047fSniklas 95*5f210c2aSfgsch typedef enum oasys_record 96*5f210c2aSfgsch { 972159047fSniklas oasys_record_is_end_enum = 0, 982159047fSniklas oasys_record_is_data_enum = 1, 992159047fSniklas oasys_record_is_symbol_enum = 2, 1002159047fSniklas oasys_record_is_header_enum = 3, 1012159047fSniklas oasys_record_is_named_section_enum = 4, 1022159047fSniklas oasys_record_is_com_enum = 5, 1032159047fSniklas oasys_record_is_debug_enum = 6, 1042159047fSniklas oasys_record_is_section_enum = 7, 1052159047fSniklas oasys_record_is_debug_file_enum = 8, 1062159047fSniklas oasys_record_is_module_enum = 9, 1072159047fSniklas oasys_record_is_local_enum = 10 108*5f210c2aSfgsch } 109*5f210c2aSfgsch oasys_record_enum_type; 1102159047fSniklas 111*5f210c2aSfgsch typedef struct oasys_record_header 112*5f210c2aSfgsch { 1132159047fSniklas unsigned char length; 1142159047fSniklas unsigned char check_sum; 1152159047fSniklas unsigned char type; 1162159047fSniklas unsigned char fill; 117*5f210c2aSfgsch } 118*5f210c2aSfgsch oasys_record_header_type; 1192159047fSniklas 120*5f210c2aSfgsch typedef struct oasys_data_record 121*5f210c2aSfgsch { 1222159047fSniklas oasys_record_header_type header; 1232159047fSniklas unsigned char relb; 1242159047fSniklas bfd_byte addr[4]; 1252159047fSniklas /* maximum total size of data record is 255 bytes */ 1262159047fSniklas bfd_byte data[246]; 127*5f210c2aSfgsch } 128*5f210c2aSfgsch oasys_data_record_type; 1292159047fSniklas 130*5f210c2aSfgsch typedef struct oasys_header_record 131*5f210c2aSfgsch { 1322159047fSniklas oasys_record_header_type header; 1332159047fSniklas unsigned char version_number; 1342159047fSniklas unsigned char rev_number; 1352159047fSniklas char module_name[26-6]; 1362159047fSniklas char description[64-26]; 137*5f210c2aSfgsch } 138*5f210c2aSfgsch oasys_header_record_type; 1392159047fSniklas 1402159047fSniklas #define OASYS_VERSION_NUMBER 0 1412159047fSniklas #define OASYS_REV_NUMBER 0 1422159047fSniklas 143*5f210c2aSfgsch typedef struct oasys_symbol_record 144*5f210c2aSfgsch { 1452159047fSniklas oasys_record_header_type header; 1462159047fSniklas unsigned char relb; 1472159047fSniklas bfd_byte value[4]; 1482159047fSniklas bfd_byte refno[2]; 1492159047fSniklas char name[64]; 150*5f210c2aSfgsch } 151*5f210c2aSfgsch oasys_symbol_record_type; 1522159047fSniklas 1532159047fSniklas #define RELOCATION_PCREL_BIT 0x80 1542159047fSniklas #define RELOCATION_32BIT_BIT 0x40 1552159047fSniklas #define RELOCATION_TYPE_BITS 0x30 1562159047fSniklas #define RELOCATION_TYPE_ABS 0x00 1572159047fSniklas #define RELOCATION_TYPE_REL 0x10 1582159047fSniklas #define RELOCATION_TYPE_UND 0x20 1592159047fSniklas #define RELOCATION_TYPE_COM 0x30 1602159047fSniklas #define RELOCATION_SECT_BITS 0x0f 1612159047fSniklas 162*5f210c2aSfgsch typedef struct oasys_section_record 163*5f210c2aSfgsch { 1642159047fSniklas oasys_record_header_type header; 1652159047fSniklas unsigned char relb; 1662159047fSniklas bfd_byte value[4]; 1672159047fSniklas bfd_byte vma[4]; 1682159047fSniklas bfd_byte fill[3]; 169*5f210c2aSfgsch } 170*5f210c2aSfgsch oasys_section_record_type; 1712159047fSniklas 172*5f210c2aSfgsch typedef struct oasys_end_record 173*5f210c2aSfgsch { 1742159047fSniklas oasys_record_header_type header; 1752159047fSniklas unsigned char relb; 1762159047fSniklas bfd_byte entry[4]; 1772159047fSniklas bfd_byte fill[2]; 1782159047fSniklas bfd_byte zero; 179*5f210c2aSfgsch } 180*5f210c2aSfgsch oasys_end_record_type; 1812159047fSniklas 182*5f210c2aSfgsch typedef union oasys_record_union 183*5f210c2aSfgsch { 1842159047fSniklas oasys_record_header_type header; 1852159047fSniklas oasys_data_record_type data; 1862159047fSniklas oasys_section_record_type section; 1872159047fSniklas oasys_symbol_record_type symbol; 1882159047fSniklas oasys_header_record_type first; 1892159047fSniklas oasys_end_record_type end; 1902159047fSniklas bfd_byte pad[256]; 191*5f210c2aSfgsch } 192*5f210c2aSfgsch oasys_record_union_type; 193