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