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