Commit | Line | Data |
---|---|---|
beb1bf64 TR |
1 | /* BFD XCOFF object file private structure. |
2 | Copyright (C) 2001 Free Software Foundation, Inc. | |
3 | Written by Tom Rix, Redhat. | |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #ifndef LIBXCOFF_H | |
22 | #define LIBXCOFF_H | |
23 | ||
24 | /* This is the backend information kept for XCOFF files. This | |
25 | structure is constant for a particular backend. The first element | |
26 | is the COFF backend data structure, so that XCOFF targets can use | |
27 | the generic COFF code. */ | |
28 | ||
29 | struct xcoff_backend_data_rec | |
30 | { | |
330693f5 | 31 | /* COFF backend information. */ |
beb1bf64 TR |
32 | bfd_coff_backend_data coff; |
33 | ||
34 | /* Magic number */ | |
dc810e39 | 35 | unsigned short _xcoff_magic_number; |
beb1bf64 TR |
36 | |
37 | /* Architecture and machine for coff_set_arch_mach_hook */ | |
38 | enum bfd_architecture _xcoff_architecture; | |
39 | long _xcoff_machine; | |
40 | ||
41 | /* function pointers to xcoff specific swap routines */ | |
814fa6ab AM |
42 | void (* _xcoff_swap_ldhdr_in)(bfd *, const PTR, struct internal_ldhdr *); |
43 | void (* _xcoff_swap_ldhdr_out)(bfd *, const struct internal_ldhdr *, PTR); | |
44 | void (* _xcoff_swap_ldsym_in)(bfd *, const PTR, struct internal_ldsym *); | |
45 | void (* _xcoff_swap_ldsym_out)(bfd *, const struct internal_ldsym *, PTR); | |
46 | void (* _xcoff_swap_ldrel_in)(bfd *, const PTR, struct internal_ldrel *); | |
47 | void (* _xcoff_swap_ldrel_out)(bfd *, const struct internal_ldrel *, PTR); | |
beb1bf64 | 48 | |
08da05b0 | 49 | /* size of the external struct */ |
dc810e39 | 50 | unsigned int _xcoff_ldhdrsz; |
beb1bf64 TR |
51 | unsigned int _xcoff_ldsymsz; |
52 | unsigned int _xcoff_ldrelsz; | |
53 | ||
54 | /* size an entry in a descriptor section */ | |
55 | unsigned int _xcoff_function_descriptor_size; | |
56 | ||
57 | /* size of the small aout file header */ | |
58 | unsigned int _xcoff_small_aout_header_size; | |
59 | ||
330693f5 TR |
60 | /* Loader version |
61 | 1 : XCOFF32 | |
62 | 2 : XCOFF64 */ | |
beb1bf64 TR |
63 | unsigned long _xcoff_ldhdr_version; |
64 | ||
65 | boolean (* _xcoff_put_symbol_name)(bfd *, struct bfd_strtab_hash *, | |
66 | struct internal_syment *, | |
67 | const char *); | |
68 | ||
dc810e39 | 69 | boolean (* _xcoff_put_ldsymbol_name)(bfd *, struct xcoff_loader_info *, |
beb1bf64 TR |
70 | struct internal_ldsym *, |
71 | const char *); | |
72 | ||
73 | reloc_howto_type *_xcoff_dynamic_reloc; | |
74 | ||
75 | asection * (* _xcoff_create_csect_from_smclas) (bfd *, union internal_auxent *, const char *); | |
76 | ||
330693f5 TR |
77 | /* Line number and relocation overflow. |
78 | XCOFF32 overflows to another section when the line number or the | |
79 | relocation count exceeds 0xffff. XCOFF64 does not overflow. */ | |
beb1bf64 TR |
80 | boolean (*_xcoff_is_lineno_count_overflow)(bfd *, bfd_vma); |
81 | boolean (*_xcoff_is_reloc_count_overflow)(bfd *, bfd_vma); | |
82 | ||
330693f5 TR |
83 | /* Loader section symbol and relocation table offset |
84 | XCOFF32 is after the .loader header | |
85 | XCOFF64 is offset in .loader header */ | |
beb1bf64 TR |
86 | bfd_vma (*_xcoff_loader_symbol_offset)(bfd *, struct internal_ldhdr *); |
87 | bfd_vma (*_xcoff_loader_reloc_offset)(bfd *, struct internal_ldhdr *); | |
330693f5 TR |
88 | |
89 | /* Global linkage. The first word of global linkage code must be be | |
90 | modified by filling in the correct TOC offset. */ | |
beb1bf64 | 91 | unsigned long *_xcoff_glink_code; |
330693f5 TR |
92 | |
93 | /* Size of the global link code in bytes of the xcoff_glink_code table. */ | |
beb1bf64 TR |
94 | unsigned long _xcoff_glink_size; |
95 | ||
9a4c7f16 TR |
96 | /* rtinit */ |
97 | unsigned int _xcoff_rtinit_size; | |
69f284c7 TR |
98 | boolean (*_xcoff_generate_rtinit)(bfd *, const char *, const char *, |
99 | boolean); | |
beb1bf64 TR |
100 | }; |
101 | ||
102 | /* Look up an entry in an XCOFF link hash table. */ | |
103 | ||
104 | #define xcoff_link_hash_lookup(table, string, create, copy, follow) \ | |
105 | ((struct xcoff_link_hash_entry *) \ | |
106 | bfd_link_hash_lookup (&(table)->root, (string), (create), (copy),\ | |
107 | (follow))) | |
108 | ||
109 | /* Traverse an XCOFF link hash table. */ | |
110 | ||
111 | #define xcoff_link_hash_traverse(table, func, info) \ | |
112 | (bfd_link_hash_traverse \ | |
113 | (&(table)->root, \ | |
114 | (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ | |
115 | (info))) | |
116 | ||
117 | /* Get the XCOFF link hash table from the info structure. This is | |
118 | just a cast. */ | |
119 | ||
120 | #define xcoff_hash_table(p) ((struct xcoff_link_hash_table *) ((p)->hash)) | |
121 | ||
122 | ||
123 | #define xcoff_backend(abfd) \ | |
124 | ((struct xcoff_backend_data_rec *) (abfd)->xvec->backend_data) | |
125 | ||
126 | #define bfd_xcoff_magic_number(a) ((xcoff_backend(a)->_xcoff_magic_number)) | |
127 | #define bfd_xcoff_architecture(a) ((xcoff_backend(a)->_xcoff_architecture)) | |
128 | #define bfd_xcoff_machine(a) ((xcoff_backend(a)->_xcoff_machine)) | |
129 | ||
130 | #define bfd_xcoff_swap_ldhdr_in(a, b, c) \ | |
131 | ((xcoff_backend(a)->_xcoff_swap_ldhdr_in) ((a), (b), (c))) | |
132 | ||
133 | #define bfd_xcoff_swap_ldhdr_out(a, b, c) \ | |
134 | ((xcoff_backend(a)->_xcoff_swap_ldhdr_out) ((a), (b), (c))) | |
135 | ||
136 | #define bfd_xcoff_swap_ldsym_in(a, b, c) \ | |
137 | ((xcoff_backend(a)->_xcoff_swap_ldsym_in) ((a), (b), (c))) | |
138 | ||
139 | #define bfd_xcoff_swap_ldsym_out(a, b, c) \ | |
140 | ((xcoff_backend(a)->_xcoff_swap_ldsym_out) ((a), (b), (c))) | |
141 | ||
142 | #define bfd_xcoff_swap_ldrel_in(a, b, c) \ | |
143 | ((xcoff_backend(a)->_xcoff_swap_ldrel_in) ((a), (b), (c))) | |
144 | ||
145 | #define bfd_xcoff_swap_ldrel_out(a, b, c) \ | |
146 | ((xcoff_backend(a)->_xcoff_swap_ldrel_out) ((a), (b), (c))) | |
147 | ||
148 | #define bfd_xcoff_ldhdrsz(a) ((xcoff_backend(a)->_xcoff_ldhdrsz)) | |
149 | #define bfd_xcoff_ldsymsz(a) ((xcoff_backend(a)->_xcoff_ldsymsz)) | |
150 | #define bfd_xcoff_ldrelsz(a) ((xcoff_backend(a)->_xcoff_ldrelsz)) | |
151 | #define bfd_xcoff_function_descriptor_size(a) \ | |
152 | ((xcoff_backend(a)->_xcoff_function_descriptor_size)) | |
153 | #define bfd_xcoff_small_aout_header_size(a) \ | |
154 | ((xcoff_backend(a)->_xcoff_small_aout_header_size)) | |
155 | ||
156 | #define bfd_xcoff_ldhdr_version(a) ((xcoff_backend(a)->_xcoff_ldhdr_version)) | |
157 | ||
158 | #define bfd_xcoff_put_symbol_name(a, b, c, d) \ | |
159 | ((xcoff_backend(a)->_xcoff_put_symbol_name) ((a), (b), (c), (d))) | |
160 | ||
161 | #define bfd_xcoff_put_ldsymbol_name(a, b, c, d) \ | |
162 | ((xcoff_backend(a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d))) | |
163 | ||
164 | /* Get the XCOFF hash table entries for a BFD. */ | |
165 | #define obj_xcoff_sym_hashes(bfd) \ | |
166 | ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd)) | |
167 | ||
168 | #define bfd_xcoff_dynamic_reloc_howto(a) \ | |
169 | ((xcoff_backend(a)->_xcoff_dynamic_reloc)) | |
170 | ||
171 | #define bfd_xcoff_create_csect_from_smclas(a, b, c) \ | |
172 | ((xcoff_backend(a)->_xcoff_create_csect_from_smclas((a), (b), (c)))) | |
173 | ||
174 | #define bfd_xcoff_is_lineno_count_overflow(a, b) \ | |
175 | ((xcoff_backend(a)->_xcoff_is_lineno_count_overflow((a), (b)))) | |
176 | ||
177 | #define bfd_xcoff_is_reloc_count_overflow(a, b) \ | |
178 | ((xcoff_backend(a)->_xcoff_is_reloc_count_overflow((a), (b)))) | |
179 | ||
180 | #define bfd_xcoff_loader_symbol_offset(a, b) \ | |
181 | ((xcoff_backend(a)->_xcoff_loader_symbol_offset((a), (b)))) | |
182 | ||
183 | #define bfd_xcoff_loader_reloc_offset(a, b) \ | |
184 | ((xcoff_backend(a)->_xcoff_loader_reloc_offset((a), (b)))) | |
185 | ||
186 | #define bfd_xcoff_glink_code(a, b) ((xcoff_backend(a)->_xcoff_glink_code[(b)])) | |
187 | #define bfd_xcoff_glink_code_size(a) ((xcoff_backend(a)->_xcoff_glink_size)) | |
188 | ||
9a4c7f16 | 189 | /* Check for the magic number U803XTOCMAGIC for 64 bit targets. */ |
beb1bf64 | 190 | #define bfd_xcoff_is_xcoff64(a) (0x01EF == (bfd_xcoff_magic_number(a))) |
9a4c7f16 TR |
191 | |
192 | /* Check for the magic number U802TOMAGIC for 32 bit targets. */ | |
beb1bf64 TR |
193 | #define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a))) |
194 | ||
9a4c7f16 | 195 | #define bfd_xcoff_rtinit_size(a) ((xcoff_backend(a)->_xcoff_rtinit_size)) |
69f284c7 | 196 | #define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend(a)->_xcoff_generate_rtinit ((a), (b), (c), (d)))) |
9a4c7f16 | 197 | |
beb1bf64 | 198 | #endif /* LIBXCOFF_H */ |