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