1ed0d50c3Schristos /* SOM a.out definitions for BFD. 2*b88e3e88Schristos Copyright (C) 2010-2020 Free Software Foundation, Inc. 3ed0d50c3Schristos Contributed by Tristan Gingold <gingold@adacore.com>, AdaCore. 4ed0d50c3Schristos 5ed0d50c3Schristos This file is part of BFD, the Binary File Descriptor library. 6ed0d50c3Schristos 7ed0d50c3Schristos This program is free software; you can redistribute it and/or modify 8ed0d50c3Schristos it under the terms of the GNU General Public License as published by 9ed0d50c3Schristos the Free Software Foundation; either version 3 of the License, or 10ed0d50c3Schristos (at your option) any later version. 11ed0d50c3Schristos 12ed0d50c3Schristos This program is distributed in the hope that it will be useful, 13ed0d50c3Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 14ed0d50c3Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15ed0d50c3Schristos GNU General Public License for more details. 16ed0d50c3Schristos 17ed0d50c3Schristos You should have received a copy of the GNU General Public License 18ed0d50c3Schristos along with this program; if not, write to the Free Software Foundation, 19ed0d50c3Schristos Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 20ed0d50c3Schristos 21ed0d50c3Schristos #ifndef _SOM_AOUT_H 22ed0d50c3Schristos #define _SOM_AOUT_H 23ed0d50c3Schristos 24ed0d50c3Schristos #include "clock.h" 25ed0d50c3Schristos 26ed0d50c3Schristos /* Note: SOM uses bit-field in its structure. All you need to know is: 27ed0d50c3Schristos - CPUs supported by SOM (hppa) are big-endian, 28ed0d50c3Schristos - the MSB is numbered 0. */ 29ed0d50c3Schristos 30ed0d50c3Schristos struct som_external_header 31ed0d50c3Schristos { 32ed0d50c3Schristos unsigned char system_id[2]; 33ed0d50c3Schristos unsigned char a_magic[2]; 34ed0d50c3Schristos unsigned char version_id[4]; 35ed0d50c3Schristos struct som_external_clock file_time; 36ed0d50c3Schristos unsigned char entry_space[4]; 37ed0d50c3Schristos unsigned char entry_subspace[4]; 38ed0d50c3Schristos unsigned char entry_offset[4]; 39ed0d50c3Schristos unsigned char aux_header_location[4]; 40ed0d50c3Schristos unsigned char aux_header_size[4]; 41ed0d50c3Schristos unsigned char som_length[4]; 42ed0d50c3Schristos unsigned char presumed_dp[4]; 43ed0d50c3Schristos unsigned char space_location[4]; 44ed0d50c3Schristos unsigned char space_total[4]; 45ed0d50c3Schristos unsigned char subspace_location[4]; 46ed0d50c3Schristos unsigned char subspace_total[4]; 47ed0d50c3Schristos unsigned char loader_fixup_location[4]; 48ed0d50c3Schristos unsigned char loader_fixup_total[4]; 49ed0d50c3Schristos unsigned char space_strings_location[4]; 50ed0d50c3Schristos unsigned char space_strings_size[4]; 51ed0d50c3Schristos unsigned char init_array_location[4]; 52ed0d50c3Schristos unsigned char init_array_total[4]; 53ed0d50c3Schristos unsigned char compiler_location[4]; 54ed0d50c3Schristos unsigned char compiler_total[4]; 55ed0d50c3Schristos unsigned char symbol_location[4]; 56ed0d50c3Schristos unsigned char symbol_total[4]; 57ed0d50c3Schristos unsigned char fixup_request_location[4]; 58ed0d50c3Schristos unsigned char fixup_request_total[4]; 59ed0d50c3Schristos unsigned char symbol_strings_location[4]; 60ed0d50c3Schristos unsigned char symbol_strings_size[4]; 61ed0d50c3Schristos unsigned char unloadable_sp_location[4]; 62ed0d50c3Schristos unsigned char unloadable_sp_size[4]; 63ed0d50c3Schristos unsigned char checksum[4]; 64ed0d50c3Schristos }; 65ed0d50c3Schristos 66ed0d50c3Schristos #define OLD_VERSION_ID 85082112 67ed0d50c3Schristos #define NEW_VERSION_ID 87102412 68ed0d50c3Schristos 69ed0d50c3Schristos #define EXECLIBMAGIC 0x0104 70ed0d50c3Schristos #define RELOC_MAGIC 0x0106 71ed0d50c3Schristos #define EXEC_MAGIC 0x0107 72ed0d50c3Schristos #define SHARE_MAGIC 0x0108 73ed0d50c3Schristos #define SHMEM_MAGIC 0x0109 74ed0d50c3Schristos #define DEMAND_MAGIC 0x010b 75ed0d50c3Schristos #define DL_MAGIC 0x010d 76ed0d50c3Schristos #define SHL_MAGIC 0x010e 77ed0d50c3Schristos 78ed0d50c3Schristos struct som_external_aux_id 79ed0d50c3Schristos { 80ed0d50c3Schristos unsigned char flags[4]; 81ed0d50c3Schristos unsigned char length[4]; 82ed0d50c3Schristos }; 83ed0d50c3Schristos 84ed0d50c3Schristos /* Aux id types. */ 85ed0d50c3Schristos #define VERSION_AUX_ID 6 86ed0d50c3Schristos #define COPYRIGHT_AUX_ID 9 87ed0d50c3Schristos 88ed0d50c3Schristos /* Aux id flags. */ 89ed0d50c3Schristos #define SOM_AUX_ID_MANDATORY (1 << 31) 90ed0d50c3Schristos #define SOM_AUX_ID_COPY (1 << 30) 91ed0d50c3Schristos #define SOM_AUX_ID_APPEND (1 << 29) 92ed0d50c3Schristos #define SOM_AUX_ID_IGNORE (1 << 28) 93ed0d50c3Schristos #define SOM_AUX_ID_TYPE_SH 0 94ed0d50c3Schristos #define SOM_AUX_ID_TYPE_MASK 0xffff 95ed0d50c3Schristos 96ed0d50c3Schristos struct som_external_string_auxhdr 97ed0d50c3Schristos { 98ed0d50c3Schristos struct som_external_aux_id header_id; 99ed0d50c3Schristos 100ed0d50c3Schristos /* Length of the string, without the NUL. */ 101ed0d50c3Schristos unsigned char string_length[4]; 102ed0d50c3Schristos 103ed0d50c3Schristos /* The string. */ 104ed0d50c3Schristos }; 105ed0d50c3Schristos 106ed0d50c3Schristos struct som_external_exec_auxhdr 107ed0d50c3Schristos { 108ed0d50c3Schristos struct som_external_aux_id som_auxhdr; 109ed0d50c3Schristos 110ed0d50c3Schristos unsigned char exec_tsize[4]; 111ed0d50c3Schristos unsigned char exec_tmem[4]; 112ed0d50c3Schristos unsigned char exec_tfile[4]; 113ed0d50c3Schristos unsigned char exec_dsize[4]; 114ed0d50c3Schristos unsigned char exec_dmem[4]; 115ed0d50c3Schristos unsigned char exec_dfile[4]; 116ed0d50c3Schristos unsigned char exec_bsize[4]; 117ed0d50c3Schristos unsigned char exec_entry[4]; 118ed0d50c3Schristos unsigned char exec_flags[4]; 119ed0d50c3Schristos unsigned char exec_bfill[4]; 120ed0d50c3Schristos }; 121ed0d50c3Schristos 122ed0d50c3Schristos #define AUX_HDR_SIZE sizeof (struct som_external_exec_auxhdr) 123ed0d50c3Schristos 124ed0d50c3Schristos struct som_external_space_dictionary_record 125ed0d50c3Schristos { 126ed0d50c3Schristos unsigned char name[4]; 127ed0d50c3Schristos unsigned char flags[4]; 128ed0d50c3Schristos unsigned char space_number[4]; 129ed0d50c3Schristos unsigned char subspace_index[4]; 130ed0d50c3Schristos unsigned char subspace_quantity[4]; 131ed0d50c3Schristos unsigned char loader_fix_index[4]; 132ed0d50c3Schristos unsigned char loader_fix_quantity[4]; 133ed0d50c3Schristos unsigned char init_pointer_index[4]; 134ed0d50c3Schristos unsigned char init_pointer_quantity[4]; 135ed0d50c3Schristos }; 136ed0d50c3Schristos 137ed0d50c3Schristos #define SOM_SPACE_IS_LOADABLE (1 << 31) 138ed0d50c3Schristos #define SOM_SPACE_IS_DEFINED (1 << 30) 139ed0d50c3Schristos #define SOM_SPACE_IS_PRIVATE (1 << 29) 140ed0d50c3Schristos #define SOM_SPACE_HAS_INTERMEDIATE_CODE (1 << 28) 141ed0d50c3Schristos #define SOM_SPACE_IS_TSPECIFIC (1 << 27) 142ed0d50c3Schristos #define SOM_SPACE_SORT_KEY_SH 8 143ed0d50c3Schristos #define SOM_SPACE_SORT_KEY_MASK 0xff 144ed0d50c3Schristos 145ed0d50c3Schristos struct som_external_subspace_dictionary_record 146ed0d50c3Schristos { 147ed0d50c3Schristos unsigned char space_index[4]; 148ed0d50c3Schristos unsigned char flags[4]; 149ed0d50c3Schristos unsigned char file_loc_init_value[4]; 150ed0d50c3Schristos unsigned char initialization_length[4]; 151ed0d50c3Schristos unsigned char subspace_start[4]; 152ed0d50c3Schristos unsigned char subspace_length[4]; 153ed0d50c3Schristos unsigned char alignment[4]; 154ed0d50c3Schristos unsigned char name[4]; 155ed0d50c3Schristos unsigned char fixup_request_index[4]; 156ed0d50c3Schristos unsigned char fixup_request_quantity[4]; 157ed0d50c3Schristos }; 158ed0d50c3Schristos 159ed0d50c3Schristos #define SOM_SUBSPACE_ACCESS_CONTROL_BITS_SH 25 160ed0d50c3Schristos #define SOM_SUBSPACE_ACCESS_CONTROL_BITS_MASK 0x7f 161ed0d50c3Schristos #define SOM_SUBSPACE_MEMORY_RESIDENT (1 << 24) 162ed0d50c3Schristos #define SOM_SUBSPACE_DUP_COMMON (1 << 23) 163ed0d50c3Schristos #define SOM_SUBSPACE_IS_COMMON (1 << 22) 164ed0d50c3Schristos #define SOM_SUBSPACE_IS_LOADABLE (1 << 21) 165ed0d50c3Schristos #define SOM_SUBSPACE_QUADRANT_SH 19 166ed0d50c3Schristos #define SOM_SUBSPACE_QUADRANT_MASK 0x3 167ed0d50c3Schristos #define SOM_SUBSPACE_INITIALLY_FROZEN (1 << 18) 168ed0d50c3Schristos #define SOM_SUBSPACE_IS_FIRST (1 << 17) 169ed0d50c3Schristos #define SOM_SUBSPACE_CODE_ONLY (1 << 16) 170ed0d50c3Schristos #define SOM_SUBSPACE_SORT_KEY_SH 8 171ed0d50c3Schristos #define SOM_SUBSPACE_SORT_KEY_MASK 0xff 172ed0d50c3Schristos #define SOM_SUBSPACE_REPLICATE_INIT (1 << 7) 173ed0d50c3Schristos #define SOM_SUBSPACE_CONTINUATION (1 << 6) 174ed0d50c3Schristos #define SOM_SUBSPACE_IS_TSPECIFIC (1 << 5) 175ed0d50c3Schristos #define SOM_SUBSPACE_IS_COMDAT (1 << 4) 176ed0d50c3Schristos 177ed0d50c3Schristos struct som_external_compilation_unit 178ed0d50c3Schristos { 179ed0d50c3Schristos unsigned char name[4]; 180ed0d50c3Schristos unsigned char language_name[4]; 181ed0d50c3Schristos unsigned char product_id[4]; 182ed0d50c3Schristos unsigned char version_id[4]; 183ed0d50c3Schristos unsigned char flags[4]; 184ed0d50c3Schristos struct som_external_clock compile_time; 185ed0d50c3Schristos struct som_external_clock source_time; 186ed0d50c3Schristos }; 187ed0d50c3Schristos 188ed0d50c3Schristos struct som_external_symbol_dictionary_record 189ed0d50c3Schristos { 190ed0d50c3Schristos unsigned char flags[4]; 191ed0d50c3Schristos unsigned char name[4]; 192ed0d50c3Schristos unsigned char qualifier_name[4]; 193ed0d50c3Schristos unsigned char info[4]; 194ed0d50c3Schristos unsigned char symbol_value[4]; 195ed0d50c3Schristos }; 196ed0d50c3Schristos 197ed0d50c3Schristos /* Flags fields. */ 198ed0d50c3Schristos #define SOM_SYMBOL_HIDDEN (1 << 31) 199ed0d50c3Schristos #define SOM_SYMBOL_SECONDARY_DEF (1 << 30) 200ed0d50c3Schristos #define SOM_SYMBOL_TYPE_SH 24 201ed0d50c3Schristos #define SOM_SYMBOL_TYPE_MASK 0x3f 202ed0d50c3Schristos #define SOM_SYMBOL_SCOPE_SH 20 203ed0d50c3Schristos #define SOM_SYMBOL_SCOPE_MASK 0xf 204ed0d50c3Schristos #define SOM_SYMBOL_CHECK_LEVEL_SH 17 205ed0d50c3Schristos #define SOM_SYMBOL_CHECK_LEVEL_MASK 0x7 206ed0d50c3Schristos #define SOM_SYMBOL_MUST_QUALIFY (1 << 16) 207ed0d50c3Schristos #define SOM_SYMBOL_INITIALLY_FROZEN (1 << 15) 208ed0d50c3Schristos #define SOM_SYMBOL_MEMORY_RESIDENT (1 << 14) 209ed0d50c3Schristos #define SOM_SYMBOL_IS_COMMON (1 << 13) 210ed0d50c3Schristos #define SOM_SYMBOL_DUP_COMMON (1 << 12) 211ed0d50c3Schristos #define SOM_SYMBOL_XLEAST_SH 10 212ed0d50c3Schristos #define SOM_SYMBOL_XLEAT_MASK 0x3 213ed0d50c3Schristos #define SOM_SYMBOL_ARG_RELOC_SH 0 214ed0d50c3Schristos #define SOM_SYMBOL_ARG_RELOC_MASK 0x3ff 215ed0d50c3Schristos 216ed0d50c3Schristos /* Info fields. */ 217ed0d50c3Schristos #define SOM_SYMBOL_HAS_LONG_RETURN (1 << 31) 218ed0d50c3Schristos #define SOM_SYMBOL_NO_RELOCATION (1 << 30) 219ed0d50c3Schristos #define SOM_SYMBOL_IS_COMDAT (1 << 29) 220ed0d50c3Schristos #define SOM_SYMBOL_SYMBOL_INFO_SH 0 221ed0d50c3Schristos #define SOM_SYMBOL_SYMBOL_INFO_MASK 0xffffff 222ed0d50c3Schristos 223ed0d50c3Schristos /* Symbol type definition. */ 224ed0d50c3Schristos #define ST_NULL 0 225ed0d50c3Schristos #define ST_ABSOLUTE 1 226ed0d50c3Schristos #define ST_DATA 2 227ed0d50c3Schristos #define ST_CODE 3 228ed0d50c3Schristos #define ST_PRI_PROG 4 229ed0d50c3Schristos #define ST_SEC_PROG 5 230ed0d50c3Schristos #define ST_ENTRY 6 231ed0d50c3Schristos #define ST_STORAGE 7 232ed0d50c3Schristos #define ST_STUB 8 233ed0d50c3Schristos #define ST_MODULE 9 234ed0d50c3Schristos #define ST_SYM_EXT 10 235ed0d50c3Schristos #define ST_ARG_EXT 11 236ed0d50c3Schristos #define ST_MILLICODE 12 237ed0d50c3Schristos #define ST_PLABEL 13 238ed0d50c3Schristos #define ST_OCT_DIS 14 239ed0d50c3Schristos #define ST_MILLI_EXT 15 240ed0d50c3Schristos #define ST_TSTORAGE 16 241ed0d50c3Schristos #define ST_COMDAT 17 242ed0d50c3Schristos 243ed0d50c3Schristos /* Symbol scope. */ 244ed0d50c3Schristos #define SS_UNSAT 0 245ed0d50c3Schristos #define SS_EXTERNAL 1 246ed0d50c3Schristos #define SS_LOCAL 2 247ed0d50c3Schristos #define SS_UNIVERSAL 3 248ed0d50c3Schristos 249ed0d50c3Schristos #endif /* _SOM_AOUT_H */ 250