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