1ed0d50c3Schristos /* SOM lst 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_LST_H
22ed0d50c3Schristos #define _SOM_LST_H
23ed0d50c3Schristos 
24ed0d50c3Schristos #include "clock.h"
25ed0d50c3Schristos 
26ed0d50c3Schristos /* See 4.2 Libraray Symbol Table Header Record.  */
27ed0d50c3Schristos struct som_external_lst_header
28ed0d50c3Schristos {
29ed0d50c3Schristos   unsigned char system_id[2];
30ed0d50c3Schristos   unsigned char a_magic[2];
31ed0d50c3Schristos   unsigned char version_id[4];
32ed0d50c3Schristos   struct som_external_clock file_time;
33ed0d50c3Schristos   unsigned char hash_loc[4];
34ed0d50c3Schristos   unsigned char hash_size[4];
35ed0d50c3Schristos   unsigned char module_count[4];
36ed0d50c3Schristos   unsigned char module_limit[4];
37ed0d50c3Schristos   unsigned char dir_loc[4];
38ed0d50c3Schristos   unsigned char export_loc[4];
39ed0d50c3Schristos   unsigned char export_count[4];
40ed0d50c3Schristos   unsigned char import_loc[4];
41ed0d50c3Schristos   unsigned char aux_loc[4];
42ed0d50c3Schristos   unsigned char aux_size[4];
43ed0d50c3Schristos   unsigned char string_loc[4];
44ed0d50c3Schristos   unsigned char string_size[4];
45ed0d50c3Schristos   unsigned char free_list[4];
46ed0d50c3Schristos   unsigned char file_end[4];
47ed0d50c3Schristos   unsigned char checksum[4];
48ed0d50c3Schristos };
49ed0d50c3Schristos 
50ed0d50c3Schristos #define VERSION_ID 85082112
51ed0d50c3Schristos #define LIBMAGIC 0x0619
52ed0d50c3Schristos #define LIBMAGIC_EXEC 0x0104
53ed0d50c3Schristos 
54ed0d50c3Schristos struct som_external_lst_symbol_record
55ed0d50c3Schristos {
56ed0d50c3Schristos   unsigned char flags[4];
57ed0d50c3Schristos   unsigned char name[4];
58ed0d50c3Schristos   unsigned char qualifier_name[4];
59ed0d50c3Schristos   unsigned char symbol_info[4];
60ed0d50c3Schristos   unsigned char symbol_value[4];
61ed0d50c3Schristos   unsigned char symbol_descriptor[4];
62ed0d50c3Schristos   unsigned char reserved;
63ed0d50c3Schristos   unsigned char max_num_args;
64ed0d50c3Schristos   unsigned char min_num_args;
65ed0d50c3Schristos   unsigned char num_args;
66ed0d50c3Schristos   unsigned char som_index[4];
67ed0d50c3Schristos   unsigned char symbol_key[4];
68ed0d50c3Schristos   unsigned char next_entry[4];
69ed0d50c3Schristos };
70ed0d50c3Schristos 
71ed0d50c3Schristos /* Fields of flags.  */
72ed0d50c3Schristos #define LST_SYMBOL_HIDDEN		(1 << 31)
73ed0d50c3Schristos #define LST_SYMBOL_SECONDARY_DEF	(1 << 30)
74ed0d50c3Schristos #define LST_SYMBOL_SYMBOL_TYPE_SH	24
75ed0d50c3Schristos #define LST_SYMBOL_SYMBOL_SCOPE_SH	20
76ed0d50c3Schristos #define LST_SYMBOL_CHECK_LEVEL_SH	17
77ed0d50c3Schristos #define LST_SYMBOL_MUST_QUALIFY		(1 << 16)
78ed0d50c3Schristos #define LST_SYMBOL_INITIALY_FROZEN	(1 << 15)
79ed0d50c3Schristos #define LST_SYMBOL_MEMORY_RESIDENT	(1 << 14)
80ed0d50c3Schristos #define LST_SYMBOL_IS_COMMON		(1 << 13)
81ed0d50c3Schristos #define LST_SYMBOL_DUP_COMMON		(1 << 12)
82ed0d50c3Schristos #define LST_SYMBOL_XLEAST_SH		10
83ed0d50c3Schristos #define LST_SYMBOL_ARG_RELOC_SH		0
84ed0d50c3Schristos 
85ed0d50c3Schristos /* According to 4.3.2 SOM Directory.  */
86ed0d50c3Schristos 
87ed0d50c3Schristos struct som_external_som_entry
88ed0d50c3Schristos {
89ed0d50c3Schristos   unsigned char location[4];
90ed0d50c3Schristos   unsigned char length[4];
91ed0d50c3Schristos };
92ed0d50c3Schristos 
93ed0d50c3Schristos #endif /* _SOM_LST_H */
94