76b096e9ce49a51247c534ecc5cd90f101f50d89
[deliverable/binutils-gdb.git] / bfd / libhppa.h
1 /* HP PA-RISC SOM object file format: definitions internal to BFD.
2 Copyright (C) 1990-1991 Free Software Foundation, Inc.
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 _LIBHPPA_H
24 #define _LIBHPPA_H
25
26 #include "sysdep.h"
27
28 #ifdef HOST_HPPAHPUX
29
30 #include <sys/core.h>
31 #include <sys/utsname.h>
32
33 #endif /* HOST_HPPAHPUX */
34
35 #ifdef HOST_HPPABSD
36
37 /* Defining MAXCOMLEN avoids bringing in several (7 or 8) otherwise
38 useless include files which tend to clutter up the namespace.
39
40 BSD uses a completely different scheme for object file identification.
41 so for now, define _PA_RISC_ID to accept any random value for a model
42 number. */
43 #include <a.out.h>
44 #define MAXCOMLEN 16
45 #define _PA_RISC_ID(__m_num) 1
46
47 #endif /* HOST_HPPABSD */
48
49 #define BYTES_IN_WORD 4
50
51 struct header;
52 struct som_exec_auxhdr;
53 struct subspace_dictionary;
54
55 #define FILE_HDR_SIZE sizeof(struct header)
56 #define AUX_HDR_SIZE sizeof(struct som_exec_auxhdr)
57
58 typedef struct hppa_symbol
59 {
60 asymbol symbol;
61 short desc;
62 char other;
63 unsigned char type;
64 } hppa_symbol_type;
65
66 struct hppadata
67 {
68 struct header *file_hdr;
69 struct som_exec_auxhdr *aux_hdr;
70 hppa_symbol_type *symbols;
71
72 /* We remember these offsets so that after check_file_format, we have
73 no dependencies on the particular format of the exec_hdr. */
74
75 file_ptr sym_filepos;
76 file_ptr str_filepos;
77
78 unsigned stringtab_size;
79
80 /* Size of a symbol table entry in external form */
81 unsigned hp_symbol_entry_size;
82 };
83
84 struct hppa_data_struct {
85 struct hppadata a;
86 };
87
88 #define padata(bfd) ((bfd)->tdata.hppa_data->a)
89 #define obj_file_hdr(bfd) (padata(bfd).file_hdr)
90 #define obj_aux_hdr(bfd) (padata(bfd).aux_hdr)
91 #define obj_pa_symbols(bfd) (padata(bfd).symbols)
92 #define obj_sym_filepos(bfd) (padata(bfd).sym_filepos)
93 #define obj_str_filepos(bfd) (padata(bfd).str_filepos)
94 #define obj_stringtab_size(bfd) (padata(bfd).stringtab_size)
95
96 /* We take the address of the first element of an asymbol to ensure that the
97 macro is only ever applied to an asymbol */
98 #define hppa_symbol(asymbol) ((hppa_symbol_type *)(&(asymbol)->the_bfd))
99
100
101 /* These are stored in the bfd's tdata */
102
103 struct hppa_core_struct
104 {
105 int sig;
106 char cmd[MAXCOMLEN + 1];
107 asection *data_section;
108 asection *stack_section;
109 asection *reg_section;
110 };
111
112 #define core_hdr(bfd) ((bfd)->tdata.hppa_core_data)
113 #define core_signal(bfd) (core_hdr(bfd)->sig)
114 #define core_command(bfd) (core_hdr(bfd)->cmd)
115 #define core_datasec(bfd) (core_hdr(bfd)->data_section)
116 #define core_stacksec(bfd) (core_hdr(bfd)->stack_section)
117 #define core_regsec(bfd) (core_hdr(bfd)->reg_section)
118
119 /* HP PA-RISC relocation types */
120
121 enum hppa_reloc_field_selector_type
122 {
123 R_HPPA_FSEL = 0x0,
124 R_HPPA_LSSEL = 0x1,
125 R_HPPA_RSSEL = 0x2,
126 R_HPPA_LSEL = 0x3,
127 R_HPPA_RSEL = 0x4,
128 R_HPPA_LDSEL = 0x5,
129 R_HPPA_RDSEL = 0x6,
130 R_HPPA_LRSEL = 0x7,
131 R_HPPA_RRSEL = 0x8,
132 R_HPPA_PSEL = 0x9, /* P' : procedure address for shlib's */
133 R_HPPA_LPSEL = 0xa, /* LP' : L' for procedure addresses */
134 R_HPPA_RPSEL = 0xb, /* RP' : R' for procedure addresses */
135
136 R_HPPA_TSEL = 0xc, /* T' : DLT-relative offset for shlib's */
137 R_HPPA_LTSEL = 0xd, /* LT' : L' for DLT-relative offsets */
138 R_HPPA_RTSEL = 0xe /* RT' : R' for DLT-relative offsets */
139
140 };
141
142 /* for compatibility */
143 enum hppa_reloc_field_selector_type_alt
144 {
145 e_fsel = R_HPPA_FSEL,
146 e_lssel = R_HPPA_LSSEL,
147 e_rssel = R_HPPA_RSSEL,
148 e_lsel = R_HPPA_LSEL,
149 e_rsel = R_HPPA_RSEL,
150 e_ldsel = R_HPPA_LDSEL,
151 e_rdsel = R_HPPA_RDSEL,
152 e_lrsel = R_HPPA_LRSEL,
153 e_rrsel = R_HPPA_RRSEL,
154 e_psel = R_HPPA_PSEL, /* P' : procedure address for shlib's */
155 e_lpsel = R_HPPA_LPSEL, /* LP' : L' for procedure addresses */
156 e_rpsel = R_HPPA_RPSEL, /* RP' : R' for procedure addresses */
157
158 e_tsel = R_HPPA_TSEL, /* T' : DLT-relative offset for shlib's */
159 e_ltsel = R_HPPA_LTSEL, /* LT' : L' for DLT-relative offsets */
160 e_rtsel = R_HPPA_RTSEL /* RT' : R' for DLT-relative offsets */
161 };
162
163 enum hppa_reloc_expr_type
164 {
165 R_HPPA_E_ONE = 0,
166 R_HPPA_E_TWO = 1,
167 R_HPPA_E_PCREL = 2,
168 R_HPPA_E_CON = 3,
169 R_HPPA_E_PLABEL = 7,
170 R_HPPA_E_ABS = 18
171 };
172
173 /* for compatibility */
174 enum hppa_reloc_expr_type_alt
175 {
176 e_one = R_HPPA_E_ONE,
177 e_two = R_HPPA_E_TWO,
178 e_pcrel = R_HPPA_E_PCREL,
179 e_con = R_HPPA_E_CON,
180 e_plabel = R_HPPA_E_PLABEL,
181 e_abs = R_HPPA_E_ABS
182 };
183
184 #endif /* _LIBHPPA_H */
This page took 0.033268 seconds and 4 git commands to generate.