Home | History | Annotate | Download | only in som
      1 /* SOM internal definitions for BFD.
      2    Copyright (C) 2010-2014 Free Software Foundation, Inc.
      3    Contributed by Tristan Gingold <gingold (at) adacore.com>, AdaCore.
      4 
      5    This file is part of BFD, the Binary File Descriptor library.
      6 
      7    This program is free software; you can redistribute it and/or modify
      8    it under the terms of the GNU General Public License as published by
      9    the Free Software Foundation; either version 3 of the License, or
     10    (at your option) any later version.
     11 
     12    This program is distributed in the hope that it will be useful,
     13    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15    GNU General Public License for more details.
     16 
     17    You should have received a copy of the GNU General Public License
     18    along with this program; if not, write to the Free Software Foundation,
     19    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
     20 
     21 #ifndef _SOM_INTERNAL_H
     22 #define _SOM_INTERNAL_H
     23 
     24 struct som_clock
     25 {
     26   unsigned int secs;
     27   unsigned int nanosecs;
     28 };
     29 
     30 struct som_header
     31 {
     32   unsigned short system_id;
     33   unsigned short a_magic;
     34   unsigned int version_id;
     35   struct som_clock file_time;
     36   unsigned int entry_space;
     37   unsigned int entry_subspace;
     38   unsigned int entry_offset;
     39   unsigned int aux_header_location;
     40   unsigned int aux_header_size;
     41   unsigned int som_length;
     42   unsigned int presumed_dp;
     43   unsigned int space_location;
     44   unsigned int space_total;
     45   unsigned int subspace_location;
     46   unsigned int subspace_total;
     47   unsigned int loader_fixup_location;
     48   unsigned int loader_fixup_total;
     49   unsigned int space_strings_location;
     50   unsigned int space_strings_size;
     51   unsigned int init_array_location;
     52   unsigned int init_array_total;
     53   unsigned int compiler_location;
     54   unsigned int compiler_total;
     55   unsigned int symbol_location;
     56   unsigned int symbol_total;
     57   unsigned int fixup_request_location;
     58   unsigned int fixup_request_total;
     59   unsigned int symbol_strings_location;
     60   unsigned int symbol_strings_size;
     61   unsigned int unloadable_sp_location;
     62   unsigned int unloadable_sp_size;
     63   unsigned int checksum;
     64 };
     65 
     66 struct som_aux_id
     67 {
     68   unsigned int mandatory : 1;
     69   unsigned int copy : 1;
     70   unsigned int append : 1;
     71   unsigned int ignore : 1;
     72   unsigned int reserved : 12;
     73 
     74   /* Header type.  */
     75   unsigned int type : 16;
     76 
     77   /* Length of the header in bytes, without the two word identifier.  */
     78   unsigned int length;
     79 };
     80 
     81 /* Generic auxiliary string header.  */
     82 struct som_string_auxhdr
     83 {
     84   struct som_aux_id header_id;
     85 
     86   /* Length of the string, without the NUL.  */
     87   unsigned int string_length;
     88 
     89   /* The string.  */
     90   char string[1];
     91 };
     92 
     93 struct som_name_pt
     94 {
     95   char *name;
     96   unsigned int strx;
     97 };
     98 
     99 struct som_compilation_unit
    100 {
    101   /* Source file that produced the SOM.  */
    102   struct som_name_pt name;
    103 
    104   /* Name of the language used when creating this SOM.  */
    105   struct som_name_pt language_name;
    106 
    107   /* Identificaton of the compiler.  */
    108   struct som_name_pt product_id;
    109 
    110   /* Version id of the compiler.  */
    111   struct som_name_pt version_id;
    112 
    113   unsigned int flags;
    114   struct som_clock compile_time;
    115   struct som_clock source_time;
    116 };
    117 
    118 struct som_exec_auxhdr
    119 {
    120   struct som_aux_id som_auxhdr;
    121 
    122   long exec_tsize;
    123   long exec_tmem;
    124   long exec_tfile;
    125   long exec_dsize;
    126   long exec_dmem;
    127   long exec_dfile;
    128   long exec_bsize;
    129   long exec_entry;
    130   long exec_flags;
    131   long exec_bfill;
    132 };
    133 
    134 struct som_space_dictionary_record
    135 {
    136   unsigned int name;
    137   unsigned int is_loadable : 1;
    138   unsigned int is_defined : 1;
    139   unsigned int is_private : 1;
    140   unsigned int has_intermediate_code : 1;
    141   unsigned int is_tspecific : 1;
    142   unsigned int reserved : 11;
    143   unsigned int sort_key : 8;
    144   unsigned int reserved2 : 8;
    145   int space_number;
    146   int subspace_index;
    147   unsigned int subspace_quantity;
    148   int loader_fix_index;
    149   unsigned int loader_fix_quantity;
    150   int init_pointer_index;
    151   unsigned int init_pointer_quantity;
    152 };
    153 
    154 struct som_subspace_dictionary_record
    155 {
    156   int space_index;
    157   unsigned int access_control_bits : 7;
    158   unsigned int memory_resident : 1;
    159   unsigned int dup_common : 1;
    160   unsigned int is_common : 1;
    161   unsigned int is_loadable : 1;
    162   unsigned int quadrant : 2;
    163   unsigned int initially_frozen : 1;
    164   unsigned int is_first : 1;
    165   unsigned int code_only : 1;
    166   unsigned int sort_key : 8;
    167   unsigned int replicate_init : 1;
    168   unsigned int continuation : 1;
    169   unsigned int is_tspecific : 1;
    170   unsigned int is_comdat : 1;
    171   unsigned int reserved : 4;
    172   int file_loc_init_value;
    173   unsigned int initialization_length;
    174   unsigned int subspace_start;
    175   unsigned int subspace_length;
    176   unsigned int reserved2 : 5;
    177   unsigned int alignment : 27;
    178   unsigned int name;
    179   int fixup_request_index;
    180   unsigned int fixup_request_quantity;
    181 };
    182 
    183 struct som_lst_header
    184 {
    185   unsigned short system_id;
    186   unsigned short a_magic;
    187   unsigned int version_id;
    188   struct som_clock file_time;
    189   unsigned int hash_loc;
    190   unsigned int hash_size;
    191   unsigned int module_count;
    192   unsigned int module_limit;
    193   unsigned int dir_loc;
    194   unsigned int export_loc;
    195   unsigned int export_count;
    196   unsigned int import_loc;
    197   unsigned int aux_loc;
    198   unsigned int aux_size;
    199   unsigned int string_loc;
    200   unsigned int string_size;
    201   unsigned int free_list;
    202   unsigned int file_end;
    203   unsigned int checksum;
    204 };
    205 
    206 #endif /* _SOM_INTERNAL_H */
    207