* som.h (som_symbol_type): Delete unused a.out-related fields.
[deliverable/binutils-gdb.git] / bfd / som.h
CommitLineData
176ed088 1/* HP PA-RISC SOM object file format: definitions internal to BFD.
4359a7ef 2 Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
176ed088
JL
3
4 Contributed by the Center for Software Science at the
5 University of Utah (pa-gdb-bugs@cs.utah.edu).
6
7 This file is part of BFD, the Binary File Descriptor library.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
22
23#ifndef _SOM_H
24#define _SOM_H
25
26#include "../bfd/sysdep.h"
4e64845c 27#include "libhppa.h"
176ed088
JL
28
29#include <a.out.h>
6863eb4b
JL
30#include <lst.h>
31#include <ar.h>
176ed088
JL
32
33
7b5f6e48 34#if defined(HOST_HPPABSD) || defined (HOST_HPPAOSF)
176ed088
JL
35/* BSD uses a completely different scheme for object file identification.
36 so for now, define _PA_RISC_ID to accept any random value for a model
37 number. */
38#undef _PA_RISC_ID
39#define _PA_RISC_ID(__m_num) 1
40#endif /* HOST_HPPABSD */
41
42#define FILE_HDR_SIZE sizeof(struct header)
43#define AUX_HDR_SIZE sizeof(struct som_exec_auxhdr)
44
45typedef struct som_symbol
46 {
47 asymbol symbol;
176ed088
JL
48 unsigned int som_type;
49
50 /* Structured like the ELF tc_data union. Allows more code sharing
51 in GAS this way. */
52 union
53 {
54 unsigned int hppa_arg_reloc;
55 PTR any;
56 }
57 tc_data;
58
59 /* Index of this symbol in the symbol table. Only used when
60 building relocation streams for incomplete objects. */
61 int index;
62
63 /* How many times this symbol is used in a relocation. By sorting
64 the symbols from most used to least used we can significantly
65 reduce the size of the relocation stream for incomplete objects. */
66 int reloc_count;
67
68 /* The unwind descriptor bits associated with R_ENTRY relocations
69 for functions (not enough room in a BFD reloc to store all the
70 information, so we tack it onto the symbol associated with the
71 function. */
72 char *unwind;
73 }
74som_symbol_type;
75
4359a7ef
JL
76/* A structure containing all the magic information stored in a BFD's
77 private data which needs to be copied during an objcopy/strip run. */
78struct som_exec_data
79 {
80 /* Sort-of a magic number. BSD uses it to distinguish between
81 native executables and hpux executables. */
82 short system_id;
83
84 /* Magic exec flags. These control things like whether or not
85 null pointer dereferencing is allowed and the like. */
86 long exec_flags;
87
88 /* Add more stuff here as needed. Good examples of information
89 we might want to pass would be presumed_dp, entry_* and maybe
90 others from the file header. */
91 };
92
176ed088
JL
93struct somdata
94 {
4359a7ef
JL
95 /* All the magic information about an executable which lives
96 in the private BFD structure and needs to be copied from
97 the input bfd to the output bfd during a objcopy/strip. */
98 struct som_exec_data *exec_data;
99
100 /* These three fields are only used when writing files and are
101 generated from scratch. They need not be copied for objcopy
102 or strip to work. */
176ed088 103 struct header *file_hdr;
6863eb4b
JL
104 struct copyright_aux_hdr *copyright_aux_hdr;
105 struct user_string_aux_hdr *version_aux_hdr;
39836432 106 struct som_exec_auxhdr *exec_hdr;
4359a7ef
JL
107
108 /* Pointers to a saved copy of the symbol and string tables. These
109 need not be copied for objcopy or strip to work. */
176ed088
JL
110 som_symbol_type *symtab;
111 char *stringtab;
112
113 /* We remember these offsets so that after check_file_format, we have
4359a7ef
JL
114 no dependencies on the particular format of the exec_hdr.
115 These offsets need not be copied for objcopy or strip to work. */
176ed088
JL
116
117 file_ptr sym_filepos;
118 file_ptr str_filepos;
119 file_ptr reloc_filepos;
176ed088
JL
120 unsigned stringtab_size;
121 };
122
123struct som_data_struct
124 {
125 struct somdata a;
126 };
127
459ae909
JL
128/* Substructure of som_section_data_struct used to hold information
129 which can't be represented by the generic BFD section structure,
130 but which must be copied during objcopy or strip. */
131struct som_copyable_section_data_struct
132 {
133 /* Various fields in space and subspace headers that we need
134 to pass around. */
135 unsigned int sort_key : 8;
136 unsigned int access_control_bits : 7;
137 unsigned int is_defined : 1;
138 unsigned int is_private : 1;
139 unsigned int quadrant : 2;
140
141 /* For subspaces, this points to the section which represents the
142 space in which the subspace is contained. For spaces it points
143 back to the section for this space. */
144 asection *container;
145
146 /* The user-specified space number. It is wrong to use this as
147 an index since duplicates and holes are allowed. */
148 int space_number;
149
150 /* Add more stuff here as needed. Good examples of information
151 we might want to pass would be initialization pointers,
152 and the many subspace flags we do not represent yet. */
153 };
154
176ed088
JL
155/* Used to keep extra SOM specific information for a given section.
156
157 reloc_size holds the size of the relocation stream, note this
158 is very different from the number of relocations as SOM relocations
159 are variable length.
160
459ae909 161 reloc_stream is the actual stream of relocation entries. */
176ed088
JL
162
163struct som_section_data_struct
164 {
459ae909 165 struct som_copyable_section_data_struct *copy_data;
176ed088
JL
166 unsigned int reloc_size;
167 char *reloc_stream;
459ae909
JL
168 struct space_dictionary_record *space_dict;
169 struct subspace_dictionary_record *subspace_dict;
176ed088
JL
170 };
171
172#define somdata(bfd) ((bfd)->tdata.som_data->a)
4359a7ef 173#define obj_som_exec_data(bfd) (somdata(bfd).exec_data)
176ed088 174#define obj_som_file_hdr(bfd) (somdata(bfd).file_hdr)
39836432 175#define obj_som_exec_hdr(bfd) (somdata(bfd).exec_hdr)
6863eb4b
JL
176#define obj_som_copyright_hdr(bfd) (somdata(bfd).copyright_aux_hdr)
177#define obj_som_version_hdr(bfd) (somdata(bfd).version_aux_hdr)
176ed088
JL
178#define obj_som_symtab(bfd) (somdata(bfd).symtab)
179#define obj_som_stringtab(bfd) (somdata(bfd).stringtab)
180#define obj_som_sym_filepos(bfd) (somdata(bfd).sym_filepos)
181#define obj_som_str_filepos(bfd) (somdata(bfd).str_filepos)
182#define obj_som_stringtab_size(bfd) (somdata(bfd).stringtab_size)
183#define obj_som_reloc_filepos(bfd) (somdata(bfd).reloc_filepos)
184#define som_section_data(sec) \
185 ((struct som_section_data_struct *)sec->used_by_bfd)
459ae909 186#define som_symbol_data(symbol) ((som_symbol_type *) symbol)
176ed088
JL
187
188
189/* Defines groups of basic relocations. FIXME: These should
190 be the only basic relocations created by GAS. The rest
191 should be internal to the BFD backend.
192
193 The idea is both SOM and ELF define these basic relocation
194 types so they map into a SOM or ELF specific reloation as
195 appropriate. This allows GAS to share much more code
196 between the two object formats. */
197
198#define R_HPPA_NONE R_NO_RELOCATION
199#define R_HPPA R_CODE_ONE_SYMBOL
176ed088 200#define R_HPPA_PCREL_CALL R_PCREL_CALL
edf7c1e4 201#define R_HPPA_ABS_CALL R_ABS_CALL
176ed088 202#define R_HPPA_GOTOFF R_DP_RELATIVE
176ed088
JL
203#define R_HPPA_ENTRY R_ENTRY
204#define R_HPPA_EXIT R_EXIT
39836432 205#define R_HPPA_COMPLEX R_COMP1
176ed088 206
6863eb4b 207/* Exported functions, mostly for use by GAS. */
459ae909
JL
208boolean bfd_som_set_section_attributes PARAMS ((asection *, int, int,
209 unsigned int, int));
210boolean bfd_som_set_subsection_attributes PARAMS ((asection *, asection *,
211 int, unsigned int, int));
6863eb4b
JL
212void bfd_som_set_symbol_type PARAMS ((asymbol *, unsigned int));
213void bfd_som_attach_unwind_info PARAMS ((asymbol *, char *));
44fd6622
JL
214boolean bfd_som_attach_aux_hdr PARAMS ((bfd *, int, char *));
215int ** hppa_som_gen_reloc_type
216 PARAMS ((bfd *, int, int, enum hppa_reloc_field_selector_type_alt));
176ed088 217#endif /* _SOM_H */
This page took 0.06251 seconds and 4 git commands to generate.