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