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