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