198b9484cSchristos /* SOM internal definitions for BFD. 2*aab831ceSchristos Copyright (C) 2010-2024 Free Software Foundation, Inc. 398b9484cSchristos Contributed by Tristan Gingold <gingold@adacore.com>, AdaCore. 498b9484cSchristos 598b9484cSchristos This file is part of BFD, the Binary File Descriptor library. 698b9484cSchristos 798b9484cSchristos This program is free software; you can redistribute it and/or modify 898b9484cSchristos it under the terms of the GNU General Public License as published by 998b9484cSchristos the Free Software Foundation; either version 3 of the License, or 1098b9484cSchristos (at your option) any later version. 1198b9484cSchristos 1298b9484cSchristos This program is distributed in the hope that it will be useful, 1398b9484cSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1498b9484cSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1598b9484cSchristos GNU General Public License for more details. 1698b9484cSchristos 1798b9484cSchristos You should have received a copy of the GNU General Public License 1898b9484cSchristos along with this program; if not, write to the Free Software Foundation, 1998b9484cSchristos Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2098b9484cSchristos 2198b9484cSchristos #ifndef _SOM_INTERNAL_H 2298b9484cSchristos #define _SOM_INTERNAL_H 2398b9484cSchristos 2498b9484cSchristos struct som_clock 2598b9484cSchristos { 2698b9484cSchristos unsigned int secs; 2798b9484cSchristos unsigned int nanosecs; 2898b9484cSchristos }; 2998b9484cSchristos 3098b9484cSchristos struct som_header 3198b9484cSchristos { 3298b9484cSchristos unsigned short system_id; 3398b9484cSchristos unsigned short a_magic; 3498b9484cSchristos unsigned int version_id; 3598b9484cSchristos struct som_clock file_time; 3698b9484cSchristos unsigned int entry_space; 3798b9484cSchristos unsigned int entry_subspace; 3898b9484cSchristos unsigned int entry_offset; 3998b9484cSchristos unsigned int aux_header_location; 4098b9484cSchristos unsigned int aux_header_size; 4198b9484cSchristos unsigned int som_length; 4298b9484cSchristos unsigned int presumed_dp; 4398b9484cSchristos unsigned int space_location; 4498b9484cSchristos unsigned int space_total; 4598b9484cSchristos unsigned int subspace_location; 4698b9484cSchristos unsigned int subspace_total; 4798b9484cSchristos unsigned int loader_fixup_location; 4898b9484cSchristos unsigned int loader_fixup_total; 4998b9484cSchristos unsigned int space_strings_location; 5098b9484cSchristos unsigned int space_strings_size; 5198b9484cSchristos unsigned int init_array_location; 5298b9484cSchristos unsigned int init_array_total; 5398b9484cSchristos unsigned int compiler_location; 5498b9484cSchristos unsigned int compiler_total; 5598b9484cSchristos unsigned int symbol_location; 5698b9484cSchristos unsigned int symbol_total; 5798b9484cSchristos unsigned int fixup_request_location; 5898b9484cSchristos unsigned int fixup_request_total; 5998b9484cSchristos unsigned int symbol_strings_location; 6098b9484cSchristos unsigned int symbol_strings_size; 6198b9484cSchristos unsigned int unloadable_sp_location; 6298b9484cSchristos unsigned int unloadable_sp_size; 6398b9484cSchristos unsigned int checksum; 6498b9484cSchristos }; 6598b9484cSchristos 6698b9484cSchristos struct som_aux_id 6798b9484cSchristos { 6898b9484cSchristos unsigned int mandatory : 1; 6998b9484cSchristos unsigned int copy : 1; 7098b9484cSchristos unsigned int append : 1; 7198b9484cSchristos unsigned int ignore : 1; 7298b9484cSchristos unsigned int reserved : 12; 7398b9484cSchristos 7498b9484cSchristos /* Header type. */ 7598b9484cSchristos unsigned int type : 16; 7698b9484cSchristos 7798b9484cSchristos /* Length of the header in bytes, without the two word identifier. */ 7898b9484cSchristos unsigned int length; 7998b9484cSchristos }; 8098b9484cSchristos 8198b9484cSchristos /* Generic auxiliary string header. */ 8298b9484cSchristos struct som_string_auxhdr 8398b9484cSchristos { 8498b9484cSchristos struct som_aux_id header_id; 8598b9484cSchristos 8698b9484cSchristos /* Length of the string, without the NUL. */ 8798b9484cSchristos unsigned int string_length; 8898b9484cSchristos 8998b9484cSchristos /* The string. */ 9098b9484cSchristos char string[1]; 9198b9484cSchristos }; 9298b9484cSchristos 9398b9484cSchristos struct som_name_pt 9498b9484cSchristos { 9598b9484cSchristos char *name; 9698b9484cSchristos unsigned int strx; 9798b9484cSchristos }; 9898b9484cSchristos 9998b9484cSchristos struct som_compilation_unit 10098b9484cSchristos { 10198b9484cSchristos /* Source file that produced the SOM. */ 10298b9484cSchristos struct som_name_pt name; 10398b9484cSchristos 10498b9484cSchristos /* Name of the language used when creating this SOM. */ 10598b9484cSchristos struct som_name_pt language_name; 10698b9484cSchristos 10798b9484cSchristos /* Identificaton of the compiler. */ 10898b9484cSchristos struct som_name_pt product_id; 10998b9484cSchristos 11098b9484cSchristos /* Version id of the compiler. */ 11198b9484cSchristos struct som_name_pt version_id; 11298b9484cSchristos 11398b9484cSchristos unsigned int flags; 11498b9484cSchristos struct som_clock compile_time; 11598b9484cSchristos struct som_clock source_time; 11698b9484cSchristos }; 11798b9484cSchristos 11898b9484cSchristos struct som_exec_auxhdr 11998b9484cSchristos { 12098b9484cSchristos struct som_aux_id som_auxhdr; 12198b9484cSchristos 12298b9484cSchristos long exec_tsize; 12398b9484cSchristos long exec_tmem; 12498b9484cSchristos long exec_tfile; 12598b9484cSchristos long exec_dsize; 12698b9484cSchristos long exec_dmem; 12798b9484cSchristos long exec_dfile; 12898b9484cSchristos long exec_bsize; 12998b9484cSchristos long exec_entry; 13098b9484cSchristos long exec_flags; 13198b9484cSchristos long exec_bfill; 13298b9484cSchristos }; 13398b9484cSchristos 13498b9484cSchristos struct som_space_dictionary_record 13598b9484cSchristos { 13698b9484cSchristos unsigned int name; 13798b9484cSchristos unsigned int is_loadable : 1; 13898b9484cSchristos unsigned int is_defined : 1; 13998b9484cSchristos unsigned int is_private : 1; 14098b9484cSchristos unsigned int has_intermediate_code : 1; 14198b9484cSchristos unsigned int is_tspecific : 1; 14298b9484cSchristos unsigned int reserved : 11; 14398b9484cSchristos unsigned int sort_key : 8; 14498b9484cSchristos unsigned int reserved2 : 8; 14598b9484cSchristos int space_number; 14698b9484cSchristos int subspace_index; 14798b9484cSchristos unsigned int subspace_quantity; 14898b9484cSchristos int loader_fix_index; 14998b9484cSchristos unsigned int loader_fix_quantity; 15098b9484cSchristos int init_pointer_index; 15198b9484cSchristos unsigned int init_pointer_quantity; 15298b9484cSchristos }; 15398b9484cSchristos 15498b9484cSchristos struct som_subspace_dictionary_record 15598b9484cSchristos { 15698b9484cSchristos int space_index; 15798b9484cSchristos unsigned int access_control_bits : 7; 15898b9484cSchristos unsigned int memory_resident : 1; 15998b9484cSchristos unsigned int dup_common : 1; 16098b9484cSchristos unsigned int is_common : 1; 16198b9484cSchristos unsigned int is_loadable : 1; 16298b9484cSchristos unsigned int quadrant : 2; 16398b9484cSchristos unsigned int initially_frozen : 1; 16498b9484cSchristos unsigned int is_first : 1; 16598b9484cSchristos unsigned int code_only : 1; 16698b9484cSchristos unsigned int sort_key : 8; 16798b9484cSchristos unsigned int replicate_init : 1; 16898b9484cSchristos unsigned int continuation : 1; 16998b9484cSchristos unsigned int is_tspecific : 1; 17098b9484cSchristos unsigned int is_comdat : 1; 17198b9484cSchristos unsigned int reserved : 4; 17298b9484cSchristos int file_loc_init_value; 17398b9484cSchristos unsigned int initialization_length; 17498b9484cSchristos unsigned int subspace_start; 17598b9484cSchristos unsigned int subspace_length; 17698b9484cSchristos unsigned int reserved2 : 5; 17798b9484cSchristos unsigned int alignment : 27; 17898b9484cSchristos unsigned int name; 17998b9484cSchristos int fixup_request_index; 18098b9484cSchristos unsigned int fixup_request_quantity; 18198b9484cSchristos }; 18298b9484cSchristos 18398b9484cSchristos struct som_lst_header 18498b9484cSchristos { 18598b9484cSchristos unsigned short system_id; 18698b9484cSchristos unsigned short a_magic; 18798b9484cSchristos unsigned int version_id; 18898b9484cSchristos struct som_clock file_time; 18998b9484cSchristos unsigned int hash_loc; 19098b9484cSchristos unsigned int hash_size; 19198b9484cSchristos unsigned int module_count; 19298b9484cSchristos unsigned int module_limit; 19398b9484cSchristos unsigned int dir_loc; 19498b9484cSchristos unsigned int export_loc; 19598b9484cSchristos unsigned int export_count; 19698b9484cSchristos unsigned int import_loc; 19798b9484cSchristos unsigned int aux_loc; 19898b9484cSchristos unsigned int aux_size; 19998b9484cSchristos unsigned int string_loc; 20098b9484cSchristos unsigned int string_size; 20198b9484cSchristos unsigned int free_list; 20298b9484cSchristos unsigned int file_end; 20398b9484cSchristos unsigned int checksum; 20498b9484cSchristos }; 20598b9484cSchristos 20698b9484cSchristos #endif /* _SOM_INTERNAL_H */ 207