* Contribute Hitachi SH5 simulator.
[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.
3f3c5c34 3 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
7898deda 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
3f3c5c34 132#define vms_make_empty_symbol _bfd_generic_make_empty_symbol
252b5132
RH
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{
4e6bfe8a
AM
736 /* Count hasn't been incremented yet. */
737 unsigned int section_count = abfd->section_count + 1;
738
252b5132 739#if VMS_DEBUG
4e6bfe8a
AM
740 vms_debug (1, "vms_new_section_hook (%p, [%d]%s), count %d\n",
741 abfd, section->index, section->name, section_count);
252b5132 742#endif
4e6bfe8a 743 bfd_set_section_alignment (abfd, section, 4);
252b5132 744
4e6bfe8a 745 if (section_count > PRIV (section_count))
252b5132 746 {
4e6bfe8a 747 bfd_size_type amt = section_count;
dc810e39
AM
748 amt *= sizeof (asection *);
749 PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt);
8a0c27cd 750 if (PRIV (sections) == 0)
252b5132 751 return false;
4e6bfe8a 752 PRIV (section_count) = section_count;
252b5132
RH
753 }
754#if VMS_DEBUG
8a0c27cd 755 vms_debug (6, "section_count: %d\n", PRIV (section_count));
252b5132 756#endif
8a0c27cd 757 PRIV (sections)[section->index] = section;
252b5132
RH
758#if VMS_DEBUG
759 vms_debug (7, "%d: %s\n", section->index, section->name);
760#endif
761
762 return true;
763}
764
252b5132
RH
765/* Read the contents of a section.
766 buf points to a buffer of buf_size bytes to be filled with
767 section data (starting at offset into section) */
768
769static boolean
770vms_get_section_contents (abfd, section, buf, offset, buf_size)
5f771d47
ILT
771 bfd *abfd ATTRIBUTE_UNUSED;
772 asection *section ATTRIBUTE_UNUSED;
773 PTR buf ATTRIBUTE_UNUSED;
774 file_ptr offset ATTRIBUTE_UNUSED;
775 bfd_size_type buf_size ATTRIBUTE_UNUSED;
252b5132
RH
776{
777#if VMS_DEBUG
778 vms_debug (1, "vms_get_section_contents(%p, %s, %p, off %ld, size %d)\n",
779 abfd, section->name, buf, offset, (int)buf_size);
780#endif
781
782 /* shouldn't be called, since all sections are IN_MEMORY */
783
784 return false;
785}
786
787/* Read the contents of a section.
788 buf points to a buffer of buf_size bytes to be filled with
789 section data (starting at offset into section) */
790
791static boolean
792vms_get_section_contents_in_window (abfd, section, w, offset, count)
5f771d47
ILT
793 bfd *abfd ATTRIBUTE_UNUSED;
794 asection *section ATTRIBUTE_UNUSED;
795 bfd_window *w ATTRIBUTE_UNUSED;
796 file_ptr offset ATTRIBUTE_UNUSED;
797 bfd_size_type count ATTRIBUTE_UNUSED;
252b5132
RH
798{
799#if VMS_DEBUG
800 vms_debug (1, "vms_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n",
801 abfd, section->name, w, offset, (int)count);
802#endif
803
804 /* shouldn't be called, since all sections are IN_MEMORY */
805
806 return false;
807}
808
809/*-- Part 4.2, copy private data --------------------------------------------*/
810
811/* Called to copy BFD general private data from one object file
812 to another. */
813
814static boolean
815vms_bfd_copy_private_bfd_data (src, dest)
5f771d47
ILT
816 bfd *src ATTRIBUTE_UNUSED;
817 bfd *dest ATTRIBUTE_UNUSED;
252b5132
RH
818{
819#if VMS_DEBUG
820 vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest);
821#endif
822 return true;
823}
824
252b5132
RH
825/* Merge private BFD information from the BFD @var{ibfd} to the
826 the output file BFD @var{obfd} when linking. Return <<true>>
827 on success, <<false>> on error. Possible error returns are:
828
829 o <<bfd_error_no_memory>> -
830 Not enough memory exists to create private data for @var{obfd}. */
831
832static boolean
833vms_bfd_merge_private_bfd_data (ibfd, obfd)
5f771d47
ILT
834 bfd *ibfd ATTRIBUTE_UNUSED;
835 bfd *obfd ATTRIBUTE_UNUSED;
252b5132
RH
836{
837#if VMS_DEBUG
838 vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd);
839#endif
840 return true;
841}
842
252b5132
RH
843/* Set private BFD flag information in the BFD @var{abfd}.
844 Return <<true>> on success, <<false>> on error. Possible error
845 returns are:
846
847 o <<bfd_error_no_memory>> -
848 Not enough memory exists to create private data for @var{obfd}. */
849
850static boolean
851vms_bfd_set_private_flags (abfd, flags)
5f771d47
ILT
852 bfd *abfd ATTRIBUTE_UNUSED;
853 flagword flags ATTRIBUTE_UNUSED;
252b5132
RH
854{
855#if VMS_DEBUG
856 vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags);
857#endif
858 return true;
859}
860
252b5132
RH
861/* Called to copy BFD private section data from one object file
862 to another. */
863
864static boolean
865vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec)
5f771d47
ILT
866 bfd *srcbfd ATTRIBUTE_UNUSED;
867 asection *srcsec ATTRIBUTE_UNUSED;
868 bfd *dstbfd ATTRIBUTE_UNUSED;
869 asection *dstsec ATTRIBUTE_UNUSED;
252b5132
RH
870{
871#if VMS_DEBUG
872 vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n",
873 srcbfd, srcsec->name, dstbfd, dstsec->name);
874#endif
875 return true;
876}
877
878/* Called to copy BFD private symbol data from one object file
879 to another. */
880
55f2d5ed 881static boolean
252b5132 882vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym)
5f771d47
ILT
883 bfd *ibfd ATTRIBUTE_UNUSED;
884 asymbol *isym ATTRIBUTE_UNUSED;
885 bfd *obfd ATTRIBUTE_UNUSED;
886 asymbol *osym ATTRIBUTE_UNUSED;
252b5132
RH
887{
888#if VMS_DEBUG
889 vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n",
890 ibfd, isym->name, obfd, osym->name);
891#endif
892 return true;
893}
894
895/*-- Part 4.3, core file ----------------------------------------------------*/
896
897/* Return a read-only string explaining which program was running
898 when it failed and produced the core file abfd. */
899
900static char *
901vms_core_file_failing_command (abfd)
5f771d47 902 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
903{
904#if VMS_DEBUG
905 vms_debug (1, "vms_core_file_failing_command(%p)\n", abfd);
906#endif
907 return 0;
908}
909
252b5132
RH
910/* Returns the signal number which caused the core dump which
911 generated the file the BFD abfd is attached to. */
912
913static int
914vms_core_file_failing_signal (abfd)
5f771d47 915 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
916{
917#if VMS_DEBUG
918 vms_debug (1, "vms_core_file_failing_signal(%p)\n", abfd);
919#endif
920 return 0;
921}
922
252b5132
RH
923/* Return true if the core file attached to core_bfd was generated
924 by a run of the executable file attached to exec_bfd, false otherwise. */
925
926static boolean
927vms_core_file_matches_executable_p (abfd, bbfd)
5f771d47
ILT
928 bfd *abfd ATTRIBUTE_UNUSED;
929 bfd *bbfd ATTRIBUTE_UNUSED;
252b5132
RH
930{
931#if VMS_DEBUG
932 vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd);
933#endif
934 return false;
935}
936
937/*-- Part 4.4, archive ------------------------------------------------------*/
938
939/* ??? do something with an archive map.
940 Return false on error, true otherwise. */
941
942static boolean
943vms_slurp_armap (abfd)
5f771d47 944 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
945{
946#if VMS_DEBUG
947 vms_debug (1, "vms_slurp_armap(%p)\n", abfd);
948#endif
949 return false;
950}
951
252b5132
RH
952/* ??? do something with an extended name table.
953 Return false on error, true otherwise. */
954
955static boolean
956vms_slurp_extended_name_table (abfd)
5f771d47 957 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
958{
959#if VMS_DEBUG
960 vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd);
961#endif
962 return false;
963}
964
252b5132
RH
965/* ??? do something with an extended name table.
966 Return false on error, true otherwise. */
967
968static boolean
969vms_construct_extended_name_table (abfd, tabloc, tablen, name)
5f771d47
ILT
970 bfd *abfd ATTRIBUTE_UNUSED;
971 char **tabloc ATTRIBUTE_UNUSED;
972 bfd_size_type *tablen ATTRIBUTE_UNUSED;
973 const char **name ATTRIBUTE_UNUSED;
252b5132
RH
974{
975#if VMS_DEBUG
976 vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd);
977#endif
978 return false;
979}
980
252b5132
RH
981/* Truncate the name of an archive to match system-dependent restrictions */
982
983static void
984vms_truncate_arname (abfd, pathname, arhdr)
5f771d47 985 bfd *abfd ATTRIBUTE_UNUSED;
dc810e39 986 const char *pathname ATTRIBUTE_UNUSED;
5f771d47 987 char *arhdr ATTRIBUTE_UNUSED;
252b5132
RH
988{
989#if VMS_DEBUG
990 vms_debug (1, "vms_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr);
991#endif
992 return;
993}
994
252b5132
RH
995/* ??? write archive map */
996
997static boolean
998vms_write_armap (arch, elength, map, orl_count, stridx)
5f771d47
ILT
999 bfd *arch ATTRIBUTE_UNUSED;
1000 unsigned int elength ATTRIBUTE_UNUSED;
1001 struct orl *map ATTRIBUTE_UNUSED;
1002 unsigned int orl_count ATTRIBUTE_UNUSED;
1003 int stridx ATTRIBUTE_UNUSED;
252b5132
RH
1004{
1005#if VMS_DEBUG
1006 vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n",
1007 arch, elength, map, orl_count, stridx);
1008#endif
1009 return true;
1010}
1011
1012/* Read archive header ??? */
1013
1014static PTR
1015vms_read_ar_hdr (abfd)
5f771d47 1016 bfd * abfd ATTRIBUTE_UNUSED;
252b5132
RH
1017{
1018#if VMS_DEBUG
1019 vms_debug (1, "vms_read_ar_hdr(%p)\n", abfd);
1020#endif
1021 return (PTR)0;
1022}
1023
252b5132
RH
1024/* Provided a BFD, @var{archive}, containing an archive and NULL, open
1025 an input BFD on the first contained element and returns that.
1026 Subsequent calls should pass the archive and the previous return value
1027 to return a created BFD to the next contained element.
1028 NULL is returned when there are no more. */
1029
1030static bfd *
1031vms_openr_next_archived_file (arch, prev)
5f771d47
ILT
1032 bfd *arch ATTRIBUTE_UNUSED;
1033 bfd *prev ATTRIBUTE_UNUSED;
252b5132
RH
1034{
1035#if VMS_DEBUG
1036 vms_debug (1, "vms_openr_next_archived_file(%p, %p)\n", arch, prev);
1037#endif
01fff6e2 1038 return NULL;
252b5132
RH
1039}
1040
252b5132
RH
1041/* Return the BFD which is referenced by the symbol in ABFD indexed by
1042 INDEX. INDEX should have been returned by bfd_get_next_mapent. */
1043
1044static bfd *
1045vms_get_elt_at_index (abfd, index)
1046 bfd *abfd;
1047 symindex index;
1048{
1049#if VMS_DEBUG
1050 vms_debug (1, "vms_get_elt_at_index(%p, %p)\n", abfd, index);
1051#endif
1052 return _bfd_generic_get_elt_at_index(abfd, index);
1053}
1054
252b5132
RH
1055/* ???
1056 -> bfd_generic_stat_arch_elt */
1057
1058static int
dc810e39 1059vms_generic_stat_arch_elt (abfd, st)
252b5132 1060 bfd *abfd;
dc810e39 1061 struct stat *st;
252b5132
RH
1062{
1063#if VMS_DEBUG
dc810e39 1064 vms_debug (1, "vms_generic_stat_arch_elt(%p, %p)\n", abfd, st);
252b5132 1065#endif
dc810e39 1066 return bfd_generic_stat_arch_elt (abfd, st);
252b5132
RH
1067}
1068
252b5132
RH
1069/* This is a new function in bfd 2.5 */
1070
1071static boolean
1072vms_update_armap_timestamp (abfd)
5f771d47 1073 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
1074{
1075#if VMS_DEBUG
1076 vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd);
1077#endif
1078 return true;
1079}
1080
1081/*-- Part 4.5, symbols --------------------------------------------------------*/
1082
1083/* Return the number of bytes required to store a vector of pointers
1084 to asymbols for all the symbols in the BFD abfd, including a
1085 terminal NULL pointer. If there are no symbols in the BFD,
1086 then return 0. If an error occurs, return -1. */
1087
1088static long
1089vms_get_symtab_upper_bound (abfd)
1090 bfd *abfd;
1091{
1092#if VMS_DEBUG
8a0c27cd 1093 vms_debug (1, "vms_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV (gsd_sym_count));
252b5132 1094#endif
8a0c27cd 1095 return (PRIV (gsd_sym_count)+1) * sizeof (asymbol *);
252b5132
RH
1096}
1097
252b5132
RH
1098/* Copy symbols from hash table to symbol vector
1099
1100 called from bfd_hash_traverse in vms_get_symtab
1101 init counter to 0 if entry == 0 */
1102
1103static boolean
1104copy_symbols (entry, arg)
1105 struct bfd_hash_entry *entry;
1106 PTR arg;
1107{
1108 bfd *abfd = (bfd *) arg;
1109
1110 if (entry == NULL) /* init counter */
8a0c27cd 1111 PRIV (symnum) = 0;
252b5132 1112 else /* fill vector, inc counter */
8a0c27cd 1113 PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol;
252b5132
RH
1114
1115 return true;
1116}
1117
252b5132
RH
1118/* Read the symbols from the BFD abfd, and fills in the vector
1119 location with pointers to the symbols and a trailing NULL.
1120
1121 return # of symbols read */
1122
1123static long
1124vms_get_symtab (abfd, symbols)
1125 bfd *abfd;
1126 asymbol **symbols;
1127{
1128#if VMS_DEBUG
1129 vms_debug (1, "vms_get_symtab(%p, <ret>)\n", abfd);
1130#endif
1131
1132 /* init counter */
1133 (void)copy_symbols((struct bfd_hash_entry *)0, abfd);
1134
1135 /* traverse table and fill symbols vector */
1136
8a0c27cd
KH
1137 PRIV (symcache) = symbols;
1138 bfd_hash_traverse(PRIV (vms_symbol_table), copy_symbols, (PTR)abfd);
252b5132 1139
8a0c27cd 1140 symbols[PRIV (gsd_sym_count)] = NULL;
252b5132 1141
8a0c27cd 1142 return PRIV (gsd_sym_count);
252b5132
RH
1143}
1144
252b5132
RH
1145/* Print symbol to file according to how. how is one of
1146 bfd_print_symbol_name just print the name
1147 bfd_print_symbol_more print more (???)
1148 bfd_print_symbol_all print all we know, which is not much right now :-) */
1149
1150static void
1151vms_print_symbol (abfd, file, symbol, how)
60b89a18 1152 bfd *abfd;
252b5132
RH
1153 PTR file;
1154 asymbol *symbol;
1155 bfd_print_symbol_type how;
1156{
1157#if VMS_DEBUG
1158 vms_debug (1, "vms_print_symbol(%p, %p, %p, %d)\n", abfd, file, symbol, how);
1159#endif
1160
1161 switch (how)
1162 {
1163 case bfd_print_symbol_name:
1164 case bfd_print_symbol_more:
55f2d5ed 1165 fprintf ((FILE *)file," %s", symbol->name);
252b5132
RH
1166 break;
1167
252b5132
RH
1168 case bfd_print_symbol_all:
1169 {
dc810e39 1170 const char *section_name = symbol->section->name;
252b5132 1171
60b89a18 1172 bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
252b5132 1173
55f2d5ed 1174 fprintf ((FILE *)file," %-8s %s", section_name, symbol->name);
252b5132
RH
1175 }
1176 break;
1177 }
1178 return;
1179}
1180
252b5132
RH
1181/* Return information about symbol in ret.
1182
1183 fill type, value and name
1184 type:
1185 A absolute
1186 B bss segment symbol
1187 C common symbol
1188 D data segment symbol
1189 f filename
1190 t a static function symbol
1191 T text segment symbol
1192 U undefined
1193 - debug */
1194
1195static void
1196vms_get_symbol_info (abfd, symbol, ret)
5f771d47 1197 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
1198 asymbol *symbol;
1199 symbol_info *ret;
1200{
1201 asection *sec;
1202
1203#if VMS_DEBUG
1204 vms_debug (1, "vms_get_symbol_info(%p, %p, %p)\n", abfd, symbol, ret);
1205#endif
1206
1207 sec = symbol->section;
1208
1209 if (ret == 0)
1210 return;
1211
1212 if (bfd_is_com_section (sec))
1213 ret->type = 'C';
1214 else if (bfd_is_abs_section (sec))
1215 ret->type = 'A';
1216 else if (bfd_is_und_section (sec))
1217 ret->type = 'U';
1218 else if (bfd_is_ind_section (sec))
1219 ret->type = 'I';
1220 else if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
1221 ret->type = 'T';
1222 else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
1223 ret->type = 'D';
1224 else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
1225 ret->type = 'B';
1226 else
1227 ret->type = '-';
1228
1229 if (ret->type != 'U')
1230 ret->value = symbol->value + symbol->section->vma;
1231 else
1232 ret->value = 0;
1233 ret->name = symbol->name;
1234
1235 return;
1236}
1237
252b5132
RH
1238/* Return true if the given symbol sym in the BFD abfd is
1239 a compiler generated local label, else return false. */
1240
1241static boolean
1242vms_bfd_is_local_label_name (abfd, name)
5f771d47 1243 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
1244 const char *name;
1245{
1246#if VMS_DEBUG
1247 vms_debug (1, "vms_bfd_is_local_label_name(%p, %s)\n", abfd, name);
1248#endif
1249 return name[0] == '$';
1250}
1251
252b5132
RH
1252/* Get source line number for symbol */
1253
1254static alent *
1255vms_get_lineno (abfd, symbol)
5f771d47
ILT
1256 bfd *abfd ATTRIBUTE_UNUSED;
1257 asymbol *symbol ATTRIBUTE_UNUSED;
252b5132
RH
1258{
1259#if VMS_DEBUG
1260 vms_debug (1, "vms_get_lineno(%p, %p)\n", abfd, symbol);
1261#endif
1262 return 0;
1263}
1264
252b5132
RH
1265/* Provided a BFD, a section and an offset into the section, calculate and
1266 return the name of the source file and the line nearest to the wanted
1267 location. */
1268
1269static boolean
1270vms_find_nearest_line (abfd, section, symbols, offset, file, func, line)
5f771d47
ILT
1271 bfd *abfd ATTRIBUTE_UNUSED;
1272 asection *section ATTRIBUTE_UNUSED;
1273 asymbol **symbols ATTRIBUTE_UNUSED;
1274 bfd_vma offset ATTRIBUTE_UNUSED;
dc810e39
AM
1275 const char **file ATTRIBUTE_UNUSED;
1276 const char **func ATTRIBUTE_UNUSED;
5f771d47 1277 unsigned int *line ATTRIBUTE_UNUSED;
252b5132
RH
1278{
1279#if VMS_DEBUG
1280 vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n",
1281 abfd, section->name, symbols, (long int)offset);
1282#endif
1283 return false;
1284}
1285
252b5132
RH
1286/* Back-door to allow format-aware applications to create debug symbols
1287 while using BFD for everything else. Currently used by the assembler
1288 when creating COFF files. */
1289
1290static asymbol *
1291vms_bfd_make_debug_symbol (abfd, ptr, size)
5f771d47
ILT
1292 bfd *abfd ATTRIBUTE_UNUSED;
1293 void *ptr ATTRIBUTE_UNUSED;
1294 unsigned long size ATTRIBUTE_UNUSED;
252b5132
RH
1295{
1296#if VMS_DEBUG
1297 vms_debug (1, "vms_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size);
1298#endif
1299 return 0;
1300}
1301
252b5132
RH
1302/* Read minisymbols. For minisymbols, we use the unmodified a.out
1303 symbols. The minisymbol_to_symbol function translates these into
1304 BFD asymbol structures. */
1305
1306static long
1307vms_read_minisymbols (abfd, dynamic, minisymsp, sizep)
1308 bfd *abfd;
1309 boolean dynamic;
1310 PTR *minisymsp;
1311 unsigned int *sizep;
1312{
1313#if VMS_DEBUG
1314 vms_debug (1, "vms_read_minisymbols(%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep);
1315#endif
1316 return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep);
1317}
1318
1319/* Convert a minisymbol to a BFD asymbol. A minisymbol is just an
1320 unmodified a.out symbol. The SYM argument is a structure returned
1321 by bfd_make_empty_symbol, which we fill in here. */
1322
1323static asymbol *
1324vms_minisymbol_to_symbol (abfd, dynamic, minisym, sym)
1325 bfd *abfd;
1326 boolean dynamic;
1327 const PTR minisym;
1328 asymbol *sym;
1329{
1330#if VMS_DEBUG
1331 vms_debug (1, "vms_minisymbol_to_symbol(%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym);
1332#endif
1333 return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym);
1334}
1335
1336/*-- Part 4.6, relocations --------------------------------------------------*/
1337
1338/* Return the number of bytes required to store the relocation information
1339 associated with section sect attached to bfd abfd.
1340 If an error occurs, return -1. */
1341
1342static long
1343vms_get_reloc_upper_bound (abfd, section)
5f771d47
ILT
1344 bfd *abfd ATTRIBUTE_UNUSED;
1345 asection *section ATTRIBUTE_UNUSED;
252b5132
RH
1346{
1347#if VMS_DEBUG
1348 vms_debug (1, "vms_get_reloc_upper_bound(%p, %s)\n", abfd, section->name);
1349#endif
1350 return -1L;
1351}
1352
252b5132
RH
1353/* Call the back end associated with the open BFD abfd and translate the
1354 external form of the relocation information attached to sec into the
1355 internal canonical form. Place the table into memory at loc, which has
1356 been preallocated, usually by a call to bfd_get_reloc_upper_bound.
1357 Returns the number of relocs, or -1 on error. */
1358
1359static long
1360vms_canonicalize_reloc (abfd, section, location, symbols)
5f771d47
ILT
1361 bfd *abfd ATTRIBUTE_UNUSED;
1362 asection *section ATTRIBUTE_UNUSED;
1363 arelent **location ATTRIBUTE_UNUSED;
1364 asymbol **symbols ATTRIBUTE_UNUSED;
252b5132
RH
1365{
1366#if VMS_DEBUG
1367 vms_debug (1, "vms_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name);
1368#endif
1369 return false;
1370}
1371
1372/*---------------------------------------------------------------------------*/
1373/* this is just copied from ecoff-alpha, needs to be fixed probably */
1374
1375/* How to process the various reloc types. */
1376
1377static bfd_reloc_status_type
1378reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
5f771d47
ILT
1379 bfd *abfd ATTRIBUTE_UNUSED;
1380 arelent *reloc ATTRIBUTE_UNUSED;
1381 asymbol *sym ATTRIBUTE_UNUSED;
1382 PTR data ATTRIBUTE_UNUSED;
1383 asection *sec ATTRIBUTE_UNUSED;
1384 bfd *output_bfd ATTRIBUTE_UNUSED;
1385 char **error_message ATTRIBUTE_UNUSED;
252b5132
RH
1386{
1387#if VMS_DEBUG
1388 vms_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd);
1389 vms_debug (2, "In section %s, symbol %s\n",
1390 sec->name, sym->name);
1391 vms_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n",
1392 reloc->sym_ptr_ptr[0]->name,
1393 (unsigned long)reloc->address,
1394 (unsigned long)reloc->addend, reloc->howto->name);
1395 vms_debug (2, "data at %p\n", data);
1396/* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */
1397#endif
1398
1399 return bfd_reloc_ok;
1400}
1401
1402/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
1403 from smaller values. Start with zero, widen, *then* decrement. */
1404#define MINUS_ONE (((bfd_vma)0) - 1)
1405
1406static reloc_howto_type alpha_howto_table[] =
1407{
1408 HOWTO (ALPHA_R_IGNORE, /* type */
1409 0, /* rightshift */
1410 0, /* size (0 = byte, 1 = short, 2 = long) */
1411 8, /* bitsize */
1412 true, /* pc_relative */
1413 0, /* bitpos */
1414 complain_overflow_dont, /* complain_on_overflow */
1415 reloc_nil, /* special_function */
1416 "IGNORE", /* name */
1417 true, /* partial_inplace */
1418 0, /* src_mask */
1419 0, /* dst_mask */
1420 true), /* pcrel_offset */
1421
1422 /* A 64 bit reference to a symbol. */
1423 HOWTO (ALPHA_R_REFQUAD, /* type */
1424 0, /* rightshift */
1425 4, /* size (0 = byte, 1 = short, 2 = long) */
1426 64, /* bitsize */
1427 false, /* pc_relative */
1428 0, /* bitpos */
1429 complain_overflow_bitfield, /* complain_on_overflow */
1430 reloc_nil, /* special_function */
1431 "REFQUAD", /* name */
1432 true, /* partial_inplace */
1433 MINUS_ONE, /* src_mask */
1434 MINUS_ONE, /* dst_mask */
1435 false), /* pcrel_offset */
1436
1437 /* A 21 bit branch. The native assembler generates these for
1438 branches within the text segment, and also fills in the PC
1439 relative offset in the instruction. */
1440 HOWTO (ALPHA_R_BRADDR, /* type */
1441 2, /* rightshift */
1442 2, /* size (0 = byte, 1 = short, 2 = long) */
1443 21, /* bitsize */
1444 true, /* pc_relative */
1445 0, /* bitpos */
1446 complain_overflow_signed, /* complain_on_overflow */
1447 reloc_nil, /* special_function */
1448 "BRADDR", /* name */
1449 true, /* partial_inplace */
1450 0x1fffff, /* src_mask */
1451 0x1fffff, /* dst_mask */
1452 false), /* pcrel_offset */
1453
1454 /* A hint for a jump to a register. */
1455 HOWTO (ALPHA_R_HINT, /* type */
1456 2, /* rightshift */
1457 1, /* size (0 = byte, 1 = short, 2 = long) */
1458 14, /* bitsize */
1459 true, /* pc_relative */
1460 0, /* bitpos */
1461 complain_overflow_dont, /* complain_on_overflow */
1462 reloc_nil, /* special_function */
1463 "HINT", /* name */
1464 true, /* partial_inplace */
1465 0x3fff, /* src_mask */
1466 0x3fff, /* dst_mask */
1467 false), /* pcrel_offset */
1468
1469 /* 16 bit PC relative offset. */
1470 HOWTO (ALPHA_R_SREL16, /* type */
1471 0, /* rightshift */
1472 1, /* size (0 = byte, 1 = short, 2 = long) */
1473 16, /* bitsize */
1474 true, /* pc_relative */
1475 0, /* bitpos */
1476 complain_overflow_signed, /* complain_on_overflow */
1477 reloc_nil, /* special_function */
1478 "SREL16", /* name */
1479 true, /* partial_inplace */
1480 0xffff, /* src_mask */
1481 0xffff, /* dst_mask */
1482 false), /* pcrel_offset */
1483
1484 /* 32 bit PC relative offset. */
1485 HOWTO (ALPHA_R_SREL32, /* type */
1486 0, /* rightshift */
1487 2, /* size (0 = byte, 1 = short, 2 = long) */
1488 32, /* bitsize */
1489 true, /* pc_relative */
1490 0, /* bitpos */
1491 complain_overflow_signed, /* complain_on_overflow */
1492 reloc_nil, /* special_function */
1493 "SREL32", /* name */
1494 true, /* partial_inplace */
1495 0xffffffff, /* src_mask */
1496 0xffffffff, /* dst_mask */
1497 false), /* pcrel_offset */
1498
1499 /* A 64 bit PC relative offset. */
1500 HOWTO (ALPHA_R_SREL64, /* type */
1501 0, /* rightshift */
1502 4, /* size (0 = byte, 1 = short, 2 = long) */
1503 64, /* bitsize */
1504 true, /* pc_relative */
1505 0, /* bitpos */
1506 complain_overflow_signed, /* complain_on_overflow */
1507 reloc_nil, /* special_function */
1508 "SREL64", /* name */
1509 true, /* partial_inplace */
1510 MINUS_ONE, /* src_mask */
1511 MINUS_ONE, /* dst_mask */
1512 false), /* pcrel_offset */
1513
1514 /* Push a value on the reloc evaluation stack. */
1515 HOWTO (ALPHA_R_OP_PUSH, /* type */
1516 0, /* rightshift */
1517 0, /* size (0 = byte, 1 = short, 2 = long) */
1518 0, /* bitsize */
1519 false, /* pc_relative */
1520 0, /* bitpos */
1521 complain_overflow_dont, /* complain_on_overflow */
1522 reloc_nil, /* special_function */
1523 "OP_PUSH", /* name */
1524 false, /* partial_inplace */
1525 0, /* src_mask */
1526 0, /* dst_mask */
1527 false), /* pcrel_offset */
1528
1529 /* Store the value from the stack at the given address. Store it in
1530 a bitfield of size r_size starting at bit position r_offset. */
1531 HOWTO (ALPHA_R_OP_STORE, /* type */
1532 0, /* rightshift */
1533 4, /* size (0 = byte, 1 = short, 2 = long) */
1534 64, /* bitsize */
1535 false, /* pc_relative */
1536 0, /* bitpos */
1537 complain_overflow_dont, /* complain_on_overflow */
1538 reloc_nil, /* special_function */
1539 "OP_STORE", /* name */
1540 false, /* partial_inplace */
1541 0, /* src_mask */
1542 MINUS_ONE, /* dst_mask */
1543 false), /* pcrel_offset */
1544
1545 /* Subtract the reloc address from the value on the top of the
1546 relocation stack. */
1547 HOWTO (ALPHA_R_OP_PSUB, /* type */
1548 0, /* rightshift */
1549 0, /* size (0 = byte, 1 = short, 2 = long) */
1550 0, /* bitsize */
1551 false, /* pc_relative */
1552 0, /* bitpos */
1553 complain_overflow_dont, /* complain_on_overflow */
1554 reloc_nil, /* special_function */
1555 "OP_PSUB", /* name */
1556 false, /* partial_inplace */
1557 0, /* src_mask */
1558 0, /* dst_mask */
1559 false), /* pcrel_offset */
1560
1561 /* Shift the value on the top of the relocation stack right by the
1562 given value. */
1563 HOWTO (ALPHA_R_OP_PRSHIFT, /* type */
1564 0, /* rightshift */
1565 0, /* size (0 = byte, 1 = short, 2 = long) */
1566 0, /* bitsize */
1567 false, /* pc_relative */
1568 0, /* bitpos */
1569 complain_overflow_dont, /* complain_on_overflow */
1570 reloc_nil, /* special_function */
1571 "OP_PRSHIFT", /* name */
1572 false, /* partial_inplace */
1573 0, /* src_mask */
1574 0, /* dst_mask */
1575 false), /* pcrel_offset */
1576
1577 /* Hack. Linkage is done by linker. */
1578 HOWTO (ALPHA_R_LINKAGE, /* type */
1579 0, /* rightshift */
1580 8, /* size (0 = byte, 1 = short, 2 = long) */
1581 256, /* bitsize */
1582 false, /* pc_relative */
1583 0, /* bitpos */
1584 complain_overflow_dont, /* complain_on_overflow */
1585 reloc_nil, /* special_function */
1586 "LINKAGE", /* name */
1587 false, /* partial_inplace */
1588 0, /* src_mask */
1589 0, /* dst_mask */
1590 false), /* pcrel_offset */
1591
1592 /* A 32 bit reference to a symbol. */
1593 HOWTO (ALPHA_R_REFLONG, /* type */
1594 0, /* rightshift */
1595 2, /* size (0 = byte, 1 = short, 2 = long) */
1596 32, /* bitsize */
1597 false, /* pc_relative */
1598 0, /* bitpos */
1599 complain_overflow_bitfield, /* complain_on_overflow */
1600 reloc_nil, /* special_function */
1601 "REFLONG", /* name */
1602 true, /* partial_inplace */
1603 0xffffffff, /* src_mask */
1604 0xffffffff, /* dst_mask */
1605 false), /* pcrel_offset */
1606
1607 /* A 64 bit reference to a procedure, written as 32 bit value. */
1608 HOWTO (ALPHA_R_CODEADDR, /* type */
1609 0, /* rightshift */
1610 4, /* size (0 = byte, 1 = short, 2 = long) */
1611 64, /* bitsize */
1612 false, /* pc_relative */
1613 0, /* bitpos */
1614 complain_overflow_signed,/* complain_on_overflow */
1615 reloc_nil, /* special_function */
1616 "CODEADDR", /* name */
1617 false, /* partial_inplace */
1618 0xffffffff, /* src_mask */
1619 0xffffffff, /* dst_mask */
1620 false), /* pcrel_offset */
1621
1622};
1623
1624/* Return a pointer to a howto structure which, when invoked, will perform
1625 the relocation code on data from the architecture noted. */
1626
1627static const struct reloc_howto_struct *
1628vms_bfd_reloc_type_lookup (abfd, code)
5f771d47 1629 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
1630 bfd_reloc_code_real_type code;
1631{
1632 int alpha_type;
1633
1634#if VMS_DEBUG
1635 vms_debug (1, "vms_bfd_reloc_type_lookup(%p, %d)\t", abfd, code);
1636#endif
1637
1638 switch (code)
1639 {
1640 case BFD_RELOC_16: alpha_type = ALPHA_R_SREL16; break;
1641 case BFD_RELOC_32: alpha_type = ALPHA_R_REFLONG; break;
1642 case BFD_RELOC_64: alpha_type = ALPHA_R_REFQUAD; break;
1643 case BFD_RELOC_CTOR: alpha_type = ALPHA_R_REFQUAD; break;
1644 case BFD_RELOC_23_PCREL_S2: alpha_type = ALPHA_R_BRADDR; break;
1645 case BFD_RELOC_ALPHA_HINT: alpha_type = ALPHA_R_HINT; break;
1646 case BFD_RELOC_16_PCREL: alpha_type = ALPHA_R_SREL16; break;
1647 case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break;
1648 case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break;
1649 case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break;
1650 case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break;
1651 default:
1652 (*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code);
1653 return (const struct reloc_howto_struct *) NULL;
1654 }
1655#if VMS_DEBUG
1656 vms_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name);
1657#endif
1658 return &alpha_howto_table[alpha_type];
1659}
1660
252b5132
RH
1661/*-- Part 4.7, writing an object file ---------------------------------------*/
1662
1663/* Set the architecture and machine type in BFD abfd to arch and mach.
1664 Find the correct pointer to a structure and insert it into the arch_info
1665 pointer. */
1666
1667static boolean
1668vms_set_arch_mach (abfd, arch, mach)
1669 bfd *abfd;
5f771d47
ILT
1670 enum bfd_architecture arch ATTRIBUTE_UNUSED;
1671 unsigned long mach ATTRIBUTE_UNUSED;
252b5132
RH
1672{
1673#if VMS_DEBUG
1674 vms_debug (1, "vms_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach);
1675#endif
1676 abfd->arch_info = bfd_scan_arch("alpha");
1677
1678 return true;
1679}
1680
252b5132
RH
1681/* Sets the contents of the section section in BFD abfd to the data starting
1682 in memory at data. The data is written to the output section starting at
1683 offset offset for count bytes.
1684
1685 Normally true is returned, else false. Possible error returns are:
1686 o bfd_error_no_contents - The output section does not have the
1687 SEC_HAS_CONTENTS attribute, so nothing can be written to it.
1688 o and some more too */
1689
1690static boolean
1691vms_set_section_contents (abfd, section, location, offset, count)
1692 bfd *abfd;
1693 asection *section;
1694 PTR location;
1695 file_ptr offset;
1696 bfd_size_type count;
1697{
1698#if VMS_DEBUG
1699 vms_debug (1, "vms_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n",
1700 abfd, section->name, location, (long int)offset, (int)count);
1701 vms_debug (2, "secraw %d, seccooked %d\n", (int)section->_raw_size, (int)section->_cooked_size);
1702#endif
1703 return _bfd_save_vms_section(abfd, section, location, offset, count);
1704}
1705
252b5132
RH
1706/*-- Part 4.8, linker -------------------------------------------------------*/
1707
1708/* Get the size of the section headers. */
1709
1710static int
1711vms_sizeof_headers (abfd, reloc)
5f771d47
ILT
1712 bfd *abfd ATTRIBUTE_UNUSED;
1713 boolean reloc ATTRIBUTE_UNUSED;
252b5132
RH
1714{
1715#if VMS_DEBUG
1716 vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False");
1717#endif
1718 return 0;
1719}
1720
252b5132
RH
1721/* Provides default handling of relocation effort for back ends
1722 which can't be bothered to do it efficiently. */
1723
1724static bfd_byte *
1725vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
1726 relocateable, symbols)
5f771d47
ILT
1727 bfd *abfd ATTRIBUTE_UNUSED;
1728 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
1729 struct bfd_link_order *link_order ATTRIBUTE_UNUSED;
1730 bfd_byte *data ATTRIBUTE_UNUSED;
1731 boolean relocateable ATTRIBUTE_UNUSED;
1732 asymbol **symbols ATTRIBUTE_UNUSED;
252b5132
RH
1733{
1734#if VMS_DEBUG
1735 vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n",
1736 abfd, link_info, link_order, data, (relocateable)?"True":"False", symbols);
1737#endif
1738 return 0;
1739}
1740
252b5132
RH
1741/* ??? */
1742
1743static boolean
1744vms_bfd_relax_section (abfd, section, link_info, again)
5f771d47
ILT
1745 bfd *abfd ATTRIBUTE_UNUSED;
1746 asection *section ATTRIBUTE_UNUSED;
1747 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
1748 boolean *again ATTRIBUTE_UNUSED;
252b5132
RH
1749{
1750#if VMS_DEBUG
1751 vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, <ret>)\n",
1752 abfd, section->name, link_info);
1753#endif
1754 return true;
1755}
1756
1757static boolean
1758vms_bfd_gc_sections (abfd, link_info)
5f771d47
ILT
1759 bfd *abfd ATTRIBUTE_UNUSED;
1760 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
252b5132
RH
1761{
1762#if VMS_DEBUG
1763 vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info);
1764#endif
1765 return true;
1766}
1767
8550eb6e
JJ
1768static boolean
1769vms_bfd_merge_sections (abfd, link_info)
1770 bfd *abfd ATTRIBUTE_UNUSED;
1771 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
1772{
1773#if VMS_DEBUG
1774 vms_debug (1, "vms_bfd_merge_sections(%p, %p)\n", abfd, link_info);
1775#endif
1776 return true;
1777}
1778
252b5132
RH
1779/* Create a hash table for the linker. Different backends store
1780 different information in this table. */
1781
1782static struct bfd_link_hash_table *
1783vms_bfd_link_hash_table_create (abfd)
5f771d47 1784 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
1785{
1786#if VMS_DEBUG
1787 vms_debug (1, "vms_bfd_link_hash_table_create(%p)\n", abfd);
1788#endif
1789 return 0;
1790}
1791
252b5132
RH
1792/* Add symbols from this object file into the hash table. */
1793
1794static boolean
1795vms_bfd_link_add_symbols (abfd, link_info)
5f771d47
ILT
1796 bfd *abfd ATTRIBUTE_UNUSED;
1797 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
252b5132
RH
1798{
1799#if VMS_DEBUG
1800 vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info);
1801#endif
1802 return false;
1803}
1804
252b5132
RH
1805/* Do a link based on the link_order structures attached to each
1806 section of the BFD. */
1807
1808static boolean
1809vms_bfd_final_link (abfd, link_info)
5f771d47
ILT
1810 bfd *abfd ATTRIBUTE_UNUSED;
1811 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
252b5132
RH
1812{
1813#if VMS_DEBUG
1814 vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info);
1815#endif
1816 return true;
1817}
1818
1819/* Should this section be split up into smaller pieces during linking. */
1820
1821static boolean
1822vms_bfd_link_split_section (abfd, section)
5f771d47
ILT
1823 bfd *abfd ATTRIBUTE_UNUSED;
1824 asection *section ATTRIBUTE_UNUSED;
252b5132
RH
1825{
1826#if VMS_DEBUG
1827 vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name);
1828#endif
1829 return false;
1830}
1831
1832/*-- Part 4.9, dynamic symbols and relocations ------------------------------*/
1833
1834/* Get the amount of memory required to hold the dynamic symbols. */
1835
1836static long
1837vms_get_dynamic_symtab_upper_bound (abfd)
5f771d47 1838 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
1839{
1840#if VMS_DEBUG
1841 vms_debug (1, "vms_get_dynamic_symtab_upper_bound(%p)\n", abfd);
1842#endif
1843 return 0;
1844}
1845
1846static boolean
1847vms_bfd_print_private_bfd_data (abfd, file)
5f771d47
ILT
1848 bfd *abfd ATTRIBUTE_UNUSED;
1849 void *file ATTRIBUTE_UNUSED;
252b5132
RH
1850{
1851#if VMS_DEBUG
1852 vms_debug (1, "vms_bfd_print_private_bfd_data(%p)\n", abfd);
1853#endif
1854 return 0;
1855}
1856
252b5132
RH
1857/* Read in the dynamic symbols. */
1858
1859static long
1860vms_canonicalize_dynamic_symtab (abfd, symbols)
5f771d47
ILT
1861 bfd *abfd ATTRIBUTE_UNUSED;
1862 asymbol **symbols ATTRIBUTE_UNUSED;
252b5132
RH
1863{
1864#if VMS_DEBUG
1865 vms_debug (1, "vms_canonicalize_dynamic_symtab(%p, <ret>)\n", abfd);
1866#endif
1867 return 0L;
1868}
1869
252b5132
RH
1870/* Get the amount of memory required to hold the dynamic relocs. */
1871
1872static long
1873vms_get_dynamic_reloc_upper_bound (abfd)
5f771d47 1874 bfd *abfd ATTRIBUTE_UNUSED;
252b5132
RH
1875{
1876#if VMS_DEBUG
1877 vms_debug (1, "vms_get_dynamic_reloc_upper_bound(%p)\n", abfd);
1878#endif
1879 return 0L;
1880}
1881
252b5132
RH
1882/* Read in the dynamic relocs. */
1883
1884static long
1885vms_canonicalize_dynamic_reloc (abfd, arel, symbols)
5f771d47
ILT
1886 bfd *abfd ATTRIBUTE_UNUSED;
1887 arelent **arel ATTRIBUTE_UNUSED;
1888 asymbol **symbols ATTRIBUTE_UNUSED;
252b5132
RH
1889{
1890#if VMS_DEBUG
1891 vms_debug (1, "vms_canonicalize_dynamic_reloc(%p)\n", abfd);
1892#endif
1893 return 0L;
1894}
This page took 0.248335 seconds and 4 git commands to generate.