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