Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | /* vms.c -- BFD back-end for VAX (openVMS/VAX) and |
2 | EVAX (openVMS/Alpha) files. | |
72adc230 | 3 | Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
7898deda | 4 | Free Software Foundation, Inc. |
252b5132 RH |
5 | |
6 | Written by Klaus K"ampf (kkaempf@rmi.de) | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
21 | ||
22 | #include "bfd.h" | |
23 | #include "sysdep.h" | |
24 | #include "bfdlink.h" | |
25 | #include "libbfd.h" | |
26 | ||
27 | #include "vms.h" | |
28 | ||
b34976b6 AM |
29 | static bfd_boolean vms_initialize |
30 | PARAMS ((bfd *)); | |
5f771d47 | 31 | static unsigned int priv_section_count; |
b34976b6 AM |
32 | static bfd_boolean fill_section_ptr |
33 | PARAMS ((struct bfd_hash_entry *, PTR)); | |
34 | static bfd_boolean vms_fixup_sections | |
35 | PARAMS ((bfd *)); | |
36 | static bfd_boolean copy_symbols | |
37 | PARAMS ((struct bfd_hash_entry *, PTR)); | |
252b5132 RH |
38 | static bfd_reloc_status_type reloc_nil |
39 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
b34976b6 AM |
40 | static const struct bfd_target *vms_object_p |
41 | PARAMS ((bfd *abfd)); | |
42 | static const struct bfd_target *vms_archive_p | |
43 | PARAMS ((bfd *abfd)); | |
44 | static bfd_boolean vms_mkobject | |
45 | PARAMS ((bfd *abfd)); | |
46 | static bfd_boolean vms_write_object_contents | |
47 | PARAMS ((bfd *abfd)); | |
48 | static bfd_boolean vms_close_and_cleanup | |
49 | PARAMS ((bfd *abfd)); | |
50 | static bfd_boolean vms_bfd_free_cached_info | |
51 | PARAMS ((bfd *abfd)); | |
52 | static bfd_boolean vms_new_section_hook | |
53 | PARAMS ((bfd *abfd, asection *section)); | |
54 | static bfd_boolean vms_get_section_contents | |
252b5132 RH |
55 | PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2, |
56 | bfd_size_type x3)); | |
b34976b6 | 57 | static bfd_boolean vms_get_section_contents_in_window |
252b5132 RH |
58 | PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset, |
59 | bfd_size_type count)); | |
b34976b6 AM |
60 | static bfd_boolean vms_bfd_copy_private_bfd_data |
61 | PARAMS ((bfd *src, bfd *dest)); | |
62 | static bfd_boolean vms_bfd_copy_private_section_data | |
252b5132 | 63 | PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec)); |
b34976b6 | 64 | static bfd_boolean vms_bfd_copy_private_symbol_data |
252b5132 | 65 | PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); |
b34976b6 | 66 | static bfd_boolean vms_bfd_print_private_bfd_data |
252b5132 | 67 | PARAMS ((bfd *abfd, void *file)); |
b34976b6 AM |
68 | static char *vms_core_file_failing_command |
69 | PARAMS ((bfd *abfd)); | |
70 | static int vms_core_file_failing_signal | |
71 | PARAMS ((bfd *abfd)); | |
72 | static bfd_boolean vms_core_file_matches_executable_p | |
252b5132 | 73 | PARAMS ((bfd *abfd, bfd *bbfd)); |
b34976b6 AM |
74 | static bfd_boolean vms_slurp_armap |
75 | PARAMS ((bfd *abfd)); | |
76 | static bfd_boolean vms_slurp_extended_name_table | |
77 | PARAMS ((bfd *abfd)); | |
78 | static bfd_boolean vms_construct_extended_name_table | |
252b5132 RH |
79 | PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen, |
80 | const char **name)); | |
81 | static void vms_truncate_arname | |
dc810e39 | 82 | PARAMS ((bfd *abfd, const char *pathname, char *arhdr)); |
b34976b6 | 83 | static bfd_boolean vms_write_armap |
252b5132 RH |
84 | PARAMS ((bfd *arch, unsigned int elength, struct orl *map, |
85 | unsigned int orl_count, int stridx)); | |
b34976b6 AM |
86 | static PTR vms_read_ar_hdr |
87 | PARAMS ((bfd *abfd)); | |
88 | static bfd *vms_get_elt_at_index | |
89 | PARAMS ((bfd *abfd, symindex index)); | |
90 | static bfd *vms_openr_next_archived_file | |
91 | PARAMS ((bfd *arch, bfd *prev)); | |
92 | static bfd_boolean vms_update_armap_timestamp | |
93 | PARAMS ((bfd *abfd)); | |
94 | static int vms_generic_stat_arch_elt | |
95 | PARAMS ((bfd *, struct stat *)); | |
96 | static long vms_get_symtab_upper_bound | |
97 | PARAMS ((bfd *abfd)); | |
6cee3f79 | 98 | static long vms_canonicalize_symtab |
b34976b6 | 99 | PARAMS ((bfd *abfd, asymbol **symbols)); |
252b5132 RH |
100 | static void vms_print_symbol |
101 | PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how)); | |
102 | static void vms_get_symbol_info | |
103 | PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret)); | |
b34976b6 AM |
104 | static bfd_boolean vms_bfd_is_local_label_name |
105 | PARAMS ((bfd *abfd, const char *)); | |
106 | static alent *vms_get_lineno | |
107 | PARAMS ((bfd *abfd, asymbol *symbol)); | |
108 | static bfd_boolean vms_find_nearest_line | |
252b5132 RH |
109 | PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, |
110 | const char **file, const char **func, unsigned int *line)); | |
111 | static asymbol *vms_bfd_make_debug_symbol | |
112 | PARAMS ((bfd *abfd, void *ptr, unsigned long size)); | |
113 | static long vms_read_minisymbols | |
b34976b6 AM |
114 | PARAMS ((bfd *abfd, bfd_boolean dynamic, PTR *minisymsp, |
115 | unsigned int *sizep)); | |
252b5132 | 116 | static asymbol *vms_minisymbol_to_symbol |
b34976b6 AM |
117 | PARAMS ((bfd *abfd, bfd_boolean dynamic, const PTR minisym, asymbol *sym)); |
118 | static long vms_get_reloc_upper_bound | |
119 | PARAMS ((bfd *abfd, asection *sect)); | |
252b5132 RH |
120 | static long vms_canonicalize_reloc |
121 | PARAMS ((bfd *abfd, asection *srcsec, arelent **location, | |
122 | asymbol **symbols)); | |
123 | static const struct reloc_howto_struct *vms_bfd_reloc_type_lookup | |
124 | PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); | |
b34976b6 | 125 | static bfd_boolean vms_set_arch_mach |
252b5132 | 126 | PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach)); |
b34976b6 | 127 | static bfd_boolean vms_set_section_contents |
0f867abe | 128 | PARAMS ((bfd *abfd, asection *section, const PTR location, file_ptr offset, |
252b5132 | 129 | bfd_size_type count)); |
b34976b6 AM |
130 | static int vms_sizeof_headers |
131 | PARAMS ((bfd *abfd, bfd_boolean reloc)); | |
252b5132 RH |
132 | static bfd_byte *vms_bfd_get_relocated_section_contents |
133 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info, | |
134 | struct bfd_link_order *link_order, bfd_byte *data, | |
1049f94e | 135 | bfd_boolean relocatable, asymbol **symbols)); |
b34976b6 | 136 | static bfd_boolean vms_bfd_relax_section |
252b5132 | 137 | PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info, |
b34976b6 AM |
138 | bfd_boolean *again)); |
139 | static bfd_boolean vms_bfd_gc_sections | |
252b5132 | 140 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
b34976b6 | 141 | static bfd_boolean vms_bfd_merge_sections |
8550eb6e | 142 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
252b5132 RH |
143 | static struct bfd_link_hash_table *vms_bfd_link_hash_table_create |
144 | PARAMS ((bfd *abfd)); | |
e2d34d7d DJ |
145 | static void vms_bfd_link_hash_table_free |
146 | PARAMS ((struct bfd_link_hash_table *hash)); | |
b34976b6 | 147 | static bfd_boolean vms_bfd_link_add_symbols |
252b5132 | 148 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
b34976b6 | 149 | static bfd_boolean vms_bfd_final_link |
252b5132 | 150 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
b34976b6 | 151 | static bfd_boolean vms_bfd_link_split_section |
252b5132 | 152 | PARAMS ((bfd *abfd, asection *section)); |
b34976b6 AM |
153 | static long vms_get_dynamic_symtab_upper_bound |
154 | PARAMS ((bfd *abfd)); | |
252b5132 RH |
155 | static long vms_canonicalize_dynamic_symtab |
156 | PARAMS ((bfd *abfd, asymbol **symbols)); | |
4c45e5c9 | 157 | #define vms_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab |
b34976b6 AM |
158 | static long vms_get_dynamic_reloc_upper_bound |
159 | PARAMS ((bfd *abfd)); | |
252b5132 RH |
160 | static long vms_canonicalize_dynamic_reloc |
161 | PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols)); | |
b34976b6 AM |
162 | static bfd_boolean vms_bfd_merge_private_bfd_data |
163 | PARAMS ((bfd *ibfd, bfd *obfd)); | |
164 | static bfd_boolean vms_bfd_set_private_flags | |
165 | PARAMS ((bfd *abfd, flagword flags)); | |
252b5132 | 166 | |
3f3c5c34 | 167 | #define vms_make_empty_symbol _bfd_generic_make_empty_symbol |
2d653fc7 | 168 | #define vms_bfd_link_just_syms _bfd_generic_link_just_syms |
72adc230 | 169 | #define vms_bfd_is_group_section bfd_generic_is_group_section |
e61463e1 | 170 | #define vms_bfd_discard_group bfd_generic_discard_group |
80fccad2 BW |
171 | #define vms_bfd_copy_private_header_data \ |
172 | _bfd_generic_bfd_copy_private_header_data | |
252b5132 RH |
173 | \f |
174 | /*===========================================================================*/ | |
175 | ||
176 | const bfd_target vms_alpha_vec = | |
177 | { | |
252b5132 RH |
178 | "vms-alpha", /* name */ |
179 | bfd_target_evax_flavour, | |
c3c89269 NC |
180 | BFD_ENDIAN_LITTLE, /* data byte order is little */ |
181 | BFD_ENDIAN_LITTLE, /* header byte order is little */ | |
252b5132 RH |
182 | |
183 | (HAS_RELOC | HAS_SYMS | |
184 | | WP_TEXT | D_PAGED), /* object flags */ | |
185 | (SEC_ALLOC | SEC_LOAD | SEC_RELOC | |
186 | | SEC_READONLY | SEC_CODE | SEC_DATA | |
187 | | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */ | |
188 | 0, /* symbol_leading_char */ | |
189 | ' ', /* ar_pad_char */ | |
190 | 15, /* ar_max_namelen */ | |
191 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
192 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
193 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, | |
194 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
195 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
196 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, | |
197 | ||
198 | {_bfd_dummy_target, vms_object_p, /* bfd_check_format */ | |
199 | vms_archive_p, _bfd_dummy_target}, | |
200 | {bfd_false, vms_mkobject, /* bfd_set_format */ | |
201 | _bfd_generic_mkarchive, bfd_false}, | |
202 | {bfd_false, vms_write_object_contents, /* bfd_write_contents */ | |
203 | _bfd_write_archive_contents, bfd_false}, | |
204 | ||
205 | BFD_JUMP_TABLE_GENERIC (vms), | |
206 | BFD_JUMP_TABLE_COPY (vms), | |
207 | BFD_JUMP_TABLE_CORE (vms), | |
208 | BFD_JUMP_TABLE_ARCHIVE (vms), | |
209 | BFD_JUMP_TABLE_SYMBOLS (vms), | |
210 | BFD_JUMP_TABLE_RELOCS (vms), | |
211 | BFD_JUMP_TABLE_WRITE (vms), | |
212 | BFD_JUMP_TABLE_LINK (vms), | |
213 | BFD_JUMP_TABLE_DYNAMIC (vms), | |
214 | ||
c3c89269 | 215 | NULL, |
55f2d5ed | 216 | |
252b5132 RH |
217 | (PTR) 0 |
218 | }; | |
219 | ||
220 | const bfd_target vms_vax_vec = | |
221 | { | |
252b5132 RH |
222 | "vms-vax", /* name */ |
223 | bfd_target_ovax_flavour, | |
c3c89269 NC |
224 | BFD_ENDIAN_LITTLE, /* data byte order is little */ |
225 | BFD_ENDIAN_LITTLE, /* header byte order is little */ | |
252b5132 RH |
226 | |
227 | (HAS_RELOC | HAS_SYMS /* object flags */ | |
228 | | WP_TEXT | D_PAGED | |
229 | | HAS_LINENO | HAS_DEBUG | HAS_LOCALS), | |
230 | ||
231 | (SEC_ALLOC | SEC_LOAD | SEC_RELOC | |
232 | | SEC_READONLY | SEC_CODE | SEC_DATA | |
233 | | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */ | |
234 | 0, /* symbol_leading_char */ | |
235 | ' ', /* ar_pad_char */ | |
236 | 15, /* ar_max_namelen */ | |
237 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
238 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
239 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
240 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
241 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
242 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ | |
243 | ||
244 | {_bfd_dummy_target, vms_object_p, /* bfd_check_format */ | |
245 | vms_archive_p, _bfd_dummy_target}, | |
246 | {bfd_false, vms_mkobject, /* bfd_set_format */ | |
247 | _bfd_generic_mkarchive, bfd_false}, | |
248 | {bfd_false, vms_write_object_contents, /* bfd_write_contents */ | |
249 | _bfd_write_archive_contents, bfd_false}, | |
250 | ||
251 | BFD_JUMP_TABLE_GENERIC (vms), | |
252 | BFD_JUMP_TABLE_COPY (vms), | |
253 | BFD_JUMP_TABLE_CORE (vms), | |
254 | BFD_JUMP_TABLE_ARCHIVE (vms), | |
255 | BFD_JUMP_TABLE_SYMBOLS (vms), | |
256 | BFD_JUMP_TABLE_RELOCS (vms), | |
257 | BFD_JUMP_TABLE_WRITE (vms), | |
258 | BFD_JUMP_TABLE_LINK (vms), | |
259 | BFD_JUMP_TABLE_DYNAMIC (vms), | |
260 | ||
c3c89269 | 261 | NULL, |
55f2d5ed | 262 | |
252b5132 RH |
263 | (PTR) 0 |
264 | }; | |
265 | \f | |
266 | /*===========================================================================*/ | |
267 | ||
268 | /* Initialize private data */ | |
269 | ||
b34976b6 | 270 | static bfd_boolean |
252b5132 RH |
271 | vms_initialize (abfd) |
272 | bfd *abfd; | |
273 | { | |
274 | int i; | |
dc810e39 | 275 | bfd_size_type amt; |
252b5132 | 276 | |
dc810e39 | 277 | bfd_set_start_address (abfd, (bfd_vma) -1); |
252b5132 | 278 | |
dc810e39 | 279 | amt = sizeof (struct vms_private_data_struct); |
487e54f2 | 280 | abfd->tdata.any = (struct vms_private_data_struct*) bfd_alloc (abfd, amt); |
252b5132 | 281 | if (abfd->tdata.any == 0) |
b34976b6 | 282 | return FALSE; |
252b5132 RH |
283 | |
284 | #ifdef __ALPHA | |
8a0c27cd | 285 | PRIV (is_vax) = 0; |
252b5132 | 286 | #else |
8a0c27cd | 287 | PRIV (is_vax) = 1; |
252b5132 | 288 | #endif |
8a0c27cd KH |
289 | PRIV (vms_buf) = 0; |
290 | PRIV (buf_size) = 0; | |
291 | PRIV (rec_length) = 0; | |
292 | PRIV (file_format) = FF_UNKNOWN; | |
b34976b6 | 293 | PRIV (fixup_done) = FALSE; |
8a0c27cd KH |
294 | PRIV (sections) = NULL; |
295 | ||
dc810e39 | 296 | amt = sizeof (struct stack_struct) * STACKSIZE; |
487e54f2 | 297 | PRIV (stack) = (struct stack_struct *) bfd_alloc (abfd, amt); |
8a0c27cd | 298 | if (PRIV (stack) == 0) |
487e54f2 | 299 | goto error_ret1; |
8a0c27cd | 300 | PRIV (stackptr) = 0; |
252b5132 | 301 | |
dc810e39 | 302 | amt = sizeof (struct bfd_hash_table); |
487e54f2 | 303 | PRIV (vms_symbol_table) = (struct bfd_hash_table *) bfd_alloc (abfd, amt); |
8a0c27cd | 304 | if (PRIV (vms_symbol_table) == 0) |
487e54f2 | 305 | goto error_ret1; |
252b5132 | 306 | |
8a0c27cd | 307 | if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc)) |
487e54f2 | 308 | goto error_ret1; |
252b5132 | 309 | |
dc810e39 | 310 | amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE; |
487e54f2 | 311 | PRIV (location_stack) = (struct location_struct *) bfd_alloc (abfd, amt); |
8a0c27cd | 312 | if (PRIV (location_stack) == 0) |
487e54f2 | 313 | goto error_ret2; |
252b5132 RH |
314 | |
315 | for (i = 0; i < VMS_SECTION_COUNT; i++) | |
8a0c27cd | 316 | PRIV (vms_section_table)[i] = NULL; |
252b5132 | 317 | |
487e54f2 AM |
318 | amt = MAX_OUTREC_SIZE; |
319 | PRIV (output_buf) = (unsigned char *) bfd_alloc (abfd, amt); | |
8a0c27cd | 320 | if (PRIV (output_buf) == 0) |
487e54f2 AM |
321 | goto error_ret2; |
322 | ||
8a0c27cd KH |
323 | PRIV (push_level) = 0; |
324 | PRIV (pushed_size) = 0; | |
325 | PRIV (length_pos) = 2; | |
326 | PRIV (output_size) = 0; | |
327 | PRIV (output_alignment) = 1; | |
252b5132 | 328 | |
b34976b6 | 329 | return TRUE; |
487e54f2 AM |
330 | |
331 | error_ret2: | |
332 | bfd_hash_table_free (PRIV (vms_symbol_table)); | |
333 | error_ret1: | |
334 | bfd_release (abfd, abfd->tdata.any); | |
335 | abfd->tdata.any = 0; | |
b34976b6 | 336 | return FALSE; |
252b5132 RH |
337 | } |
338 | ||
252b5132 RH |
339 | /* Fill symbol->section with section ptr |
340 | symbol->section is filled with the section index for defined symbols | |
341 | during reading the GSD/EGSD section. But we need the pointer to the | |
342 | bfd section later. | |
343 | ||
344 | It has the correct value for referenced (undefined section) symbols | |
345 | ||
346 | called from bfd_hash_traverse in vms_fixup_sections */ | |
347 | ||
b34976b6 | 348 | static bfd_boolean |
252b5132 RH |
349 | fill_section_ptr (entry, sections) |
350 | struct bfd_hash_entry *entry; | |
351 | PTR sections; | |
352 | { | |
353 | asection *sec; | |
354 | asymbol *sym; | |
355 | ||
356 | sym = ((vms_symbol_entry *)entry)->symbol; | |
357 | sec = sym->section; | |
358 | ||
359 | #if VMS_DEBUG | |
360 | vms_debug (6, "fill_section_ptr: sym %p, sec %p\n", sym, sec); | |
361 | #endif | |
362 | ||
363 | /* fill forward references (these contain section number, not section ptr). */ | |
364 | ||
5f771d47 | 365 | if ((unsigned int) sec < priv_section_count) |
252b5132 RH |
366 | { |
367 | sec = ((vms_symbol_entry *)entry)->symbol->section = | |
368 | ((asection **)sections)[(int)sec]; | |
369 | } | |
370 | ||
371 | if (strcmp (sym->name, sec->name) == 0) | |
372 | sym->flags |= BSF_SECTION_SYM; | |
373 | ||
b34976b6 | 374 | return TRUE; |
252b5132 RH |
375 | } |
376 | ||
252b5132 RH |
377 | /* Fixup sections |
378 | set up all pointers and arrays, counters and sizes are fixed now | |
379 | ||
380 | we build a private sections vector for easy access since sections | |
381 | are always referenced by an index number. | |
382 | ||
383 | alloc PRIV(sections) according to abfd->section_count | |
384 | copy abfd->sections to PRIV(sections) */ | |
385 | ||
b34976b6 | 386 | static bfd_boolean |
252b5132 RH |
387 | vms_fixup_sections (abfd) |
388 | bfd *abfd; | |
389 | { | |
8a0c27cd | 390 | if (PRIV (fixup_done)) |
b34976b6 | 391 | return TRUE; |
252b5132 RH |
392 | |
393 | /* | |
394 | * traverse symbol table and fill in all section pointers | |
395 | */ | |
396 | ||
397 | /* can't provide section count as argument to fill_section_ptr(). */ | |
8a0c27cd KH |
398 | priv_section_count = PRIV (section_count); |
399 | bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr, | |
400 | (PTR) (PRIV (sections))); | |
252b5132 | 401 | |
b34976b6 | 402 | PRIV (fixup_done) = TRUE; |
252b5132 | 403 | |
b34976b6 | 404 | return TRUE; |
252b5132 RH |
405 | } |
406 | ||
407 | /*===========================================================================*/ | |
408 | ||
409 | /* Check the format for a file being read. | |
410 | Return a (bfd_target *) if it's an object file or zero if not. */ | |
411 | ||
412 | static const struct bfd_target * | |
413 | vms_object_p (abfd) | |
414 | bfd *abfd; | |
415 | { | |
416 | int err = 0; | |
417 | int prev_type; | |
418 | const struct bfd_target *target_vector = 0; | |
419 | const bfd_arch_info_type *arch = 0; | |
487e54f2 | 420 | PTR tdata_save = abfd->tdata.any; |
5e9aae3e | 421 | bfd_vma saddr_save = bfd_get_start_address (abfd); |
252b5132 RH |
422 | |
423 | #if VMS_DEBUG | |
424 | vms_debug (1, "vms_object_p(%p)\n", abfd); | |
425 | #endif | |
426 | ||
427 | if (!vms_initialize (abfd)) | |
487e54f2 | 428 | goto error_ret; |
252b5132 | 429 | |
dc810e39 | 430 | if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET)) |
487e54f2 | 431 | goto err_wrong_format; |
252b5132 RH |
432 | |
433 | prev_type = -1; | |
434 | ||
435 | do | |
436 | { | |
437 | #if VMS_DEBUG | |
438 | vms_debug (7, "reading at %08lx\n", bfd_tell(abfd)); | |
439 | #endif | |
440 | if (_bfd_vms_next_record (abfd) < 0) | |
441 | { | |
442 | #if VMS_DEBUG | |
55f2d5ed | 443 | vms_debug (2, "next_record failed\n"); |
252b5132 | 444 | #endif |
487e54f2 | 445 | goto err_wrong_format; |
252b5132 RH |
446 | } |
447 | ||
448 | if ((prev_type == EOBJ_S_C_EGSD) | |
8a0c27cd | 449 | && (PRIV (rec_type) != EOBJ_S_C_EGSD)) |
252b5132 | 450 | { |
82e51918 | 451 | if (! vms_fixup_sections (abfd)) |
252b5132 RH |
452 | { |
453 | #if VMS_DEBUG | |
454 | vms_debug (2, "vms_fixup_sections failed\n"); | |
455 | #endif | |
487e54f2 | 456 | goto err_wrong_format; |
252b5132 RH |
457 | } |
458 | } | |
459 | ||
8a0c27cd | 460 | prev_type = PRIV (rec_type); |
252b5132 RH |
461 | |
462 | if (target_vector == 0) | |
463 | { | |
464 | if (prev_type <= OBJ_S_C_MAXRECTYP) | |
465 | target_vector = &vms_vax_vec; | |
466 | else | |
467 | target_vector = &vms_alpha_vec; | |
468 | } | |
469 | ||
470 | switch (prev_type) | |
471 | { | |
472 | case OBJ_S_C_HDR: | |
473 | case EOBJ_S_C_EMH: | |
474 | err = _bfd_vms_slurp_hdr (abfd, prev_type); | |
475 | break; | |
476 | case OBJ_S_C_EOM: | |
477 | case OBJ_S_C_EOMW: | |
478 | case EOBJ_S_C_EEOM: | |
479 | err = _bfd_vms_slurp_eom (abfd, prev_type); | |
480 | break; | |
481 | case OBJ_S_C_GSD: | |
482 | case EOBJ_S_C_EGSD: | |
483 | err = _bfd_vms_slurp_gsd (abfd, prev_type); | |
484 | break; | |
485 | case OBJ_S_C_TIR: | |
486 | case EOBJ_S_C_ETIR: | |
487 | err = _bfd_vms_slurp_tir (abfd, prev_type); | |
488 | break; | |
489 | case OBJ_S_C_DBG: | |
490 | case EOBJ_S_C_EDBG: | |
491 | err = _bfd_vms_slurp_dbg (abfd, prev_type); | |
492 | break; | |
493 | case OBJ_S_C_TBT: | |
494 | case EOBJ_S_C_ETBT: | |
495 | err = _bfd_vms_slurp_tbt (abfd, prev_type); | |
496 | break; | |
497 | case OBJ_S_C_LNK: | |
498 | err = _bfd_vms_slurp_lnk (abfd, prev_type); | |
499 | break; | |
500 | default: | |
501 | err = -1; | |
502 | } | |
503 | if (err != 0) | |
504 | { | |
505 | #if VMS_DEBUG | |
506 | vms_debug (2, "slurp type %d failed with %d\n", prev_type, err); | |
507 | #endif | |
487e54f2 | 508 | goto err_wrong_format; |
252b5132 RH |
509 | } |
510 | } | |
511 | while ((prev_type != EOBJ_S_C_EEOM) && (prev_type != OBJ_S_C_EOM) && (prev_type != OBJ_S_C_EOMW)); | |
512 | ||
513 | if (target_vector == &vms_vax_vec) | |
514 | { | |
82e51918 | 515 | if (! vms_fixup_sections (abfd)) |
252b5132 RH |
516 | { |
517 | #if VMS_DEBUG | |
518 | vms_debug (2, "vms_fixup_sections failed\n"); | |
519 | #endif | |
487e54f2 | 520 | goto err_wrong_format; |
252b5132 RH |
521 | } |
522 | ||
523 | /* set arch_info to vax */ | |
55f2d5ed | 524 | |
252b5132 RH |
525 | arch = bfd_scan_arch ("vax"); |
526 | PRIV (is_vax) = 1; | |
527 | #if VMS_DEBUG | |
528 | vms_debug (2, "arch is vax\n"); | |
529 | #endif | |
530 | } | |
531 | else if (target_vector == &vms_alpha_vec) | |
532 | { | |
533 | /* set arch_info to alpha */ | |
55f2d5ed | 534 | |
252b5132 RH |
535 | arch = bfd_scan_arch ("alpha"); |
536 | PRIV (is_vax) = 0; | |
537 | #if VMS_DEBUG | |
538 | vms_debug (2, "arch is alpha\n"); | |
539 | #endif | |
540 | } | |
541 | ||
542 | if (arch == 0) | |
543 | { | |
544 | #if VMS_DEBUG | |
545 | vms_debug (2, "arch not found\n"); | |
546 | #endif | |
487e54f2 | 547 | goto err_wrong_format; |
252b5132 RH |
548 | } |
549 | abfd->arch_info = arch; | |
550 | ||
551 | return target_vector; | |
487e54f2 AM |
552 | |
553 | err_wrong_format: | |
554 | bfd_set_error (bfd_error_wrong_format); | |
555 | error_ret: | |
556 | if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL) | |
557 | bfd_release (abfd, abfd->tdata.any); | |
558 | abfd->tdata.any = tdata_save; | |
5e9aae3e | 559 | bfd_set_start_address (abfd, saddr_save); |
487e54f2 | 560 | return NULL; |
252b5132 RH |
561 | } |
562 | ||
252b5132 RH |
563 | /* Check the format for a file being read. |
564 | Return a (bfd_target *) if it's an archive file or zero. */ | |
565 | ||
566 | static const struct bfd_target * | |
567 | vms_archive_p (abfd) | |
5f771d47 | 568 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
569 | { |
570 | #if VMS_DEBUG | |
571 | vms_debug (1, "vms_archive_p(%p)\n", abfd); | |
572 | #endif | |
573 | ||
574 | return 0; | |
575 | } | |
576 | ||
252b5132 RH |
577 | /* Set the format of a file being written. */ |
578 | ||
b34976b6 | 579 | static bfd_boolean |
252b5132 RH |
580 | vms_mkobject (abfd) |
581 | bfd *abfd; | |
582 | { | |
583 | #if VMS_DEBUG | |
584 | vms_debug (1, "vms_mkobject(%p)\n", abfd); | |
585 | #endif | |
586 | ||
587 | if (!vms_initialize (abfd)) | |
487e54f2 | 588 | return 0; |
252b5132 RH |
589 | |
590 | { | |
591 | #ifdef __VAX | |
592 | const bfd_arch_info_type *arch = bfd_scan_arch ("vax"); | |
593 | #else | |
594 | const bfd_arch_info_type *arch = bfd_scan_arch ("alpha"); | |
595 | #endif | |
596 | if (arch == 0) | |
597 | { | |
598 | bfd_set_error(bfd_error_wrong_format); | |
599 | return 0; | |
600 | } | |
601 | abfd->arch_info = arch; | |
602 | } | |
603 | ||
b34976b6 | 604 | return TRUE; |
252b5132 RH |
605 | } |
606 | ||
252b5132 RH |
607 | /* Write cached information into a file being written, at bfd_close. */ |
608 | ||
b34976b6 | 609 | static bfd_boolean |
252b5132 RH |
610 | vms_write_object_contents (abfd) |
611 | bfd *abfd; | |
612 | { | |
613 | #if VMS_DEBUG | |
614 | vms_debug (1, "vms_write_object_contents(%p)\n", abfd); | |
615 | #endif | |
616 | ||
617 | if (abfd->section_count > 0) /* we have sections */ | |
618 | { | |
8a0c27cd | 619 | if (PRIV (is_vax)) |
252b5132 RH |
620 | { |
621 | if (_bfd_vms_write_hdr (abfd, OBJ_S_C_HDR) != 0) | |
b34976b6 | 622 | return FALSE; |
252b5132 | 623 | if (_bfd_vms_write_gsd (abfd, OBJ_S_C_GSD) != 0) |
b34976b6 | 624 | return FALSE; |
252b5132 | 625 | if (_bfd_vms_write_tir (abfd, OBJ_S_C_TIR) != 0) |
b34976b6 | 626 | return FALSE; |
252b5132 | 627 | if (_bfd_vms_write_tbt (abfd, OBJ_S_C_TBT) != 0) |
b34976b6 | 628 | return FALSE; |
252b5132 | 629 | if (_bfd_vms_write_dbg (abfd, OBJ_S_C_DBG) != 0) |
b34976b6 | 630 | return FALSE; |
252b5132 RH |
631 | if (abfd->section_count > 255) |
632 | { | |
633 | if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOMW) != 0) | |
b34976b6 | 634 | return FALSE; |
252b5132 RH |
635 | } |
636 | else | |
637 | { | |
638 | if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOM) != 0) | |
b34976b6 | 639 | return FALSE; |
252b5132 RH |
640 | } |
641 | } | |
642 | else | |
643 | { | |
644 | if (_bfd_vms_write_hdr (abfd, EOBJ_S_C_EMH) != 0) | |
b34976b6 | 645 | return FALSE; |
252b5132 | 646 | if (_bfd_vms_write_gsd (abfd, EOBJ_S_C_EGSD) != 0) |
b34976b6 | 647 | return FALSE; |
252b5132 | 648 | if (_bfd_vms_write_tir (abfd, EOBJ_S_C_ETIR) != 0) |
b34976b6 | 649 | return FALSE; |
252b5132 | 650 | if (_bfd_vms_write_tbt (abfd, EOBJ_S_C_ETBT) != 0) |
b34976b6 | 651 | return FALSE; |
252b5132 | 652 | if (_bfd_vms_write_dbg (abfd, EOBJ_S_C_EDBG) != 0) |
b34976b6 | 653 | return FALSE; |
252b5132 | 654 | if (_bfd_vms_write_eom (abfd, EOBJ_S_C_EEOM) != 0) |
b34976b6 | 655 | return FALSE; |
252b5132 RH |
656 | } |
657 | } | |
b34976b6 | 658 | return TRUE; |
252b5132 RH |
659 | } |
660 | ||
661 | /*-- 4.1, generic -----------------------------------------------------------*/ | |
662 | ||
663 | /* Called when the BFD is being closed to do any necessary cleanup. */ | |
664 | ||
b34976b6 | 665 | static bfd_boolean |
252b5132 RH |
666 | vms_close_and_cleanup (abfd) |
667 | bfd *abfd; | |
668 | { | |
252b5132 RH |
669 | #if VMS_DEBUG |
670 | vms_debug (1, "vms_close_and_cleanup(%p)\n", abfd); | |
671 | #endif | |
672 | if (abfd == 0) | |
b34976b6 | 673 | return TRUE; |
252b5132 | 674 | |
8a0c27cd | 675 | if (PRIV (vms_buf) != NULL) |
487e54f2 | 676 | free (PRIV (vms_buf)); |
252b5132 | 677 | |
8a0c27cd | 678 | if (PRIV (sections) != NULL) |
487e54f2 | 679 | free (PRIV (sections)); |
252b5132 | 680 | |
8a0c27cd | 681 | if (PRIV (vms_symbol_table)) |
487e54f2 | 682 | bfd_hash_table_free (PRIV (vms_symbol_table)); |
252b5132 | 683 | |
487e54f2 | 684 | bfd_release (abfd, abfd->tdata.any); |
252b5132 RH |
685 | abfd->tdata.any = NULL; |
686 | ||
b34976b6 | 687 | return TRUE; |
252b5132 RH |
688 | } |
689 | ||
252b5132 | 690 | /* Ask the BFD to free all cached information. */ |
b34976b6 | 691 | static bfd_boolean |
252b5132 | 692 | vms_bfd_free_cached_info (abfd) |
5f771d47 | 693 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
694 | { |
695 | #if VMS_DEBUG | |
696 | vms_debug (1, "vms_bfd_free_cached_info(%p)\n", abfd); | |
697 | #endif | |
b34976b6 | 698 | return TRUE; |
252b5132 RH |
699 | } |
700 | ||
252b5132 RH |
701 | /* Called when a new section is created. */ |
702 | ||
b34976b6 | 703 | static bfd_boolean |
252b5132 RH |
704 | vms_new_section_hook (abfd, section) |
705 | bfd *abfd; | |
706 | asection *section; | |
707 | { | |
4e6bfe8a AM |
708 | /* Count hasn't been incremented yet. */ |
709 | unsigned int section_count = abfd->section_count + 1; | |
710 | ||
252b5132 | 711 | #if VMS_DEBUG |
4e6bfe8a AM |
712 | vms_debug (1, "vms_new_section_hook (%p, [%d]%s), count %d\n", |
713 | abfd, section->index, section->name, section_count); | |
252b5132 | 714 | #endif |
4e6bfe8a | 715 | bfd_set_section_alignment (abfd, section, 4); |
252b5132 | 716 | |
4e6bfe8a | 717 | if (section_count > PRIV (section_count)) |
252b5132 | 718 | { |
4e6bfe8a | 719 | bfd_size_type amt = section_count; |
dc810e39 AM |
720 | amt *= sizeof (asection *); |
721 | PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt); | |
8a0c27cd | 722 | if (PRIV (sections) == 0) |
b34976b6 | 723 | return FALSE; |
4e6bfe8a | 724 | PRIV (section_count) = section_count; |
252b5132 RH |
725 | } |
726 | #if VMS_DEBUG | |
8a0c27cd | 727 | vms_debug (6, "section_count: %d\n", PRIV (section_count)); |
252b5132 | 728 | #endif |
8a0c27cd | 729 | PRIV (sections)[section->index] = section; |
252b5132 RH |
730 | #if VMS_DEBUG |
731 | vms_debug (7, "%d: %s\n", section->index, section->name); | |
732 | #endif | |
733 | ||
b34976b6 | 734 | return TRUE; |
252b5132 RH |
735 | } |
736 | ||
252b5132 RH |
737 | /* Read the contents of a section. |
738 | buf points to a buffer of buf_size bytes to be filled with | |
739 | section data (starting at offset into section) */ | |
740 | ||
b34976b6 | 741 | static bfd_boolean |
252b5132 | 742 | vms_get_section_contents (abfd, section, buf, offset, buf_size) |
5f771d47 ILT |
743 | bfd *abfd ATTRIBUTE_UNUSED; |
744 | asection *section ATTRIBUTE_UNUSED; | |
745 | PTR buf ATTRIBUTE_UNUSED; | |
746 | file_ptr offset ATTRIBUTE_UNUSED; | |
747 | bfd_size_type buf_size ATTRIBUTE_UNUSED; | |
252b5132 RH |
748 | { |
749 | #if VMS_DEBUG | |
750 | vms_debug (1, "vms_get_section_contents(%p, %s, %p, off %ld, size %d)\n", | |
751 | abfd, section->name, buf, offset, (int)buf_size); | |
752 | #endif | |
753 | ||
754 | /* shouldn't be called, since all sections are IN_MEMORY */ | |
755 | ||
b34976b6 | 756 | return FALSE; |
252b5132 RH |
757 | } |
758 | ||
759 | /* Read the contents of a section. | |
760 | buf points to a buffer of buf_size bytes to be filled with | |
761 | section data (starting at offset into section) */ | |
762 | ||
b34976b6 | 763 | static bfd_boolean |
252b5132 | 764 | vms_get_section_contents_in_window (abfd, section, w, offset, count) |
5f771d47 ILT |
765 | bfd *abfd ATTRIBUTE_UNUSED; |
766 | asection *section ATTRIBUTE_UNUSED; | |
767 | bfd_window *w ATTRIBUTE_UNUSED; | |
768 | file_ptr offset ATTRIBUTE_UNUSED; | |
769 | bfd_size_type count ATTRIBUTE_UNUSED; | |
252b5132 RH |
770 | { |
771 | #if VMS_DEBUG | |
772 | vms_debug (1, "vms_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n", | |
773 | abfd, section->name, w, offset, (int)count); | |
774 | #endif | |
775 | ||
776 | /* shouldn't be called, since all sections are IN_MEMORY */ | |
777 | ||
b34976b6 | 778 | return FALSE; |
252b5132 RH |
779 | } |
780 | ||
781 | /*-- Part 4.2, copy private data --------------------------------------------*/ | |
782 | ||
783 | /* Called to copy BFD general private data from one object file | |
784 | to another. */ | |
785 | ||
b34976b6 | 786 | static bfd_boolean |
252b5132 | 787 | vms_bfd_copy_private_bfd_data (src, dest) |
5f771d47 ILT |
788 | bfd *src ATTRIBUTE_UNUSED; |
789 | bfd *dest ATTRIBUTE_UNUSED; | |
252b5132 RH |
790 | { |
791 | #if VMS_DEBUG | |
792 | vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest); | |
793 | #endif | |
b34976b6 | 794 | return TRUE; |
252b5132 RH |
795 | } |
796 | ||
252b5132 | 797 | /* Merge private BFD information from the BFD @var{ibfd} to the |
b34976b6 AM |
798 | the output file BFD @var{obfd} when linking. Return <<TRUE>> |
799 | on success, <<FALSE>> on error. Possible error returns are: | |
252b5132 RH |
800 | |
801 | o <<bfd_error_no_memory>> - | |
802 | Not enough memory exists to create private data for @var{obfd}. */ | |
803 | ||
b34976b6 | 804 | static bfd_boolean |
252b5132 | 805 | vms_bfd_merge_private_bfd_data (ibfd, obfd) |
5f771d47 ILT |
806 | bfd *ibfd ATTRIBUTE_UNUSED; |
807 | bfd *obfd ATTRIBUTE_UNUSED; | |
252b5132 RH |
808 | { |
809 | #if VMS_DEBUG | |
810 | vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd); | |
811 | #endif | |
b34976b6 | 812 | return TRUE; |
252b5132 RH |
813 | } |
814 | ||
252b5132 | 815 | /* Set private BFD flag information in the BFD @var{abfd}. |
b34976b6 | 816 | Return <<TRUE>> on success, <<FALSE>> on error. Possible error |
252b5132 RH |
817 | returns are: |
818 | ||
819 | o <<bfd_error_no_memory>> - | |
820 | Not enough memory exists to create private data for @var{obfd}. */ | |
821 | ||
b34976b6 | 822 | static bfd_boolean |
252b5132 | 823 | vms_bfd_set_private_flags (abfd, flags) |
5f771d47 ILT |
824 | bfd *abfd ATTRIBUTE_UNUSED; |
825 | flagword flags ATTRIBUTE_UNUSED; | |
252b5132 RH |
826 | { |
827 | #if VMS_DEBUG | |
828 | vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags); | |
829 | #endif | |
b34976b6 | 830 | return TRUE; |
252b5132 RH |
831 | } |
832 | ||
252b5132 RH |
833 | /* Called to copy BFD private section data from one object file |
834 | to another. */ | |
835 | ||
b34976b6 | 836 | static bfd_boolean |
252b5132 | 837 | vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec) |
5f771d47 ILT |
838 | bfd *srcbfd ATTRIBUTE_UNUSED; |
839 | asection *srcsec ATTRIBUTE_UNUSED; | |
840 | bfd *dstbfd ATTRIBUTE_UNUSED; | |
841 | asection *dstsec ATTRIBUTE_UNUSED; | |
252b5132 RH |
842 | { |
843 | #if VMS_DEBUG | |
844 | vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n", | |
845 | srcbfd, srcsec->name, dstbfd, dstsec->name); | |
846 | #endif | |
b34976b6 | 847 | return TRUE; |
252b5132 RH |
848 | } |
849 | ||
850 | /* Called to copy BFD private symbol data from one object file | |
851 | to another. */ | |
852 | ||
b34976b6 | 853 | static bfd_boolean |
252b5132 | 854 | vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym) |
5f771d47 ILT |
855 | bfd *ibfd ATTRIBUTE_UNUSED; |
856 | asymbol *isym ATTRIBUTE_UNUSED; | |
857 | bfd *obfd ATTRIBUTE_UNUSED; | |
858 | asymbol *osym ATTRIBUTE_UNUSED; | |
252b5132 RH |
859 | { |
860 | #if VMS_DEBUG | |
861 | vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n", | |
862 | ibfd, isym->name, obfd, osym->name); | |
863 | #endif | |
b34976b6 | 864 | return TRUE; |
252b5132 RH |
865 | } |
866 | ||
867 | /*-- Part 4.3, core file ----------------------------------------------------*/ | |
868 | ||
869 | /* Return a read-only string explaining which program was running | |
870 | when it failed and produced the core file abfd. */ | |
871 | ||
872 | static char * | |
873 | vms_core_file_failing_command (abfd) | |
5f771d47 | 874 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
875 | { |
876 | #if VMS_DEBUG | |
877 | vms_debug (1, "vms_core_file_failing_command(%p)\n", abfd); | |
878 | #endif | |
879 | return 0; | |
880 | } | |
881 | ||
252b5132 RH |
882 | /* Returns the signal number which caused the core dump which |
883 | generated the file the BFD abfd is attached to. */ | |
884 | ||
885 | static int | |
886 | vms_core_file_failing_signal (abfd) | |
5f771d47 | 887 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
888 | { |
889 | #if VMS_DEBUG | |
890 | vms_debug (1, "vms_core_file_failing_signal(%p)\n", abfd); | |
891 | #endif | |
892 | return 0; | |
893 | } | |
894 | ||
b34976b6 AM |
895 | /* Return TRUE if the core file attached to core_bfd was generated |
896 | by a run of the executable file attached to exec_bfd, FALSE otherwise. */ | |
252b5132 | 897 | |
b34976b6 | 898 | static bfd_boolean |
252b5132 | 899 | vms_core_file_matches_executable_p (abfd, bbfd) |
5f771d47 ILT |
900 | bfd *abfd ATTRIBUTE_UNUSED; |
901 | bfd *bbfd ATTRIBUTE_UNUSED; | |
252b5132 RH |
902 | { |
903 | #if VMS_DEBUG | |
904 | vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd); | |
905 | #endif | |
b34976b6 | 906 | return FALSE; |
252b5132 RH |
907 | } |
908 | ||
909 | /*-- Part 4.4, archive ------------------------------------------------------*/ | |
910 | ||
911 | /* ??? do something with an archive map. | |
b34976b6 | 912 | Return FALSE on error, TRUE otherwise. */ |
252b5132 | 913 | |
b34976b6 | 914 | static bfd_boolean |
252b5132 | 915 | vms_slurp_armap (abfd) |
5f771d47 | 916 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
917 | { |
918 | #if VMS_DEBUG | |
919 | vms_debug (1, "vms_slurp_armap(%p)\n", abfd); | |
920 | #endif | |
b34976b6 | 921 | return FALSE; |
252b5132 RH |
922 | } |
923 | ||
252b5132 | 924 | /* ??? do something with an extended name table. |
b34976b6 | 925 | Return FALSE on error, TRUE otherwise. */ |
252b5132 | 926 | |
b34976b6 | 927 | static bfd_boolean |
252b5132 | 928 | vms_slurp_extended_name_table (abfd) |
5f771d47 | 929 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
930 | { |
931 | #if VMS_DEBUG | |
932 | vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd); | |
933 | #endif | |
b34976b6 | 934 | return FALSE; |
252b5132 RH |
935 | } |
936 | ||
252b5132 | 937 | /* ??? do something with an extended name table. |
b34976b6 | 938 | Return FALSE on error, TRUE otherwise. */ |
252b5132 | 939 | |
b34976b6 | 940 | static bfd_boolean |
252b5132 | 941 | vms_construct_extended_name_table (abfd, tabloc, tablen, name) |
5f771d47 ILT |
942 | bfd *abfd ATTRIBUTE_UNUSED; |
943 | char **tabloc ATTRIBUTE_UNUSED; | |
944 | bfd_size_type *tablen ATTRIBUTE_UNUSED; | |
945 | const char **name ATTRIBUTE_UNUSED; | |
252b5132 RH |
946 | { |
947 | #if VMS_DEBUG | |
948 | vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd); | |
949 | #endif | |
b34976b6 | 950 | return FALSE; |
252b5132 RH |
951 | } |
952 | ||
252b5132 RH |
953 | /* Truncate the name of an archive to match system-dependent restrictions */ |
954 | ||
955 | static void | |
956 | vms_truncate_arname (abfd, pathname, arhdr) | |
5f771d47 | 957 | bfd *abfd ATTRIBUTE_UNUSED; |
dc810e39 | 958 | const char *pathname ATTRIBUTE_UNUSED; |
5f771d47 | 959 | char *arhdr ATTRIBUTE_UNUSED; |
252b5132 RH |
960 | { |
961 | #if VMS_DEBUG | |
962 | vms_debug (1, "vms_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr); | |
963 | #endif | |
964 | return; | |
965 | } | |
966 | ||
252b5132 RH |
967 | /* ??? write archive map */ |
968 | ||
b34976b6 | 969 | static bfd_boolean |
252b5132 | 970 | vms_write_armap (arch, elength, map, orl_count, stridx) |
5f771d47 ILT |
971 | bfd *arch ATTRIBUTE_UNUSED; |
972 | unsigned int elength ATTRIBUTE_UNUSED; | |
973 | struct orl *map ATTRIBUTE_UNUSED; | |
974 | unsigned int orl_count ATTRIBUTE_UNUSED; | |
975 | int stridx ATTRIBUTE_UNUSED; | |
252b5132 RH |
976 | { |
977 | #if VMS_DEBUG | |
978 | vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n", | |
979 | arch, elength, map, orl_count, stridx); | |
980 | #endif | |
b34976b6 | 981 | return TRUE; |
252b5132 RH |
982 | } |
983 | ||
984 | /* Read archive header ??? */ | |
985 | ||
986 | static PTR | |
987 | vms_read_ar_hdr (abfd) | |
5f771d47 | 988 | bfd * abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
989 | { |
990 | #if VMS_DEBUG | |
991 | vms_debug (1, "vms_read_ar_hdr(%p)\n", abfd); | |
992 | #endif | |
993 | return (PTR)0; | |
994 | } | |
995 | ||
252b5132 RH |
996 | /* Provided a BFD, @var{archive}, containing an archive and NULL, open |
997 | an input BFD on the first contained element and returns that. | |
998 | Subsequent calls should pass the archive and the previous return value | |
999 | to return a created BFD to the next contained element. | |
1000 | NULL is returned when there are no more. */ | |
1001 | ||
1002 | static bfd * | |
1003 | vms_openr_next_archived_file (arch, prev) | |
5f771d47 ILT |
1004 | bfd *arch ATTRIBUTE_UNUSED; |
1005 | bfd *prev ATTRIBUTE_UNUSED; | |
252b5132 RH |
1006 | { |
1007 | #if VMS_DEBUG | |
1008 | vms_debug (1, "vms_openr_next_archived_file(%p, %p)\n", arch, prev); | |
1009 | #endif | |
01fff6e2 | 1010 | return NULL; |
252b5132 RH |
1011 | } |
1012 | ||
252b5132 RH |
1013 | /* Return the BFD which is referenced by the symbol in ABFD indexed by |
1014 | INDEX. INDEX should have been returned by bfd_get_next_mapent. */ | |
1015 | ||
1016 | static bfd * | |
1017 | vms_get_elt_at_index (abfd, index) | |
1018 | bfd *abfd; | |
1019 | symindex index; | |
1020 | { | |
1021 | #if VMS_DEBUG | |
1022 | vms_debug (1, "vms_get_elt_at_index(%p, %p)\n", abfd, index); | |
1023 | #endif | |
1024 | return _bfd_generic_get_elt_at_index(abfd, index); | |
1025 | } | |
1026 | ||
252b5132 RH |
1027 | /* ??? |
1028 | -> bfd_generic_stat_arch_elt */ | |
1029 | ||
1030 | static int | |
dc810e39 | 1031 | vms_generic_stat_arch_elt (abfd, st) |
252b5132 | 1032 | bfd *abfd; |
dc810e39 | 1033 | struct stat *st; |
252b5132 RH |
1034 | { |
1035 | #if VMS_DEBUG | |
dc810e39 | 1036 | vms_debug (1, "vms_generic_stat_arch_elt(%p, %p)\n", abfd, st); |
252b5132 | 1037 | #endif |
dc810e39 | 1038 | return bfd_generic_stat_arch_elt (abfd, st); |
252b5132 RH |
1039 | } |
1040 | ||
252b5132 RH |
1041 | /* This is a new function in bfd 2.5 */ |
1042 | ||
b34976b6 | 1043 | static bfd_boolean |
252b5132 | 1044 | vms_update_armap_timestamp (abfd) |
5f771d47 | 1045 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
1046 | { |
1047 | #if VMS_DEBUG | |
1048 | vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd); | |
1049 | #endif | |
b34976b6 | 1050 | return TRUE; |
252b5132 RH |
1051 | } |
1052 | ||
1053 | /*-- Part 4.5, symbols --------------------------------------------------------*/ | |
1054 | ||
1055 | /* Return the number of bytes required to store a vector of pointers | |
1056 | to asymbols for all the symbols in the BFD abfd, including a | |
1057 | terminal NULL pointer. If there are no symbols in the BFD, | |
1058 | then return 0. If an error occurs, return -1. */ | |
1059 | ||
1060 | static long | |
1061 | vms_get_symtab_upper_bound (abfd) | |
1062 | bfd *abfd; | |
1063 | { | |
1064 | #if VMS_DEBUG | |
8a0c27cd | 1065 | vms_debug (1, "vms_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV (gsd_sym_count)); |
252b5132 | 1066 | #endif |
8a0c27cd | 1067 | return (PRIV (gsd_sym_count)+1) * sizeof (asymbol *); |
252b5132 RH |
1068 | } |
1069 | ||
252b5132 RH |
1070 | /* Copy symbols from hash table to symbol vector |
1071 | ||
6cee3f79 | 1072 | called from bfd_hash_traverse in vms_canonicalize_symtab |
252b5132 RH |
1073 | init counter to 0 if entry == 0 */ |
1074 | ||
b34976b6 | 1075 | static bfd_boolean |
252b5132 RH |
1076 | copy_symbols (entry, arg) |
1077 | struct bfd_hash_entry *entry; | |
1078 | PTR arg; | |
1079 | { | |
1080 | bfd *abfd = (bfd *) arg; | |
1081 | ||
1082 | if (entry == NULL) /* init counter */ | |
8a0c27cd | 1083 | PRIV (symnum) = 0; |
252b5132 | 1084 | else /* fill vector, inc counter */ |
8a0c27cd | 1085 | PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol; |
252b5132 | 1086 | |
b34976b6 | 1087 | return TRUE; |
252b5132 RH |
1088 | } |
1089 | ||
252b5132 RH |
1090 | /* Read the symbols from the BFD abfd, and fills in the vector |
1091 | location with pointers to the symbols and a trailing NULL. | |
1092 | ||
1093 | return # of symbols read */ | |
1094 | ||
1095 | static long | |
6cee3f79 | 1096 | vms_canonicalize_symtab (abfd, symbols) |
252b5132 RH |
1097 | bfd *abfd; |
1098 | asymbol **symbols; | |
1099 | { | |
1100 | #if VMS_DEBUG | |
6cee3f79 | 1101 | vms_debug (1, "vms_canonicalize_symtab(%p, <ret>)\n", abfd); |
252b5132 RH |
1102 | #endif |
1103 | ||
1104 | /* init counter */ | |
1105 | (void)copy_symbols((struct bfd_hash_entry *)0, abfd); | |
1106 | ||
1107 | /* traverse table and fill symbols vector */ | |
1108 | ||
8a0c27cd KH |
1109 | PRIV (symcache) = symbols; |
1110 | bfd_hash_traverse(PRIV (vms_symbol_table), copy_symbols, (PTR)abfd); | |
252b5132 | 1111 | |
8a0c27cd | 1112 | symbols[PRIV (gsd_sym_count)] = NULL; |
252b5132 | 1113 | |
8a0c27cd | 1114 | return PRIV (gsd_sym_count); |
252b5132 RH |
1115 | } |
1116 | ||
252b5132 RH |
1117 | /* Print symbol to file according to how. how is one of |
1118 | bfd_print_symbol_name just print the name | |
1119 | bfd_print_symbol_more print more (???) | |
1120 | bfd_print_symbol_all print all we know, which is not much right now :-) */ | |
1121 | ||
1122 | static void | |
1123 | vms_print_symbol (abfd, file, symbol, how) | |
60b89a18 | 1124 | bfd *abfd; |
252b5132 RH |
1125 | PTR file; |
1126 | asymbol *symbol; | |
1127 | bfd_print_symbol_type how; | |
1128 | { | |
1129 | #if VMS_DEBUG | |
1130 | vms_debug (1, "vms_print_symbol(%p, %p, %p, %d)\n", abfd, file, symbol, how); | |
1131 | #endif | |
1132 | ||
1133 | switch (how) | |
1134 | { | |
1135 | case bfd_print_symbol_name: | |
1136 | case bfd_print_symbol_more: | |
55f2d5ed | 1137 | fprintf ((FILE *)file," %s", symbol->name); |
252b5132 RH |
1138 | break; |
1139 | ||
252b5132 RH |
1140 | case bfd_print_symbol_all: |
1141 | { | |
dc810e39 | 1142 | const char *section_name = symbol->section->name; |
252b5132 | 1143 | |
60b89a18 | 1144 | bfd_print_symbol_vandf (abfd, (PTR)file, symbol); |
252b5132 | 1145 | |
55f2d5ed | 1146 | fprintf ((FILE *)file," %-8s %s", section_name, symbol->name); |
252b5132 RH |
1147 | } |
1148 | break; | |
1149 | } | |
1150 | return; | |
1151 | } | |
1152 | ||
252b5132 RH |
1153 | /* Return information about symbol in ret. |
1154 | ||
1155 | fill type, value and name | |
1156 | type: | |
1157 | A absolute | |
1158 | B bss segment symbol | |
1159 | C common symbol | |
1160 | D data segment symbol | |
1161 | f filename | |
1162 | t a static function symbol | |
1163 | T text segment symbol | |
1164 | U undefined | |
1165 | - debug */ | |
1166 | ||
1167 | static void | |
1168 | vms_get_symbol_info (abfd, symbol, ret) | |
5f771d47 | 1169 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
1170 | asymbol *symbol; |
1171 | symbol_info *ret; | |
1172 | { | |
1173 | asection *sec; | |
1174 | ||
1175 | #if VMS_DEBUG | |
1176 | vms_debug (1, "vms_get_symbol_info(%p, %p, %p)\n", abfd, symbol, ret); | |
1177 | #endif | |
1178 | ||
1179 | sec = symbol->section; | |
1180 | ||
1181 | if (ret == 0) | |
1182 | return; | |
1183 | ||
1184 | if (bfd_is_com_section (sec)) | |
1185 | ret->type = 'C'; | |
1186 | else if (bfd_is_abs_section (sec)) | |
1187 | ret->type = 'A'; | |
1188 | else if (bfd_is_und_section (sec)) | |
1189 | ret->type = 'U'; | |
1190 | else if (bfd_is_ind_section (sec)) | |
1191 | ret->type = 'I'; | |
1192 | else if (bfd_get_section_flags (abfd, sec) & SEC_CODE) | |
1193 | ret->type = 'T'; | |
1194 | else if (bfd_get_section_flags (abfd, sec) & SEC_DATA) | |
1195 | ret->type = 'D'; | |
1196 | else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) | |
1197 | ret->type = 'B'; | |
1198 | else | |
1199 | ret->type = '-'; | |
1200 | ||
1201 | if (ret->type != 'U') | |
1202 | ret->value = symbol->value + symbol->section->vma; | |
1203 | else | |
1204 | ret->value = 0; | |
1205 | ret->name = symbol->name; | |
1206 | ||
1207 | return; | |
1208 | } | |
1209 | ||
b34976b6 AM |
1210 | /* Return TRUE if the given symbol sym in the BFD abfd is |
1211 | a compiler generated local label, else return FALSE. */ | |
252b5132 | 1212 | |
b34976b6 | 1213 | static bfd_boolean |
252b5132 | 1214 | vms_bfd_is_local_label_name (abfd, name) |
5f771d47 | 1215 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
1216 | const char *name; |
1217 | { | |
1218 | #if VMS_DEBUG | |
1219 | vms_debug (1, "vms_bfd_is_local_label_name(%p, %s)\n", abfd, name); | |
1220 | #endif | |
1221 | return name[0] == '$'; | |
1222 | } | |
1223 | ||
252b5132 RH |
1224 | /* Get source line number for symbol */ |
1225 | ||
1226 | static alent * | |
1227 | vms_get_lineno (abfd, symbol) | |
5f771d47 ILT |
1228 | bfd *abfd ATTRIBUTE_UNUSED; |
1229 | asymbol *symbol ATTRIBUTE_UNUSED; | |
252b5132 RH |
1230 | { |
1231 | #if VMS_DEBUG | |
1232 | vms_debug (1, "vms_get_lineno(%p, %p)\n", abfd, symbol); | |
1233 | #endif | |
1234 | return 0; | |
1235 | } | |
1236 | ||
252b5132 RH |
1237 | /* Provided a BFD, a section and an offset into the section, calculate and |
1238 | return the name of the source file and the line nearest to the wanted | |
1239 | location. */ | |
1240 | ||
b34976b6 | 1241 | static bfd_boolean |
252b5132 | 1242 | vms_find_nearest_line (abfd, section, symbols, offset, file, func, line) |
5f771d47 ILT |
1243 | bfd *abfd ATTRIBUTE_UNUSED; |
1244 | asection *section ATTRIBUTE_UNUSED; | |
1245 | asymbol **symbols ATTRIBUTE_UNUSED; | |
1246 | bfd_vma offset ATTRIBUTE_UNUSED; | |
dc810e39 AM |
1247 | const char **file ATTRIBUTE_UNUSED; |
1248 | const char **func ATTRIBUTE_UNUSED; | |
5f771d47 | 1249 | unsigned int *line ATTRIBUTE_UNUSED; |
252b5132 RH |
1250 | { |
1251 | #if VMS_DEBUG | |
1252 | vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n", | |
1253 | abfd, section->name, symbols, (long int)offset); | |
1254 | #endif | |
b34976b6 | 1255 | return FALSE; |
252b5132 RH |
1256 | } |
1257 | ||
252b5132 RH |
1258 | /* Back-door to allow format-aware applications to create debug symbols |
1259 | while using BFD for everything else. Currently used by the assembler | |
1260 | when creating COFF files. */ | |
1261 | ||
1262 | static asymbol * | |
1263 | vms_bfd_make_debug_symbol (abfd, ptr, size) | |
5f771d47 ILT |
1264 | bfd *abfd ATTRIBUTE_UNUSED; |
1265 | void *ptr ATTRIBUTE_UNUSED; | |
1266 | unsigned long size ATTRIBUTE_UNUSED; | |
252b5132 RH |
1267 | { |
1268 | #if VMS_DEBUG | |
1269 | vms_debug (1, "vms_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size); | |
1270 | #endif | |
1271 | return 0; | |
1272 | } | |
1273 | ||
252b5132 RH |
1274 | /* Read minisymbols. For minisymbols, we use the unmodified a.out |
1275 | symbols. The minisymbol_to_symbol function translates these into | |
1276 | BFD asymbol structures. */ | |
1277 | ||
1278 | static long | |
1279 | vms_read_minisymbols (abfd, dynamic, minisymsp, sizep) | |
1280 | bfd *abfd; | |
b34976b6 | 1281 | bfd_boolean dynamic; |
252b5132 RH |
1282 | PTR *minisymsp; |
1283 | unsigned int *sizep; | |
1284 | { | |
1285 | #if VMS_DEBUG | |
1286 | vms_debug (1, "vms_read_minisymbols(%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep); | |
1287 | #endif | |
1288 | return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); | |
1289 | } | |
1290 | ||
1291 | /* Convert a minisymbol to a BFD asymbol. A minisymbol is just an | |
1292 | unmodified a.out symbol. The SYM argument is a structure returned | |
1293 | by bfd_make_empty_symbol, which we fill in here. */ | |
1294 | ||
1295 | static asymbol * | |
1296 | vms_minisymbol_to_symbol (abfd, dynamic, minisym, sym) | |
1297 | bfd *abfd; | |
b34976b6 | 1298 | bfd_boolean dynamic; |
252b5132 RH |
1299 | const PTR minisym; |
1300 | asymbol *sym; | |
1301 | { | |
1302 | #if VMS_DEBUG | |
1303 | vms_debug (1, "vms_minisymbol_to_symbol(%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym); | |
1304 | #endif | |
1305 | return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym); | |
1306 | } | |
1307 | ||
1308 | /*-- Part 4.6, relocations --------------------------------------------------*/ | |
1309 | ||
1310 | /* Return the number of bytes required to store the relocation information | |
1311 | associated with section sect attached to bfd abfd. | |
1312 | If an error occurs, return -1. */ | |
1313 | ||
1314 | static long | |
1315 | vms_get_reloc_upper_bound (abfd, section) | |
5f771d47 ILT |
1316 | bfd *abfd ATTRIBUTE_UNUSED; |
1317 | asection *section ATTRIBUTE_UNUSED; | |
252b5132 RH |
1318 | { |
1319 | #if VMS_DEBUG | |
1320 | vms_debug (1, "vms_get_reloc_upper_bound(%p, %s)\n", abfd, section->name); | |
1321 | #endif | |
1322 | return -1L; | |
1323 | } | |
1324 | ||
252b5132 RH |
1325 | /* Call the back end associated with the open BFD abfd and translate the |
1326 | external form of the relocation information attached to sec into the | |
1327 | internal canonical form. Place the table into memory at loc, which has | |
1328 | been preallocated, usually by a call to bfd_get_reloc_upper_bound. | |
1329 | Returns the number of relocs, or -1 on error. */ | |
1330 | ||
1331 | static long | |
1332 | vms_canonicalize_reloc (abfd, section, location, symbols) | |
5f771d47 ILT |
1333 | bfd *abfd ATTRIBUTE_UNUSED; |
1334 | asection *section ATTRIBUTE_UNUSED; | |
1335 | arelent **location ATTRIBUTE_UNUSED; | |
1336 | asymbol **symbols ATTRIBUTE_UNUSED; | |
252b5132 RH |
1337 | { |
1338 | #if VMS_DEBUG | |
1339 | vms_debug (1, "vms_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name); | |
1340 | #endif | |
b34976b6 | 1341 | return FALSE; |
252b5132 RH |
1342 | } |
1343 | ||
1344 | /*---------------------------------------------------------------------------*/ | |
1345 | /* this is just copied from ecoff-alpha, needs to be fixed probably */ | |
1346 | ||
1347 | /* How to process the various reloc types. */ | |
1348 | ||
1349 | static bfd_reloc_status_type | |
1350 | reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) | |
5f771d47 ILT |
1351 | bfd *abfd ATTRIBUTE_UNUSED; |
1352 | arelent *reloc ATTRIBUTE_UNUSED; | |
1353 | asymbol *sym ATTRIBUTE_UNUSED; | |
1354 | PTR data ATTRIBUTE_UNUSED; | |
1355 | asection *sec ATTRIBUTE_UNUSED; | |
1356 | bfd *output_bfd ATTRIBUTE_UNUSED; | |
1357 | char **error_message ATTRIBUTE_UNUSED; | |
252b5132 RH |
1358 | { |
1359 | #if VMS_DEBUG | |
1360 | vms_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd); | |
1361 | vms_debug (2, "In section %s, symbol %s\n", | |
1362 | sec->name, sym->name); | |
1363 | vms_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n", | |
1364 | reloc->sym_ptr_ptr[0]->name, | |
1365 | (unsigned long)reloc->address, | |
1366 | (unsigned long)reloc->addend, reloc->howto->name); | |
1367 | vms_debug (2, "data at %p\n", data); | |
1368 | /* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */ | |
1369 | #endif | |
1370 | ||
1371 | return bfd_reloc_ok; | |
1372 | } | |
1373 | ||
1374 | /* In case we're on a 32-bit machine, construct a 64-bit "-1" value | |
1375 | from smaller values. Start with zero, widen, *then* decrement. */ | |
1376 | #define MINUS_ONE (((bfd_vma)0) - 1) | |
1377 | ||
1378 | static reloc_howto_type alpha_howto_table[] = | |
1379 | { | |
1380 | HOWTO (ALPHA_R_IGNORE, /* type */ | |
1381 | 0, /* rightshift */ | |
1382 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1383 | 8, /* bitsize */ | |
b34976b6 | 1384 | TRUE, /* pc_relative */ |
252b5132 RH |
1385 | 0, /* bitpos */ |
1386 | complain_overflow_dont, /* complain_on_overflow */ | |
1387 | reloc_nil, /* special_function */ | |
1388 | "IGNORE", /* name */ | |
b34976b6 | 1389 | TRUE, /* partial_inplace */ |
252b5132 RH |
1390 | 0, /* src_mask */ |
1391 | 0, /* dst_mask */ | |
b34976b6 | 1392 | TRUE), /* pcrel_offset */ |
252b5132 RH |
1393 | |
1394 | /* A 64 bit reference to a symbol. */ | |
1395 | HOWTO (ALPHA_R_REFQUAD, /* type */ | |
1396 | 0, /* rightshift */ | |
1397 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1398 | 64, /* bitsize */ | |
b34976b6 | 1399 | FALSE, /* pc_relative */ |
252b5132 RH |
1400 | 0, /* bitpos */ |
1401 | complain_overflow_bitfield, /* complain_on_overflow */ | |
1402 | reloc_nil, /* special_function */ | |
1403 | "REFQUAD", /* name */ | |
b34976b6 | 1404 | TRUE, /* partial_inplace */ |
252b5132 RH |
1405 | MINUS_ONE, /* src_mask */ |
1406 | MINUS_ONE, /* dst_mask */ | |
b34976b6 | 1407 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1408 | |
1409 | /* A 21 bit branch. The native assembler generates these for | |
1410 | branches within the text segment, and also fills in the PC | |
1411 | relative offset in the instruction. */ | |
1412 | HOWTO (ALPHA_R_BRADDR, /* type */ | |
1413 | 2, /* rightshift */ | |
1414 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1415 | 21, /* bitsize */ | |
b34976b6 | 1416 | TRUE, /* pc_relative */ |
252b5132 RH |
1417 | 0, /* bitpos */ |
1418 | complain_overflow_signed, /* complain_on_overflow */ | |
1419 | reloc_nil, /* special_function */ | |
1420 | "BRADDR", /* name */ | |
b34976b6 | 1421 | TRUE, /* partial_inplace */ |
252b5132 RH |
1422 | 0x1fffff, /* src_mask */ |
1423 | 0x1fffff, /* dst_mask */ | |
b34976b6 | 1424 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1425 | |
1426 | /* A hint for a jump to a register. */ | |
1427 | HOWTO (ALPHA_R_HINT, /* type */ | |
1428 | 2, /* rightshift */ | |
1429 | 1, /* size (0 = byte, 1 = short, 2 = long) */ | |
1430 | 14, /* bitsize */ | |
b34976b6 | 1431 | TRUE, /* pc_relative */ |
252b5132 RH |
1432 | 0, /* bitpos */ |
1433 | complain_overflow_dont, /* complain_on_overflow */ | |
1434 | reloc_nil, /* special_function */ | |
1435 | "HINT", /* name */ | |
b34976b6 | 1436 | TRUE, /* partial_inplace */ |
252b5132 RH |
1437 | 0x3fff, /* src_mask */ |
1438 | 0x3fff, /* dst_mask */ | |
b34976b6 | 1439 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1440 | |
1441 | /* 16 bit PC relative offset. */ | |
1442 | HOWTO (ALPHA_R_SREL16, /* type */ | |
1443 | 0, /* rightshift */ | |
1444 | 1, /* size (0 = byte, 1 = short, 2 = long) */ | |
1445 | 16, /* bitsize */ | |
b34976b6 | 1446 | TRUE, /* pc_relative */ |
252b5132 RH |
1447 | 0, /* bitpos */ |
1448 | complain_overflow_signed, /* complain_on_overflow */ | |
1449 | reloc_nil, /* special_function */ | |
1450 | "SREL16", /* name */ | |
b34976b6 | 1451 | TRUE, /* partial_inplace */ |
252b5132 RH |
1452 | 0xffff, /* src_mask */ |
1453 | 0xffff, /* dst_mask */ | |
b34976b6 | 1454 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1455 | |
1456 | /* 32 bit PC relative offset. */ | |
1457 | HOWTO (ALPHA_R_SREL32, /* type */ | |
1458 | 0, /* rightshift */ | |
1459 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1460 | 32, /* bitsize */ | |
b34976b6 | 1461 | TRUE, /* pc_relative */ |
252b5132 RH |
1462 | 0, /* bitpos */ |
1463 | complain_overflow_signed, /* complain_on_overflow */ | |
1464 | reloc_nil, /* special_function */ | |
1465 | "SREL32", /* name */ | |
b34976b6 | 1466 | TRUE, /* partial_inplace */ |
252b5132 RH |
1467 | 0xffffffff, /* src_mask */ |
1468 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 1469 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1470 | |
1471 | /* A 64 bit PC relative offset. */ | |
1472 | HOWTO (ALPHA_R_SREL64, /* type */ | |
1473 | 0, /* rightshift */ | |
1474 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1475 | 64, /* bitsize */ | |
b34976b6 | 1476 | TRUE, /* pc_relative */ |
252b5132 RH |
1477 | 0, /* bitpos */ |
1478 | complain_overflow_signed, /* complain_on_overflow */ | |
1479 | reloc_nil, /* special_function */ | |
1480 | "SREL64", /* name */ | |
b34976b6 | 1481 | TRUE, /* partial_inplace */ |
252b5132 RH |
1482 | MINUS_ONE, /* src_mask */ |
1483 | MINUS_ONE, /* dst_mask */ | |
b34976b6 | 1484 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1485 | |
1486 | /* Push a value on the reloc evaluation stack. */ | |
1487 | HOWTO (ALPHA_R_OP_PUSH, /* type */ | |
1488 | 0, /* rightshift */ | |
1489 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1490 | 0, /* bitsize */ | |
b34976b6 | 1491 | FALSE, /* pc_relative */ |
252b5132 RH |
1492 | 0, /* bitpos */ |
1493 | complain_overflow_dont, /* complain_on_overflow */ | |
1494 | reloc_nil, /* special_function */ | |
1495 | "OP_PUSH", /* name */ | |
b34976b6 | 1496 | FALSE, /* partial_inplace */ |
252b5132 RH |
1497 | 0, /* src_mask */ |
1498 | 0, /* dst_mask */ | |
b34976b6 | 1499 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1500 | |
1501 | /* Store the value from the stack at the given address. Store it in | |
1502 | a bitfield of size r_size starting at bit position r_offset. */ | |
1503 | HOWTO (ALPHA_R_OP_STORE, /* type */ | |
1504 | 0, /* rightshift */ | |
1505 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1506 | 64, /* bitsize */ | |
b34976b6 | 1507 | FALSE, /* pc_relative */ |
252b5132 RH |
1508 | 0, /* bitpos */ |
1509 | complain_overflow_dont, /* complain_on_overflow */ | |
1510 | reloc_nil, /* special_function */ | |
1511 | "OP_STORE", /* name */ | |
b34976b6 | 1512 | FALSE, /* partial_inplace */ |
252b5132 RH |
1513 | 0, /* src_mask */ |
1514 | MINUS_ONE, /* dst_mask */ | |
b34976b6 | 1515 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1516 | |
1517 | /* Subtract the reloc address from the value on the top of the | |
1518 | relocation stack. */ | |
1519 | HOWTO (ALPHA_R_OP_PSUB, /* type */ | |
1520 | 0, /* rightshift */ | |
1521 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1522 | 0, /* bitsize */ | |
b34976b6 | 1523 | FALSE, /* pc_relative */ |
252b5132 RH |
1524 | 0, /* bitpos */ |
1525 | complain_overflow_dont, /* complain_on_overflow */ | |
1526 | reloc_nil, /* special_function */ | |
1527 | "OP_PSUB", /* name */ | |
b34976b6 | 1528 | FALSE, /* partial_inplace */ |
252b5132 RH |
1529 | 0, /* src_mask */ |
1530 | 0, /* dst_mask */ | |
b34976b6 | 1531 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1532 | |
1533 | /* Shift the value on the top of the relocation stack right by the | |
1534 | given value. */ | |
1535 | HOWTO (ALPHA_R_OP_PRSHIFT, /* type */ | |
1536 | 0, /* rightshift */ | |
1537 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1538 | 0, /* bitsize */ | |
b34976b6 | 1539 | FALSE, /* pc_relative */ |
252b5132 RH |
1540 | 0, /* bitpos */ |
1541 | complain_overflow_dont, /* complain_on_overflow */ | |
1542 | reloc_nil, /* special_function */ | |
1543 | "OP_PRSHIFT", /* name */ | |
b34976b6 | 1544 | FALSE, /* partial_inplace */ |
252b5132 RH |
1545 | 0, /* src_mask */ |
1546 | 0, /* dst_mask */ | |
b34976b6 | 1547 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1548 | |
1549 | /* Hack. Linkage is done by linker. */ | |
1550 | HOWTO (ALPHA_R_LINKAGE, /* type */ | |
1551 | 0, /* rightshift */ | |
1552 | 8, /* size (0 = byte, 1 = short, 2 = long) */ | |
1553 | 256, /* bitsize */ | |
b34976b6 | 1554 | FALSE, /* pc_relative */ |
252b5132 RH |
1555 | 0, /* bitpos */ |
1556 | complain_overflow_dont, /* complain_on_overflow */ | |
1557 | reloc_nil, /* special_function */ | |
1558 | "LINKAGE", /* name */ | |
b34976b6 | 1559 | FALSE, /* partial_inplace */ |
252b5132 RH |
1560 | 0, /* src_mask */ |
1561 | 0, /* dst_mask */ | |
b34976b6 | 1562 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1563 | |
1564 | /* A 32 bit reference to a symbol. */ | |
1565 | HOWTO (ALPHA_R_REFLONG, /* type */ | |
1566 | 0, /* rightshift */ | |
1567 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1568 | 32, /* bitsize */ | |
b34976b6 | 1569 | FALSE, /* pc_relative */ |
252b5132 RH |
1570 | 0, /* bitpos */ |
1571 | complain_overflow_bitfield, /* complain_on_overflow */ | |
1572 | reloc_nil, /* special_function */ | |
1573 | "REFLONG", /* name */ | |
b34976b6 | 1574 | TRUE, /* partial_inplace */ |
252b5132 RH |
1575 | 0xffffffff, /* src_mask */ |
1576 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 1577 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1578 | |
1579 | /* A 64 bit reference to a procedure, written as 32 bit value. */ | |
1580 | HOWTO (ALPHA_R_CODEADDR, /* type */ | |
1581 | 0, /* rightshift */ | |
1582 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1583 | 64, /* bitsize */ | |
b34976b6 | 1584 | FALSE, /* pc_relative */ |
252b5132 RH |
1585 | 0, /* bitpos */ |
1586 | complain_overflow_signed,/* complain_on_overflow */ | |
1587 | reloc_nil, /* special_function */ | |
1588 | "CODEADDR", /* name */ | |
b34976b6 | 1589 | FALSE, /* partial_inplace */ |
252b5132 RH |
1590 | 0xffffffff, /* src_mask */ |
1591 | 0xffffffff, /* dst_mask */ | |
b34976b6 | 1592 | FALSE), /* pcrel_offset */ |
252b5132 RH |
1593 | |
1594 | }; | |
1595 | ||
1596 | /* Return a pointer to a howto structure which, when invoked, will perform | |
1597 | the relocation code on data from the architecture noted. */ | |
1598 | ||
1599 | static const struct reloc_howto_struct * | |
1600 | vms_bfd_reloc_type_lookup (abfd, code) | |
5f771d47 | 1601 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
1602 | bfd_reloc_code_real_type code; |
1603 | { | |
1604 | int alpha_type; | |
1605 | ||
1606 | #if VMS_DEBUG | |
1607 | vms_debug (1, "vms_bfd_reloc_type_lookup(%p, %d)\t", abfd, code); | |
1608 | #endif | |
1609 | ||
1610 | switch (code) | |
1611 | { | |
1612 | case BFD_RELOC_16: alpha_type = ALPHA_R_SREL16; break; | |
1613 | case BFD_RELOC_32: alpha_type = ALPHA_R_REFLONG; break; | |
1614 | case BFD_RELOC_64: alpha_type = ALPHA_R_REFQUAD; break; | |
1615 | case BFD_RELOC_CTOR: alpha_type = ALPHA_R_REFQUAD; break; | |
1616 | case BFD_RELOC_23_PCREL_S2: alpha_type = ALPHA_R_BRADDR; break; | |
1617 | case BFD_RELOC_ALPHA_HINT: alpha_type = ALPHA_R_HINT; break; | |
1618 | case BFD_RELOC_16_PCREL: alpha_type = ALPHA_R_SREL16; break; | |
1619 | case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break; | |
1620 | case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break; | |
1621 | case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break; | |
1622 | case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break; | |
1623 | default: | |
1624 | (*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code); | |
1625 | return (const struct reloc_howto_struct *) NULL; | |
1626 | } | |
1627 | #if VMS_DEBUG | |
1628 | vms_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name); | |
1629 | #endif | |
1630 | return &alpha_howto_table[alpha_type]; | |
1631 | } | |
1632 | ||
252b5132 RH |
1633 | /*-- Part 4.7, writing an object file ---------------------------------------*/ |
1634 | ||
1635 | /* Set the architecture and machine type in BFD abfd to arch and mach. | |
1636 | Find the correct pointer to a structure and insert it into the arch_info | |
1637 | pointer. */ | |
1638 | ||
b34976b6 | 1639 | static bfd_boolean |
252b5132 RH |
1640 | vms_set_arch_mach (abfd, arch, mach) |
1641 | bfd *abfd; | |
5f771d47 ILT |
1642 | enum bfd_architecture arch ATTRIBUTE_UNUSED; |
1643 | unsigned long mach ATTRIBUTE_UNUSED; | |
252b5132 RH |
1644 | { |
1645 | #if VMS_DEBUG | |
1646 | vms_debug (1, "vms_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach); | |
1647 | #endif | |
1648 | abfd->arch_info = bfd_scan_arch("alpha"); | |
1649 | ||
b34976b6 | 1650 | return TRUE; |
252b5132 RH |
1651 | } |
1652 | ||
252b5132 RH |
1653 | /* Sets the contents of the section section in BFD abfd to the data starting |
1654 | in memory at data. The data is written to the output section starting at | |
1655 | offset offset for count bytes. | |
1656 | ||
b34976b6 | 1657 | Normally TRUE is returned, else FALSE. Possible error returns are: |
252b5132 RH |
1658 | o bfd_error_no_contents - The output section does not have the |
1659 | SEC_HAS_CONTENTS attribute, so nothing can be written to it. | |
1660 | o and some more too */ | |
1661 | ||
b34976b6 | 1662 | static bfd_boolean |
252b5132 RH |
1663 | vms_set_section_contents (abfd, section, location, offset, count) |
1664 | bfd *abfd; | |
1665 | asection *section; | |
0f867abe | 1666 | const PTR location; |
252b5132 RH |
1667 | file_ptr offset; |
1668 | bfd_size_type count; | |
1669 | { | |
1670 | #if VMS_DEBUG | |
1671 | vms_debug (1, "vms_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n", | |
1672 | abfd, section->name, location, (long int)offset, (int)count); | |
eea6121a | 1673 | vms_debug (2, "size %d\n", (int) section->size); |
252b5132 RH |
1674 | #endif |
1675 | return _bfd_save_vms_section(abfd, section, location, offset, count); | |
1676 | } | |
1677 | ||
252b5132 RH |
1678 | /*-- Part 4.8, linker -------------------------------------------------------*/ |
1679 | ||
1680 | /* Get the size of the section headers. */ | |
1681 | ||
1682 | static int | |
1683 | vms_sizeof_headers (abfd, reloc) | |
5f771d47 | 1684 | bfd *abfd ATTRIBUTE_UNUSED; |
b34976b6 | 1685 | bfd_boolean reloc ATTRIBUTE_UNUSED; |
252b5132 RH |
1686 | { |
1687 | #if VMS_DEBUG | |
1688 | vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False"); | |
1689 | #endif | |
1690 | return 0; | |
1691 | } | |
1692 | ||
252b5132 RH |
1693 | /* Provides default handling of relocation effort for back ends |
1694 | which can't be bothered to do it efficiently. */ | |
1695 | ||
1696 | static bfd_byte * | |
1697 | vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data, | |
1049f94e | 1698 | relocatable, symbols) |
5f771d47 ILT |
1699 | bfd *abfd ATTRIBUTE_UNUSED; |
1700 | struct bfd_link_info *link_info ATTRIBUTE_UNUSED; | |
1701 | struct bfd_link_order *link_order ATTRIBUTE_UNUSED; | |
1702 | bfd_byte *data ATTRIBUTE_UNUSED; | |
1049f94e | 1703 | bfd_boolean relocatable ATTRIBUTE_UNUSED; |
5f771d47 | 1704 | asymbol **symbols ATTRIBUTE_UNUSED; |
252b5132 RH |
1705 | { |
1706 | #if VMS_DEBUG | |
1707 | vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n", | |
1049f94e | 1708 | abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols); |
252b5132 RH |
1709 | #endif |
1710 | return 0; | |
1711 | } | |
1712 | ||
252b5132 RH |
1713 | /* ??? */ |
1714 | ||
b34976b6 | 1715 | static bfd_boolean |
252b5132 | 1716 | vms_bfd_relax_section (abfd, section, link_info, again) |
5f771d47 ILT |
1717 | bfd *abfd ATTRIBUTE_UNUSED; |
1718 | asection *section ATTRIBUTE_UNUSED; | |
1719 | struct bfd_link_info *link_info ATTRIBUTE_UNUSED; | |
b34976b6 | 1720 | bfd_boolean *again ATTRIBUTE_UNUSED; |
252b5132 RH |
1721 | { |
1722 | #if VMS_DEBUG | |
1723 | vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, <ret>)\n", | |
1724 | abfd, section->name, link_info); | |
1725 | #endif | |
b34976b6 | 1726 | return TRUE; |
252b5132 RH |
1727 | } |
1728 | ||
b34976b6 | 1729 | static bfd_boolean |
252b5132 | 1730 | vms_bfd_gc_sections (abfd, link_info) |
5f771d47 ILT |
1731 | bfd *abfd ATTRIBUTE_UNUSED; |
1732 | struct bfd_link_info *link_info ATTRIBUTE_UNUSED; | |
252b5132 RH |
1733 | { |
1734 | #if VMS_DEBUG | |
1735 | vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info); | |
1736 | #endif | |
b34976b6 | 1737 | return TRUE; |
252b5132 RH |
1738 | } |
1739 | ||
b34976b6 | 1740 | static bfd_boolean |
8550eb6e JJ |
1741 | vms_bfd_merge_sections (abfd, link_info) |
1742 | bfd *abfd ATTRIBUTE_UNUSED; | |
1743 | struct bfd_link_info *link_info ATTRIBUTE_UNUSED; | |
1744 | { | |
1745 | #if VMS_DEBUG | |
1746 | vms_debug (1, "vms_bfd_merge_sections(%p, %p)\n", abfd, link_info); | |
1747 | #endif | |
b34976b6 | 1748 | return TRUE; |
8550eb6e JJ |
1749 | } |
1750 | ||
252b5132 RH |
1751 | /* Create a hash table for the linker. Different backends store |
1752 | different information in this table. */ | |
1753 | ||
1754 | static struct bfd_link_hash_table * | |
1755 | vms_bfd_link_hash_table_create (abfd) | |
5f771d47 | 1756 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
1757 | { |
1758 | #if VMS_DEBUG | |
1759 | vms_debug (1, "vms_bfd_link_hash_table_create(%p)\n", abfd); | |
1760 | #endif | |
1761 | return 0; | |
1762 | } | |
1763 | ||
e2d34d7d DJ |
1764 | /* Free a linker hash table. */ |
1765 | ||
1766 | static void | |
1767 | vms_bfd_link_hash_table_free (hash) | |
1768 | struct bfd_link_hash_table *hash ATTRIBUTE_UNUSED; | |
1769 | { | |
1770 | #if VMS_DEBUG | |
1771 | vms_debug (1, "vms_bfd_link_hash_table_free(%p)\n", abfd); | |
1772 | #endif | |
1773 | } | |
1774 | ||
252b5132 RH |
1775 | /* Add symbols from this object file into the hash table. */ |
1776 | ||
b34976b6 | 1777 | static bfd_boolean |
252b5132 | 1778 | vms_bfd_link_add_symbols (abfd, link_info) |
5f771d47 ILT |
1779 | bfd *abfd ATTRIBUTE_UNUSED; |
1780 | struct bfd_link_info *link_info ATTRIBUTE_UNUSED; | |
252b5132 RH |
1781 | { |
1782 | #if VMS_DEBUG | |
1783 | vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info); | |
1784 | #endif | |
b34976b6 | 1785 | return FALSE; |
252b5132 RH |
1786 | } |
1787 | ||
252b5132 RH |
1788 | /* Do a link based on the link_order structures attached to each |
1789 | section of the BFD. */ | |
1790 | ||
b34976b6 | 1791 | static bfd_boolean |
252b5132 | 1792 | vms_bfd_final_link (abfd, link_info) |
5f771d47 ILT |
1793 | bfd *abfd ATTRIBUTE_UNUSED; |
1794 | struct bfd_link_info *link_info ATTRIBUTE_UNUSED; | |
252b5132 RH |
1795 | { |
1796 | #if VMS_DEBUG | |
1797 | vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info); | |
1798 | #endif | |
b34976b6 | 1799 | return TRUE; |
252b5132 RH |
1800 | } |
1801 | ||
1802 | /* Should this section be split up into smaller pieces during linking. */ | |
1803 | ||
b34976b6 | 1804 | static bfd_boolean |
252b5132 | 1805 | vms_bfd_link_split_section (abfd, section) |
5f771d47 ILT |
1806 | bfd *abfd ATTRIBUTE_UNUSED; |
1807 | asection *section ATTRIBUTE_UNUSED; | |
252b5132 RH |
1808 | { |
1809 | #if VMS_DEBUG | |
1810 | vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name); | |
1811 | #endif | |
b34976b6 | 1812 | return FALSE; |
252b5132 RH |
1813 | } |
1814 | ||
1815 | /*-- Part 4.9, dynamic symbols and relocations ------------------------------*/ | |
1816 | ||
1817 | /* Get the amount of memory required to hold the dynamic symbols. */ | |
1818 | ||
1819 | static long | |
1820 | vms_get_dynamic_symtab_upper_bound (abfd) | |
5f771d47 | 1821 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
1822 | { |
1823 | #if VMS_DEBUG | |
1824 | vms_debug (1, "vms_get_dynamic_symtab_upper_bound(%p)\n", abfd); | |
1825 | #endif | |
1826 | return 0; | |
1827 | } | |
1828 | ||
b34976b6 | 1829 | static bfd_boolean |
252b5132 | 1830 | vms_bfd_print_private_bfd_data (abfd, file) |
5f771d47 ILT |
1831 | bfd *abfd ATTRIBUTE_UNUSED; |
1832 | void *file ATTRIBUTE_UNUSED; | |
252b5132 RH |
1833 | { |
1834 | #if VMS_DEBUG | |
1835 | vms_debug (1, "vms_bfd_print_private_bfd_data(%p)\n", abfd); | |
1836 | #endif | |
1837 | return 0; | |
1838 | } | |
1839 | ||
252b5132 RH |
1840 | /* Read in the dynamic symbols. */ |
1841 | ||
1842 | static long | |
1843 | vms_canonicalize_dynamic_symtab (abfd, symbols) | |
5f771d47 ILT |
1844 | bfd *abfd ATTRIBUTE_UNUSED; |
1845 | asymbol **symbols ATTRIBUTE_UNUSED; | |
252b5132 RH |
1846 | { |
1847 | #if VMS_DEBUG | |
1848 | vms_debug (1, "vms_canonicalize_dynamic_symtab(%p, <ret>)\n", abfd); | |
1849 | #endif | |
1850 | return 0L; | |
1851 | } | |
1852 | ||
252b5132 RH |
1853 | /* Get the amount of memory required to hold the dynamic relocs. */ |
1854 | ||
1855 | static long | |
1856 | vms_get_dynamic_reloc_upper_bound (abfd) | |
5f771d47 | 1857 | bfd *abfd ATTRIBUTE_UNUSED; |
252b5132 RH |
1858 | { |
1859 | #if VMS_DEBUG | |
1860 | vms_debug (1, "vms_get_dynamic_reloc_upper_bound(%p)\n", abfd); | |
1861 | #endif | |
1862 | return 0L; | |
1863 | } | |
1864 | ||
252b5132 RH |
1865 | /* Read in the dynamic relocs. */ |
1866 | ||
1867 | static long | |
1868 | vms_canonicalize_dynamic_reloc (abfd, arel, symbols) | |
5f771d47 ILT |
1869 | bfd *abfd ATTRIBUTE_UNUSED; |
1870 | arelent **arel ATTRIBUTE_UNUSED; | |
1871 | asymbol **symbols ATTRIBUTE_UNUSED; | |
252b5132 RH |
1872 | { |
1873 | #if VMS_DEBUG | |
1874 | vms_debug (1, "vms_canonicalize_dynamic_reloc(%p)\n", abfd); | |
1875 | #endif | |
1876 | return 0L; | |
1877 | } |