198b9484cSchristos /* SOM a.out 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_AOUT_H 2298b9484cSchristos #define _SOM_AOUT_H 2398b9484cSchristos 2498b9484cSchristos #include "clock.h" 2598b9484cSchristos 2698b9484cSchristos /* Note: SOM uses bit-field in its structure. All you need to know is: 2798b9484cSchristos - CPUs supported by SOM (hppa) are big-endian, 2898b9484cSchristos - the MSB is numbered 0. */ 2998b9484cSchristos 3098b9484cSchristos struct som_external_header 3198b9484cSchristos { 3298b9484cSchristos unsigned char system_id[2]; 3398b9484cSchristos unsigned char a_magic[2]; 3498b9484cSchristos unsigned char version_id[4]; 3598b9484cSchristos struct som_external_clock file_time; 3698b9484cSchristos unsigned char entry_space[4]; 3798b9484cSchristos unsigned char entry_subspace[4]; 3898b9484cSchristos unsigned char entry_offset[4]; 3998b9484cSchristos unsigned char aux_header_location[4]; 4098b9484cSchristos unsigned char aux_header_size[4]; 4198b9484cSchristos unsigned char som_length[4]; 4298b9484cSchristos unsigned char presumed_dp[4]; 4398b9484cSchristos unsigned char space_location[4]; 4498b9484cSchristos unsigned char space_total[4]; 4598b9484cSchristos unsigned char subspace_location[4]; 4698b9484cSchristos unsigned char subspace_total[4]; 4798b9484cSchristos unsigned char loader_fixup_location[4]; 4898b9484cSchristos unsigned char loader_fixup_total[4]; 4998b9484cSchristos unsigned char space_strings_location[4]; 5098b9484cSchristos unsigned char space_strings_size[4]; 5198b9484cSchristos unsigned char init_array_location[4]; 5298b9484cSchristos unsigned char init_array_total[4]; 5398b9484cSchristos unsigned char compiler_location[4]; 5498b9484cSchristos unsigned char compiler_total[4]; 5598b9484cSchristos unsigned char symbol_location[4]; 5698b9484cSchristos unsigned char symbol_total[4]; 5798b9484cSchristos unsigned char fixup_request_location[4]; 5898b9484cSchristos unsigned char fixup_request_total[4]; 5998b9484cSchristos unsigned char symbol_strings_location[4]; 6098b9484cSchristos unsigned char symbol_strings_size[4]; 6198b9484cSchristos unsigned char unloadable_sp_location[4]; 6298b9484cSchristos unsigned char unloadable_sp_size[4]; 6398b9484cSchristos unsigned char checksum[4]; 6498b9484cSchristos }; 6598b9484cSchristos 6698b9484cSchristos #define OLD_VERSION_ID 85082112 6798b9484cSchristos #define NEW_VERSION_ID 87102412 6898b9484cSchristos 6998b9484cSchristos #define EXECLIBMAGIC 0x0104 7098b9484cSchristos #define RELOC_MAGIC 0x0106 7198b9484cSchristos #define EXEC_MAGIC 0x0107 7298b9484cSchristos #define SHARE_MAGIC 0x0108 7398b9484cSchristos #define SHMEM_MAGIC 0x0109 7498b9484cSchristos #define DEMAND_MAGIC 0x010b 7598b9484cSchristos #define DL_MAGIC 0x010d 7698b9484cSchristos #define SHL_MAGIC 0x010e 7798b9484cSchristos 7898b9484cSchristos struct som_external_aux_id 7998b9484cSchristos { 8098b9484cSchristos unsigned char flags[4]; 8198b9484cSchristos unsigned char length[4]; 8298b9484cSchristos }; 8398b9484cSchristos 8498b9484cSchristos /* Aux id types. */ 8598b9484cSchristos #define VERSION_AUX_ID 6 8698b9484cSchristos #define COPYRIGHT_AUX_ID 9 8798b9484cSchristos 8898b9484cSchristos /* Aux id flags. */ 898dffb485Schristos #define SOM_AUX_ID_MANDATORY (1u << 31) 9098b9484cSchristos #define SOM_AUX_ID_COPY (1 << 30) 9198b9484cSchristos #define SOM_AUX_ID_APPEND (1 << 29) 9298b9484cSchristos #define SOM_AUX_ID_IGNORE (1 << 28) 9398b9484cSchristos #define SOM_AUX_ID_TYPE_SH 0 9498b9484cSchristos #define SOM_AUX_ID_TYPE_MASK 0xffff 9598b9484cSchristos 9698b9484cSchristos struct som_external_string_auxhdr 9798b9484cSchristos { 9898b9484cSchristos struct som_external_aux_id header_id; 9998b9484cSchristos 10098b9484cSchristos /* Length of the string, without the NUL. */ 10198b9484cSchristos unsigned char string_length[4]; 10298b9484cSchristos 10398b9484cSchristos /* The string. */ 10498b9484cSchristos }; 10598b9484cSchristos 10698b9484cSchristos struct som_external_exec_auxhdr 10798b9484cSchristos { 10898b9484cSchristos struct som_external_aux_id som_auxhdr; 10998b9484cSchristos 11098b9484cSchristos unsigned char exec_tsize[4]; 11198b9484cSchristos unsigned char exec_tmem[4]; 11298b9484cSchristos unsigned char exec_tfile[4]; 11398b9484cSchristos unsigned char exec_dsize[4]; 11498b9484cSchristos unsigned char exec_dmem[4]; 11598b9484cSchristos unsigned char exec_dfile[4]; 11698b9484cSchristos unsigned char exec_bsize[4]; 11798b9484cSchristos unsigned char exec_entry[4]; 11898b9484cSchristos unsigned char exec_flags[4]; 11998b9484cSchristos unsigned char exec_bfill[4]; 12098b9484cSchristos }; 12198b9484cSchristos 12298b9484cSchristos #define AUX_HDR_SIZE sizeof (struct som_external_exec_auxhdr) 12398b9484cSchristos 12498b9484cSchristos struct som_external_space_dictionary_record 12598b9484cSchristos { 12698b9484cSchristos unsigned char name[4]; 12798b9484cSchristos unsigned char flags[4]; 12898b9484cSchristos unsigned char space_number[4]; 12998b9484cSchristos unsigned char subspace_index[4]; 13098b9484cSchristos unsigned char subspace_quantity[4]; 13198b9484cSchristos unsigned char loader_fix_index[4]; 13298b9484cSchristos unsigned char loader_fix_quantity[4]; 13398b9484cSchristos unsigned char init_pointer_index[4]; 13498b9484cSchristos unsigned char init_pointer_quantity[4]; 13598b9484cSchristos }; 13698b9484cSchristos 1378dffb485Schristos #define SOM_SPACE_IS_LOADABLE (1u << 31) 13898b9484cSchristos #define SOM_SPACE_IS_DEFINED (1 << 30) 13998b9484cSchristos #define SOM_SPACE_IS_PRIVATE (1 << 29) 14098b9484cSchristos #define SOM_SPACE_HAS_INTERMEDIATE_CODE (1 << 28) 14198b9484cSchristos #define SOM_SPACE_IS_TSPECIFIC (1 << 27) 14298b9484cSchristos #define SOM_SPACE_SORT_KEY_SH 8 14398b9484cSchristos #define SOM_SPACE_SORT_KEY_MASK 0xff 14498b9484cSchristos 14598b9484cSchristos struct som_external_subspace_dictionary_record 14698b9484cSchristos { 14798b9484cSchristos unsigned char space_index[4]; 14898b9484cSchristos unsigned char flags[4]; 14998b9484cSchristos unsigned char file_loc_init_value[4]; 15098b9484cSchristos unsigned char initialization_length[4]; 15198b9484cSchristos unsigned char subspace_start[4]; 15298b9484cSchristos unsigned char subspace_length[4]; 15398b9484cSchristos unsigned char alignment[4]; 15498b9484cSchristos unsigned char name[4]; 15598b9484cSchristos unsigned char fixup_request_index[4]; 15698b9484cSchristos unsigned char fixup_request_quantity[4]; 15798b9484cSchristos }; 15898b9484cSchristos 15998b9484cSchristos #define SOM_SUBSPACE_ACCESS_CONTROL_BITS_SH 25 1608dffb485Schristos #define SOM_SUBSPACE_ACCESS_CONTROL_BITS_MASK 0x7fU 1618dffb485Schristos #define SOM_SUBSPACE_MEMORY_RESIDENT (1U << 24) 1628dffb485Schristos #define SOM_SUBSPACE_DUP_COMMON (1U << 23) 1638dffb485Schristos #define SOM_SUBSPACE_IS_COMMON (1U << 22) 1648dffb485Schristos #define SOM_SUBSPACE_IS_LOADABLE (1U << 21) 16598b9484cSchristos #define SOM_SUBSPACE_QUADRANT_SH 19 1668dffb485Schristos #define SOM_SUBSPACE_QUADRANT_MASK 0x3U 1678dffb485Schristos #define SOM_SUBSPACE_INITIALLY_FROZEN (1U << 18) 1688dffb485Schristos #define SOM_SUBSPACE_IS_FIRST (1U << 17) 1698dffb485Schristos #define SOM_SUBSPACE_CODE_ONLY (1U << 16) 17098b9484cSchristos #define SOM_SUBSPACE_SORT_KEY_SH 8 1718dffb485Schristos #define SOM_SUBSPACE_SORT_KEY_MASK 0xffU 1728dffb485Schristos #define SOM_SUBSPACE_REPLICATE_INIT (1U << 7) 1738dffb485Schristos #define SOM_SUBSPACE_CONTINUATION (1U << 6) 1748dffb485Schristos #define SOM_SUBSPACE_IS_TSPECIFIC (1U << 5) 1758dffb485Schristos #define SOM_SUBSPACE_IS_COMDAT (1U << 4) 17698b9484cSchristos 17798b9484cSchristos struct som_external_compilation_unit 17898b9484cSchristos { 17998b9484cSchristos unsigned char name[4]; 18098b9484cSchristos unsigned char language_name[4]; 18198b9484cSchristos unsigned char product_id[4]; 18298b9484cSchristos unsigned char version_id[4]; 18398b9484cSchristos unsigned char flags[4]; 18498b9484cSchristos struct som_external_clock compile_time; 18598b9484cSchristos struct som_external_clock source_time; 18698b9484cSchristos }; 18798b9484cSchristos 18898b9484cSchristos struct som_external_symbol_dictionary_record 18998b9484cSchristos { 19098b9484cSchristos unsigned char flags[4]; 19198b9484cSchristos unsigned char name[4]; 19298b9484cSchristos unsigned char qualifier_name[4]; 19398b9484cSchristos unsigned char info[4]; 19498b9484cSchristos unsigned char symbol_value[4]; 19598b9484cSchristos }; 19698b9484cSchristos 19798b9484cSchristos /* Flags fields. */ 1988dffb485Schristos #define SOM_SYMBOL_HIDDEN (1u << 31) 19998b9484cSchristos #define SOM_SYMBOL_SECONDARY_DEF (1 << 30) 20098b9484cSchristos #define SOM_SYMBOL_TYPE_SH 24 20198b9484cSchristos #define SOM_SYMBOL_TYPE_MASK 0x3f 20298b9484cSchristos #define SOM_SYMBOL_SCOPE_SH 20 20398b9484cSchristos #define SOM_SYMBOL_SCOPE_MASK 0xf 20498b9484cSchristos #define SOM_SYMBOL_CHECK_LEVEL_SH 17 20598b9484cSchristos #define SOM_SYMBOL_CHECK_LEVEL_MASK 0x7 20698b9484cSchristos #define SOM_SYMBOL_MUST_QUALIFY (1 << 16) 20798b9484cSchristos #define SOM_SYMBOL_INITIALLY_FROZEN (1 << 15) 20898b9484cSchristos #define SOM_SYMBOL_MEMORY_RESIDENT (1 << 14) 20998b9484cSchristos #define SOM_SYMBOL_IS_COMMON (1 << 13) 21098b9484cSchristos #define SOM_SYMBOL_DUP_COMMON (1 << 12) 21198b9484cSchristos #define SOM_SYMBOL_XLEAST_SH 10 21298b9484cSchristos #define SOM_SYMBOL_XLEAT_MASK 0x3 21398b9484cSchristos #define SOM_SYMBOL_ARG_RELOC_SH 0 21498b9484cSchristos #define SOM_SYMBOL_ARG_RELOC_MASK 0x3ff 21598b9484cSchristos 21698b9484cSchristos /* Info fields. */ 2178dffb485Schristos #define SOM_SYMBOL_HAS_LONG_RETURN (1u << 31) 21898b9484cSchristos #define SOM_SYMBOL_NO_RELOCATION (1 << 30) 21998b9484cSchristos #define SOM_SYMBOL_IS_COMDAT (1 << 29) 22098b9484cSchristos #define SOM_SYMBOL_SYMBOL_INFO_SH 0 22198b9484cSchristos #define SOM_SYMBOL_SYMBOL_INFO_MASK 0xffffff 22298b9484cSchristos 22398b9484cSchristos /* Symbol type definition. */ 22498b9484cSchristos #define ST_NULL 0 22598b9484cSchristos #define ST_ABSOLUTE 1 22698b9484cSchristos #define ST_DATA 2 22798b9484cSchristos #define ST_CODE 3 22898b9484cSchristos #define ST_PRI_PROG 4 22998b9484cSchristos #define ST_SEC_PROG 5 23098b9484cSchristos #define ST_ENTRY 6 23198b9484cSchristos #define ST_STORAGE 7 23298b9484cSchristos #define ST_STUB 8 23398b9484cSchristos #define ST_MODULE 9 23498b9484cSchristos #define ST_SYM_EXT 10 23598b9484cSchristos #define ST_ARG_EXT 11 23698b9484cSchristos #define ST_MILLICODE 12 23798b9484cSchristos #define ST_PLABEL 13 23898b9484cSchristos #define ST_OCT_DIS 14 23998b9484cSchristos #define ST_MILLI_EXT 15 24098b9484cSchristos #define ST_TSTORAGE 16 24198b9484cSchristos #define ST_COMDAT 17 24298b9484cSchristos 24398b9484cSchristos /* Symbol scope. */ 24498b9484cSchristos #define SS_UNSAT 0 24598b9484cSchristos #define SS_EXTERNAL 1 24698b9484cSchristos #define SS_LOCAL 2 24798b9484cSchristos #define SS_UNIVERSAL 3 24898b9484cSchristos 24998b9484cSchristos #endif /* _SOM_AOUT_H */ 250