1 /* vms.c -- BFD back-end for VAX (openVMS/VAX) and
2 EVAX (openVMS/Alpha) files.
3 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
8 Written by Klaus K"ampf (kkaempf@rmi.de)
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23 MA 02110-1301, USA. */
29 #define RME$C_SETRFM 0x00000001
40 static bfd_boolean
vms_initialize (bfd
*);
41 static bfd_boolean
fill_section_ptr (struct bfd_hash_entry
*, PTR
);
42 static bfd_boolean
vms_fixup_sections (bfd
*);
43 static bfd_boolean
copy_symbols (struct bfd_hash_entry
*, PTR
);
44 static bfd_reloc_status_type
reloc_nil (bfd
*, arelent
*, asymbol
*, PTR
,
45 asection
*, bfd
*, char **);
46 static int vms_slurp_module (bfd
*abfd
);
47 static int vms_slurp_image (bfd
*abfd
);
48 static const struct bfd_target
*vms_object_p (bfd
*abfd
);
49 static bfd_boolean
vms_mkobject (bfd
*abfd
);
50 static bfd_boolean
vms_write_object_contents (bfd
*abfd
);
51 static void free_reloc_stream (bfd
*abfd
, asection
*section
, void *data
);
52 static bfd_boolean
vms_close_and_cleanup (bfd
*abfd
);
53 static bfd_boolean
vms_new_section_hook (bfd
*abfd
, asection
*section
);
54 static bfd_boolean vms_get_section_contents
55 (bfd
*abfd
, asection
*section
, PTR x1
, file_ptr x2
, bfd_size_type x3
);
56 static long vms_get_symtab_upper_bound (bfd
*abfd
);
57 static long vms_canonicalize_symtab (bfd
*abfd
, asymbol
**symbols
);
58 static void vms_print_symbol (bfd
*abfd
, PTR file
, asymbol
*symbol
,
59 bfd_print_symbol_type how
);
60 static void vms_get_symbol_info (bfd
*abfd
, asymbol
*symbol
, symbol_info
*ret
);
61 static bfd_boolean
vms_bfd_is_local_label_name (bfd
*abfd
, const char *);
62 static bfd_boolean vms_find_nearest_line
63 (bfd
*abfd
, asection
*section
, asymbol
**symbols
, bfd_vma offset
,
64 const char **file
, const char **func
, unsigned int *line
);
65 static void alloc_reloc_stream (bfd
*abfd
, asection
*section
,
67 static bfd_boolean
vms_slurp_reloc_table (bfd
*abfd
, asection
*section
,
69 static long vms_get_reloc_upper_bound (bfd
*abfd
, asection
*sect
);
70 static long vms_canonicalize_reloc (bfd
*abfd
, asection
*srcsec
,
71 arelent
**location
, asymbol
**symbols
);
72 static const struct reloc_howto_struct
*vms_bfd_reloc_type_lookup
73 (bfd
*abfd
, bfd_reloc_code_real_type code
);
74 static bfd_boolean vms_set_arch_mach
75 (bfd
*abfd
, enum bfd_architecture arch
, unsigned long mach
);
76 static bfd_boolean vms_set_section_contents
77 (bfd
*abfd
, asection
*section
, const PTR location
, file_ptr offset
,
80 #define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
81 #define vms_make_empty_symbol _bfd_generic_make_empty_symbol
82 #define vms_bfd_link_just_syms _bfd_generic_link_just_syms
83 #define vms_bfd_copy_link_hash_symbol_type \
84 _bfd_generic_copy_link_hash_symbol_type
85 #define vms_bfd_is_group_section bfd_generic_is_group_section
86 #define vms_bfd_discard_group bfd_generic_discard_group
87 #define vms_section_already_linked _bfd_generic_section_already_linked
88 #define vms_bfd_define_common_symbol bfd_generic_define_common_symbol
89 #define vms_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
90 #define vms_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab
92 #define vms_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
93 #define vms_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
94 #define vms_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
95 #define vms_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
96 #define vms_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
97 #define vms_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
98 #define vms_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
99 #define vms_read_minisymbols _bfd_generic_read_minisymbols
100 #define vms_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
101 #define vms_get_lineno _bfd_nosymbols_get_lineno
102 #define vms_find_inliner_info _bfd_nosymbols_find_inliner_info
103 #define vms_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
106 /* Cause debug info to be emitted for the structure. */
107 struct vms_private_data_struct _vms_private_data_struct_dummy
;
108 struct vms_section_data_struct _vms_section_data_struct_dummy
;
111 extern const bfd_target vms_vax_vec
;
112 extern const bfd_target vms_alpha_vec
;
114 /* Initialize private data */
116 vms_initialize (bfd
* abfd
)
120 bfd_set_start_address (abfd
, (bfd_vma
) -1);
122 amt
= sizeof (struct vms_private_data_struct
);
123 abfd
->tdata
.any
= bfd_zalloc (abfd
, amt
);
124 if (abfd
->tdata
.any
== NULL
)
127 if (bfd_get_flavour (abfd
) == bfd_target_ovax_flavour
)
128 PRIV (is_vax
) = TRUE
;
130 PRIV (file_format
) = FF_UNKNOWN
;
132 amt
= sizeof (struct stack_struct
) * STACKSIZE
;
133 PRIV (stack
) = bfd_alloc (abfd
, amt
);
134 if (PRIV (stack
) == NULL
)
137 amt
= sizeof (struct bfd_hash_table
);
138 PRIV (vms_symbol_table
) = bfd_alloc (abfd
, amt
);
139 if (PRIV (vms_symbol_table
) == NULL
)
142 if (!bfd_hash_table_init (PRIV (vms_symbol_table
), _bfd_vms_hash_newfunc
,
143 sizeof (vms_symbol_entry
)))
146 amt
= MAX_OUTREC_SIZE
;
147 PRIV (output_buf
) = bfd_alloc (abfd
, amt
);
148 if (PRIV (output_buf
) == NULL
)
151 PRIV (length_pos
) = 2;
156 bfd_hash_table_free (PRIV (vms_symbol_table
));
158 bfd_release (abfd
, abfd
->tdata
.any
);
159 abfd
->tdata
.any
= NULL
;
165 unsigned int section_count
;
169 /* Fill symbol->section with section pointer.
171 symbol->section is filled with the section index for defined symbols
172 during reading the GSD/EGSD section. But we need the pointer to the
175 It has the correct value for referenced (undefined section) symbols.
177 Called from bfd_hash_traverse in vms_fixup_sections. */
180 fill_section_ptr (struct bfd_hash_entry
*entry
, void *sections
)
182 asymbol
*sym
= ((vms_symbol_entry
*)entry
)->symbol
;
183 struct pair
*data
= (struct pair
*)sections
;
184 unsigned long sec
= (unsigned long)sym
->section
;
186 vms_debug2 ((6, "fill_section_ptr: sym %p, sec %lu\n", sym
, sec
));
188 if (sec
< data
->section_count
)
190 sym
->section
= data
->sections
[sec
];
192 if (strcmp (sym
->name
, sym
->section
->name
) == 0)
193 sym
->flags
|= BSF_SECTION_SYM
;
195 else if (sec
== (unsigned long)-1)
196 sym
->section
= &bfd_und_section
;
201 /* Fixup section pointers in symbols. */
203 vms_fixup_sections (bfd
* abfd
)
207 if (PRIV (fixup_done
))
210 data
.section_count
= PRIV (section_count
);
211 data
.sections
= PRIV (sections
);
212 bfd_hash_traverse (PRIV (vms_symbol_table
), fill_section_ptr
, &data
);
214 PRIV (fixup_done
) = TRUE
;
218 /* Slurp an ordered set of VMS object records. */
220 _bfd_vms_slurp_object_records (bfd
* abfd
)
222 int err
, new_type
, type
= -1;
226 vms_debug2 ((7, "reading at %08lx\n", bfd_tell (abfd
)));
228 new_type
= _bfd_vms_get_object_record (abfd
);
231 vms_debug2 ((2, "next_record failed\n"));
235 if (type
== EOBJ_S_C_EGSD
&& new_type
!= EOBJ_S_C_EGSD
)
237 if (! vms_fixup_sections (abfd
))
239 vms_debug2 ((2, "vms_fixup_sections failed\n"));
250 err
= _bfd_vms_slurp_hdr (abfd
, type
);
255 err
= _bfd_vms_slurp_eom (abfd
, type
);
259 err
= _bfd_vms_slurp_gsd (abfd
, type
);
263 err
= _bfd_vms_slurp_tir (abfd
, type
);
267 err
= _bfd_vms_slurp_dbg (abfd
, type
);
268 PRIV (dst_ptr_end
) = PRIV (image_ptr
);
272 err
= _bfd_vms_slurp_tbt (abfd
, type
);
273 PRIV (dst_ptr_end
) = PRIV (image_ptr
);
276 err
= _bfd_vms_slurp_lnk (abfd
, type
);
283 vms_debug2 ((2, "slurp type %d failed with %d\n", type
, err
));
287 while (type
!= EOBJ_S_C_EEOM
&& type
!= OBJ_S_C_EOM
&& type
!= OBJ_S_C_EOMW
);
292 /* Slurp a VMS module and return an error status. */
295 vms_slurp_module (bfd
*abfd
)
300 type
= PRIV (vms_rec
)[0];
302 type
= bfd_getl16 (PRIV (vms_rec
));
304 err
= _bfd_vms_slurp_hdr (abfd
, type
);
307 bfd_set_error (bfd_error_wrong_format
);
311 return _bfd_vms_slurp_object_records (abfd
);
314 /* Slurp a VMS image and return an error status. */
317 vms_slurp_image (bfd
*abfd
)
319 unsigned int isd_offset
, ihs_offset
;
322 err
= _bfd_vms_slurp_ihd (abfd
, &isd_offset
, &ihs_offset
);
325 bfd_set_error (bfd_error_wrong_format
);
329 err
= _bfd_vms_slurp_isd (abfd
, isd_offset
);
332 bfd_set_error (bfd_error_wrong_format
);
336 return _bfd_vms_slurp_ihs (abfd
, ihs_offset
);
339 /* Check the format for a file being read.
340 Return a (bfd_target *) if it's an object file or zero if not. */
342 static const struct bfd_target
*
343 vms_object_p (bfd
*abfd
)
345 const struct bfd_target
*target_vector
;
346 const bfd_arch_info_type
*arch
;
347 PTR tdata_save
= abfd
->tdata
.any
;
348 bfd_vma saddr_save
= bfd_get_start_address (abfd
);
351 vms_debug2 ((1, "vms_object_p(%p)\n", abfd
));
353 if (!vms_initialize (abfd
))
356 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
))
357 goto err_wrong_format
;
359 switch (_bfd_vms_get_first_record (abfd
))
367 err
= vms_slurp_module (abfd
);
371 err
= vms_slurp_image (abfd
);
376 goto err_wrong_format
;
380 if (! vms_fixup_sections (abfd
))
382 vms_debug2 ((2, "vms_fixup_sections failed\n"));
383 goto err_wrong_format
;
386 target_vector
= &vms_vax_vec
;
387 arch
= bfd_scan_arch ("vax");
389 vms_debug2 ((2, "arch is vax\n"));
393 /* Set arch_info to alpha. */
394 target_vector
= &vms_alpha_vec
;
395 arch
= bfd_scan_arch ("alpha");
396 vms_debug2 ((2, "arch is alpha\n"));
399 abfd
->arch_info
= arch
;
400 return target_vector
;
403 bfd_set_error (bfd_error_wrong_format
);
406 if (abfd
->tdata
.any
!= tdata_save
&& abfd
->tdata
.any
!= NULL
)
407 bfd_release (abfd
, abfd
->tdata
.any
);
408 abfd
->tdata
.any
= tdata_save
;
409 bfd_set_start_address (abfd
, saddr_save
);
413 /* Set the format of a file being written. */
416 vms_mkobject (bfd
* abfd
)
418 const bfd_arch_info_type
*arch
;
420 vms_debug2 ((1, "vms_mkobject (%p)\n", abfd
));
422 if (!vms_initialize (abfd
))
426 arch
= bfd_scan_arch ("vax");
428 arch
= bfd_scan_arch ("alpha");
432 bfd_set_error(bfd_error_wrong_format
);
436 abfd
->arch_info
= arch
;
440 /* Write cached information into a file being written, at bfd_close. */
443 vms_write_object_contents (bfd
* abfd
)
445 vms_debug2 ((1, "vms_write_object_contents (%p)\n", abfd
));
447 if (abfd
->section_count
> 0) /* we have sections */
451 if (_bfd_vms_write_hdr (abfd
, OBJ_S_C_HDR
) != 0)
453 if (_bfd_vms_write_gsd (abfd
, OBJ_S_C_GSD
) != 0)
455 if (_bfd_vms_write_tir (abfd
, OBJ_S_C_TIR
) != 0)
457 if (_bfd_vms_write_tbt (abfd
, OBJ_S_C_TBT
) != 0)
459 if (_bfd_vms_write_dbg (abfd
, OBJ_S_C_DBG
) != 0)
461 if (abfd
->section_count
> 255)
463 if (_bfd_vms_write_eom (abfd
, OBJ_S_C_EOMW
) != 0)
468 if (_bfd_vms_write_eom (abfd
, OBJ_S_C_EOM
) != 0)
474 if (_bfd_vms_write_hdr (abfd
, EOBJ_S_C_EMH
) != 0)
476 if (_bfd_vms_write_gsd (abfd
, EOBJ_S_C_EGSD
) != 0)
478 if (_bfd_vms_write_tir (abfd
, EOBJ_S_C_ETIR
) != 0)
480 if (_bfd_vms_write_tbt (abfd
, EOBJ_S_C_ETBT
) != 0)
482 if (_bfd_vms_write_dbg (abfd
, EOBJ_S_C_EDBG
) != 0)
484 if (_bfd_vms_write_eom (abfd
, EOBJ_S_C_EEOM
) != 0)
493 /* Free the reloc buffer for the specified section. */
496 free_reloc_stream (bfd
*abfd ATTRIBUTE_UNUSED
, asection
*section
,
497 void *data ATTRIBUTE_UNUSED
)
499 if (vms_section_data (section
)->reloc_stream
)
500 free (vms_section_data (section
)->reloc_stream
);
504 /* Convert the file to variable record length format. This is done
505 using undocumented system call sys$modify().
509 vms_convert_to_var (char *vms_filename
)
511 struct FAB fab
= cc$rms_fab
;
513 fab
.fab$l_fna
= vms_filename
;
514 fab
.fab$b_fns
= strlen (vms_filename
);
515 fab
.fab$b_fac
= FAB$M_PUT
;
516 fab
.fab$l_fop
= FAB$M_ESC
;
517 fab
.fab$l_ctx
= RME$C_SETRFM
;
521 fab
.fab$b_rfm
= FAB$C_VAR
;
528 vms_convert_to_var_1 (char *filename
, int type
)
530 if (type
!= DECC$K_FILE
)
532 vms_convert_to_var (filename
);
536 /* Convert the file to variable record length format. This is done
537 using undocumented system call sys$modify().
538 Unix filename version. */
541 vms_convert_to_var_unix_filename (const char *unix_filename
)
543 if (decc$
to_vms (unix_filename
, &vms_convert_to_var_1
, 0, 1) != 1)
549 /* Called when the BFD is being closed to do any necessary cleanup. */
552 vms_close_and_cleanup (bfd
* abfd
)
554 vms_debug2 ((1, "vms_close_and_cleanup (%p)\n", abfd
));
556 if (abfd
== NULL
|| abfd
->tdata
.any
== NULL
)
559 if (PRIV (vms_buf
) != NULL
)
560 free (PRIV (vms_buf
));
562 if (PRIV (sections
) != NULL
)
563 free (PRIV (sections
));
565 if (PRIV (vms_symbol_table
))
566 bfd_hash_table_free (PRIV (vms_symbol_table
));
568 bfd_map_over_sections (abfd
, free_reloc_stream
, NULL
);
570 bfd_release (abfd
, abfd
->tdata
.any
);
571 abfd
->tdata
.any
= NULL
;
574 if (abfd
->direction
== write_direction
)
576 /* Last step on VMS is to convert the file to variable record length
578 if (bfd_cache_close (abfd
) != TRUE
)
580 if (vms_convert_to_var_unix_filename (abfd
->filename
) != TRUE
)
588 /* Called when a new section is created. */
591 vms_new_section_hook (bfd
* abfd
, asection
*section
)
595 /* Count hasn't been incremented yet. */
596 unsigned int section_count
= abfd
->section_count
+ 1;
598 vms_debug2 ((1, "vms_new_section_hook (%p, [%d]%s), count %d\n",
599 abfd
, section
->index
, section
->name
, section_count
));
601 bfd_set_section_alignment (abfd
, section
, 0);
603 if (section_count
> PRIV (section_count
))
606 amt
*= sizeof (asection
*);
607 PRIV (sections
) = bfd_realloc_or_free (PRIV (sections
), amt
);
608 if (PRIV (sections
) == NULL
)
610 PRIV (section_count
) = section_count
;
613 vms_debug2 ((6, "section_count: %d\n", PRIV (section_count
)));
615 PRIV (sections
)[section
->index
] = section
;
617 vms_debug2 ((7, "%d: %s\n", section
->index
, section
->name
));
619 amt
= sizeof (struct vms_section_data_struct
);
620 section
->used_by_bfd
= (PTR
) bfd_zalloc (abfd
, amt
);
621 if (section
->used_by_bfd
== NULL
)
624 return _bfd_generic_new_section_hook (abfd
, section
);
627 /* Read the contents of a section.
628 buf points to a buffer of buf_size bytes to be filled with
629 section data (starting at offset into section) */
632 vms_get_section_contents (bfd
* abfd ATTRIBUTE_UNUSED
,
633 asection
*section ATTRIBUTE_UNUSED
,
634 void * buf ATTRIBUTE_UNUSED
,
635 file_ptr offset ATTRIBUTE_UNUSED
,
636 bfd_size_type buf_size ATTRIBUTE_UNUSED
)
638 bfd_size_type size
= section
->size
;
640 vms_debug2 ((1, "vms_get_section_contents (%p, %s, %p, off %ld, size %d)\n",
641 abfd
, section
->name
, buf
, offset
, (int)buf_size
));
643 if (section
->contents
)
646 section
->contents
= (unsigned char *) bfd_malloc (size
);
648 if (section
->contents
== NULL
)
650 bfd_set_error (bfd_error_no_memory
);
654 if (bfd_seek (abfd
, section
->filepos
, SEEK_SET
))
656 bfd_set_error (bfd_error_file_truncated
);
660 if (bfd_bread (section
->contents
, size
, abfd
) != size
)
662 bfd_set_error (bfd_error_file_truncated
);
666 section
->flags
|= SEC_IN_MEMORY
;
669 memcpy (buf
, section
->contents
+ offset
, (size_t) buf_size
);
674 /* Part 4.5, symbols. */
676 /* Return the number of bytes required to store a vector of pointers
677 to asymbols for all the symbols in the BFD abfd, including a
678 terminal NULL pointer. If there are no symbols in the BFD,
679 then return 0. If an error occurs, return -1. */
682 vms_get_symtab_upper_bound (bfd
* abfd
)
684 vms_debug2 ((1, "vms_get_symtab_upper_bound (%p), %d symbols\n",
685 abfd
, PRIV (gsd_sym_count
)));
687 return (PRIV (gsd_sym_count
) + 1) * sizeof (asymbol
*);
690 /* Copy symbols from hash table to symbol vector
692 called from bfd_hash_traverse in vms_canonicalize_symtab
693 init counter to 0 if entry == 0. */
696 copy_symbols (struct bfd_hash_entry
*entry
, void * arg
)
698 bfd
* abfd
= (bfd
*) arg
;
700 if (entry
== NULL
) /* Init counter. */
702 else /* Fill vector, inc counter. */
703 PRIV (symcache
)[PRIV (symnum
)++] = ((vms_symbol_entry
*)entry
)->symbol
;
708 /* Read the symbols from the BFD abfd, and fills in the vector
709 location with pointers to the symbols and a trailing NULL.
711 Return number of symbols read. */
714 vms_canonicalize_symtab (bfd
* abfd
, asymbol
**symbols
)
716 vms_debug2 ((1, "vms_canonicalize_symtab (%p, <ret>)\n", abfd
));
719 copy_symbols (NULL
, abfd
);
721 /* Traverse table and fill symbols vector. */
722 PRIV (symcache
) = symbols
;
723 bfd_hash_traverse (PRIV (vms_symbol_table
), copy_symbols
, abfd
);
725 symbols
[PRIV (gsd_sym_count
)] = NULL
;
727 return PRIV (gsd_sym_count
);
730 /* Print symbol to file according to how. how is one of
731 bfd_print_symbol_name just print the name
732 bfd_print_symbol_more print more (???)
733 bfd_print_symbol_all print all we know, which is not much right now :-). */
736 vms_print_symbol (bfd
* abfd
,
739 bfd_print_symbol_type how
)
741 vms_debug2 ((1, "vms_print_symbol (%p, %p, %p, %d)\n",
742 abfd
, file
, symbol
, how
));
746 case bfd_print_symbol_name
:
747 case bfd_print_symbol_more
:
748 fprintf ((FILE *)file
," %s", symbol
->name
);
751 case bfd_print_symbol_all
:
753 const char *section_name
= symbol
->section
->name
;
755 bfd_print_symbol_vandf (abfd
, file
, symbol
);
757 fprintf ((FILE *) file
," %-8s %s", section_name
, symbol
->name
);
763 /* Return information about symbol in ret.
765 fill type, value and name
770 D data segment symbol
772 t a static function symbol
773 T text segment symbol
778 vms_get_symbol_info (bfd
* abfd ATTRIBUTE_UNUSED
,
784 vms_debug2 ((1, "vms_get_symbol_info (%p, %p, %p)\n", abfd
, symbol
, ret
));
786 sec
= symbol
->section
;
793 else if (bfd_is_com_section (sec
))
795 else if (bfd_is_abs_section (sec
))
797 else if (bfd_is_und_section (sec
))
799 else if (bfd_is_ind_section (sec
))
801 else if (bfd_get_section_flags (abfd
, sec
) & SEC_CODE
)
803 else if (bfd_get_section_flags (abfd
, sec
) & SEC_DATA
)
805 else if (bfd_get_section_flags (abfd
, sec
) & SEC_ALLOC
)
810 if (ret
->type
!= 'U')
811 ret
->value
= symbol
->value
+ symbol
->section
->vma
;
814 ret
->name
= symbol
->name
;
817 /* Return TRUE if the given symbol sym in the BFD abfd is
818 a compiler generated local label, else return FALSE. */
821 vms_bfd_is_local_label_name (bfd
* abfd ATTRIBUTE_UNUSED
,
824 vms_debug2 ((1, "vms_bfd_is_local_label_name (%p, %s)\n", abfd
, name
));
825 return name
[0] == '$';
828 /* Provided a BFD, a section and an offset into the section, calculate and
829 return the name of the source file and the line nearest to the wanted
833 vms_find_nearest_line (bfd
* abfd ATTRIBUTE_UNUSED
,
834 asection
*section ATTRIBUTE_UNUSED
,
835 asymbol
**symbols ATTRIBUTE_UNUSED
,
836 bfd_vma offset ATTRIBUTE_UNUSED
,
837 const char **file ATTRIBUTE_UNUSED
,
838 const char **func ATTRIBUTE_UNUSED
,
839 unsigned int *line ATTRIBUTE_UNUSED
)
841 vms_debug2 ((1, "vms_find_nearest_line (%p, %s, %p, %ld, ...)\n",
842 abfd
, section
->name
, symbols
, (long int)offset
));
843 return _bfd_vms_find_nearest_dst_line (abfd
, section
, symbols
, offset
, file
, func
, line
);
846 /* Part 4.6, relocations. */
848 /* Allocate the reloc buffer for the specified section. */
851 alloc_reloc_stream (bfd
*abfd ATTRIBUTE_UNUSED
, asection
*section
,
856 /* If there were no relocations, there is nothing to do. */
857 if (section
->reloc_count
== 0)
860 ptr
= bfd_malloc (vms_section_data (section
)->reloc_size
);
863 *(bfd_boolean
*)alloc_error
= TRUE
;
867 vms_section_data (section
)->reloc_stream
= ptr
;
870 /* Read in the relocs for the specified section and internalize them.
872 The implementation is loosely based on the SOM code and made up
873 of 3 distinct phases:
875 1. When the VMS object is opened and parsed, the number and the size
876 of the relocations are computed for all sections. This makes it
877 possible to know upfront both which sections have no relocs and
878 the size of the reloc buffers for the other sections, at virtually
879 no cost for consumers that don't care about relocs at all.
881 2. When vms_slurp_reloc_table is invoked for the first time on a section
882 with relocs, the object is traversed and all the reloc information
883 is saved in per-section reloc buffers. It would be very inefficient
884 to scan the whole file on each invocation, so we slurp for all the
887 3. On subsequent invocations of vms_slurp_reloc_table, the relocs for the
888 specified section are fetched from the buffer, decoded and internalized.
889 The buffer is then freed since the internalized relocs are attached to
890 the section, turning additional invocations of vms_slurp_reloc_table
891 on the same section into no-ops.
893 Since VMS objects have very few sections, it could be profitable to merge
894 phase #2 and phase #3, i.e. to decode and internalize the relocs for all
895 the sections at once. The current implementation is more elegant. */
898 vms_slurp_reloc_table (bfd
*abfd
, asection
*section
, asymbol
**symbols
)
900 arelent
*internal_relocs
;
904 /* If there were no relocations, there is nothing to do. */
905 if (section
->reloc_count
== 0)
908 /* Return saved information about the relocations if it is available. */
909 if (section
->relocation
!= NULL
)
912 /* If the relocation stream has not been slurped, do it now. */
913 if (vms_section_data (section
)->reloc_stream
== NULL
)
915 bfd_boolean alloc_error
= FALSE
;
918 /* Size the reloc buffer for each section. */
919 bfd_map_over_sections (abfd
, alloc_reloc_stream
, &alloc_error
);
923 if (bfd_seek (abfd
, 0, SEEK_SET
) != 0)
926 /* Reset section pointer. */
927 PRIV (image_section
) = NULL
;
931 type
= _bfd_vms_get_object_record (abfd
);
932 if (type
!= EOBJ_S_C_ETIR
933 && type
!= EOBJ_S_C_EDBG
934 && type
!= EOBJ_S_C_ETBT
)
936 err
= _bfd_vms_slurp_relocs (abfd
);
939 vms_debug2 ((2, "slurp relocs failed with %d\n", err
));
943 while (type
!= EOBJ_S_C_EEOM
);
946 amt
= section
->reloc_count
* sizeof (arelent
);
947 internal_relocs
= (arelent
*) bfd_zalloc (abfd
, amt
);
948 if (internal_relocs
== NULL
)
951 /* Decode and internalize the relocations. */
952 err
= _bfd_vms_decode_relocs (abfd
, internal_relocs
, section
, symbols
);
955 vms_debug2 ((2, "decode relocs failed with %d\n", err
));
959 /* We're done with the external relocations. Free them. */
960 free (vms_section_data (section
)->reloc_stream
);
961 vms_section_data (section
)->reloc_stream
= NULL
;
963 /* Save our results and return success. */
964 section
->relocation
= internal_relocs
;
968 /* Return the number of bytes required to store the relocation
969 information associated with the given section. */
972 vms_get_reloc_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
, asection
*section
)
974 return (section
->reloc_count
+ 1) * sizeof (arelent
*);
977 /* Convert relocations from VMS (external) form into BFD internal
978 form. Return the number of relocations. */
981 vms_canonicalize_reloc (bfd
*abfd
, asection
*section
, arelent
**relptr
,
987 if (! vms_slurp_reloc_table (abfd
, section
, symbols
))
990 count
= section
->reloc_count
;
991 tblptr
= section
->relocation
;
994 *relptr
++ = tblptr
++;
996 *relptr
= (arelent
*) NULL
;
997 return section
->reloc_count
;
1000 /* This is just copied from ecoff-alpha, needs to be fixed probably. */
1002 /* How to process the various reloc types. */
1004 static bfd_reloc_status_type
1005 reloc_nil (bfd
* abfd ATTRIBUTE_UNUSED
,
1006 arelent
*reloc ATTRIBUTE_UNUSED
,
1007 asymbol
*sym ATTRIBUTE_UNUSED
,
1008 void * data ATTRIBUTE_UNUSED
,
1009 asection
*sec ATTRIBUTE_UNUSED
,
1010 bfd
*output_bfd ATTRIBUTE_UNUSED
,
1011 char **error_message ATTRIBUTE_UNUSED
)
1014 vms_debug (1, "reloc_nil (abfd %p, output_bfd %p)\n", abfd
, output_bfd
);
1015 vms_debug (2, "In section %s, symbol %s\n",
1016 sec
->name
, sym
->name
);
1017 vms_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n",
1018 reloc
->sym_ptr_ptr
[0]->name
,
1019 (unsigned long)reloc
->address
,
1020 (unsigned long)reloc
->addend
, reloc
->howto
->name
);
1021 vms_debug (2, "data at %p\n", data
);
1022 /* _bfd_hexdump (2, data, bfd_get_reloc_size (reloc->howto), 0); */
1025 return bfd_reloc_ok
;
1028 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
1029 from smaller values. Start with zero, widen, *then* decrement. */
1030 #define MINUS_ONE (((bfd_vma)0) - 1)
1032 static reloc_howto_type alpha_howto_table
[] =
1034 HOWTO (ALPHA_R_IGNORE
, /* Type. */
1035 0, /* Rightshift. */
1036 0, /* Size (0 = byte, 1 = short, 2 = long). */
1038 TRUE
, /* PC relative. */
1040 complain_overflow_dont
,/* Complain_on_overflow. */
1041 reloc_nil
, /* Special_function. */
1042 "IGNORE", /* Name. */
1043 TRUE
, /* Partial_inplace. */
1044 0, /* Source mask */
1046 TRUE
), /* PC rel offset. */
1048 /* A 64 bit reference to a symbol. */
1049 HOWTO (ALPHA_R_REFQUAD
, /* Type. */
1050 0, /* Rightshift. */
1051 4, /* Size (0 = byte, 1 = short, 2 = long). */
1053 FALSE
, /* PC relative. */
1055 complain_overflow_bitfield
, /* Complain_on_overflow. */
1056 reloc_nil
, /* Special_function. */
1057 "REFQUAD", /* Name. */
1058 TRUE
, /* Partial_inplace. */
1059 MINUS_ONE
, /* Source mask. */
1060 MINUS_ONE
, /* Dest mask. */
1061 FALSE
), /* PC rel offset. */
1063 /* A 21 bit branch. The native assembler generates these for
1064 branches within the text segment, and also fills in the PC
1065 relative offset in the instruction. */
1066 HOWTO (ALPHA_R_BRADDR
, /* Type. */
1067 2, /* Rightshift. */
1068 2, /* Size (0 = byte, 1 = short, 2 = long). */
1070 TRUE
, /* PC relative. */
1072 complain_overflow_signed
, /* Complain_on_overflow. */
1073 reloc_nil
, /* Special_function. */
1074 "BRADDR", /* Name. */
1075 TRUE
, /* Partial_inplace. */
1076 0x1fffff, /* Source mask. */
1077 0x1fffff, /* Dest mask. */
1078 FALSE
), /* PC rel offset. */
1080 /* A hint for a jump to a register. */
1081 HOWTO (ALPHA_R_HINT
, /* Type. */
1082 2, /* Rightshift. */
1083 1, /* Size (0 = byte, 1 = short, 2 = long). */
1085 TRUE
, /* PC relative. */
1087 complain_overflow_dont
,/* Complain_on_overflow. */
1088 reloc_nil
, /* Special_function. */
1090 TRUE
, /* Partial_inplace. */
1091 0x3fff, /* Source mask. */
1092 0x3fff, /* Dest mask. */
1093 FALSE
), /* PC rel offset. */
1095 /* 16 bit PC relative offset. */
1096 HOWTO (ALPHA_R_SREL16
, /* Type. */
1097 0, /* Rightshift. */
1098 1, /* Size (0 = byte, 1 = short, 2 = long). */
1100 TRUE
, /* PC relative. */
1102 complain_overflow_signed
, /* Complain_on_overflow. */
1103 reloc_nil
, /* Special_function. */
1104 "SREL16", /* Name. */
1105 TRUE
, /* Partial_inplace. */
1106 0xffff, /* Source mask. */
1107 0xffff, /* Dest mask. */
1108 FALSE
), /* PC rel offset. */
1110 /* 32 bit PC relative offset. */
1111 HOWTO (ALPHA_R_SREL32
, /* Type. */
1112 0, /* Rightshift. */
1113 2, /* Size (0 = byte, 1 = short, 2 = long). */
1115 TRUE
, /* PC relative. */
1117 complain_overflow_signed
, /* Complain_on_overflow. */
1118 reloc_nil
, /* Special_function. */
1119 "SREL32", /* Name. */
1120 TRUE
, /* Partial_inplace. */
1121 0xffffffff, /* Source mask. */
1122 0xffffffff, /* Dest mask. */
1123 FALSE
), /* PC rel offset. */
1125 /* A 64 bit PC relative offset. */
1126 HOWTO (ALPHA_R_SREL64
, /* Type. */
1127 0, /* Rightshift. */
1128 4, /* Size (0 = byte, 1 = short, 2 = long). */
1130 TRUE
, /* PC relative. */
1132 complain_overflow_signed
, /* Complain_on_overflow. */
1133 reloc_nil
, /* Special_function. */
1134 "SREL64", /* Name. */
1135 TRUE
, /* Partial_inplace. */
1136 MINUS_ONE
, /* Source mask. */
1137 MINUS_ONE
, /* Dest mask. */
1138 FALSE
), /* PC rel offset. */
1140 /* Push a value on the reloc evaluation stack. */
1141 HOWTO (ALPHA_R_OP_PUSH
, /* Type. */
1142 0, /* Rightshift. */
1143 0, /* Size (0 = byte, 1 = short, 2 = long). */
1145 FALSE
, /* PC relative. */
1147 complain_overflow_dont
,/* Complain_on_overflow. */
1148 reloc_nil
, /* Special_function. */
1149 "OP_PUSH", /* Name. */
1150 FALSE
, /* Partial_inplace. */
1151 0, /* Source mask. */
1153 FALSE
), /* PC rel offset. */
1155 /* Store the value from the stack at the given address. Store it in
1156 a bitfield of size r_size starting at bit position r_offset. */
1157 HOWTO (ALPHA_R_OP_STORE
, /* Type. */
1158 0, /* Rightshift. */
1159 4, /* Size (0 = byte, 1 = short, 2 = long). */
1161 FALSE
, /* PC relative. */
1163 complain_overflow_dont
,/* Complain_on_overflow. */
1164 reloc_nil
, /* Special_function. */
1165 "OP_STORE", /* Name. */
1166 FALSE
, /* Partial_inplace. */
1167 0, /* Source mask. */
1168 MINUS_ONE
, /* Dest mask. */
1169 FALSE
), /* PC rel offset. */
1171 /* Subtract the reloc address from the value on the top of the
1172 relocation stack. */
1173 HOWTO (ALPHA_R_OP_PSUB
, /* Type. */
1174 0, /* Rightshift. */
1175 0, /* Size (0 = byte, 1 = short, 2 = long). */
1177 FALSE
, /* PC relative. */
1179 complain_overflow_dont
,/* Complain_on_overflow. */
1180 reloc_nil
, /* Special_function. */
1181 "OP_PSUB", /* Name. */
1182 FALSE
, /* Partial_inplace. */
1183 0, /* Source mask. */
1185 FALSE
), /* PC rel offset. */
1187 /* Shift the value on the top of the relocation stack right by the
1189 HOWTO (ALPHA_R_OP_PRSHIFT
, /* Type. */
1190 0, /* Rightshift. */
1191 0, /* Size (0 = byte, 1 = short, 2 = long). */
1193 FALSE
, /* PC relative. */
1195 complain_overflow_dont
,/* Complain_on_overflow. */
1196 reloc_nil
, /* Special_function. */
1197 "OP_PRSHIFT", /* Name. */
1198 FALSE
, /* Partial_inplace. */
1199 0, /* Source mask. */
1201 FALSE
), /* PC rel offset. */
1203 /* Hack. Linkage is done by linker. */
1204 HOWTO (ALPHA_R_LINKAGE
, /* Type. */
1205 0, /* Rightshift. */
1206 8, /* Size (0 = byte, 1 = short, 2 = long). */
1208 FALSE
, /* PC relative. */
1210 complain_overflow_dont
,/* Complain_on_overflow. */
1211 reloc_nil
, /* Special_function. */
1212 "LINKAGE", /* Name. */
1213 FALSE
, /* Partial_inplace. */
1214 0, /* Source mask. */
1216 FALSE
), /* PC rel offset. */
1218 /* A 32 bit reference to a symbol. */
1219 HOWTO (ALPHA_R_REFLONG
, /* Type. */
1220 0, /* Rightshift. */
1221 2, /* Size (0 = byte, 1 = short, 2 = long). */
1223 FALSE
, /* PC relative. */
1225 complain_overflow_bitfield
, /* Complain_on_overflow. */
1226 reloc_nil
, /* Special_function. */
1227 "REFLONG", /* Name. */
1228 TRUE
, /* Partial_inplace. */
1229 0xffffffff, /* Source mask. */
1230 0xffffffff, /* Dest mask. */
1231 FALSE
), /* PC rel offset. */
1233 /* A 64 bit reference to a procedure, written as 32 bit value. */
1234 HOWTO (ALPHA_R_CODEADDR
, /* Type. */
1235 0, /* Rightshift. */
1236 4, /* Size (0 = byte, 1 = short, 2 = long). */
1238 FALSE
, /* PC relative. */
1240 complain_overflow_signed
,/* Complain_on_overflow. */
1241 reloc_nil
, /* Special_function. */
1242 "CODEADDR", /* Name. */
1243 FALSE
, /* Partial_inplace. */
1244 0xffffffff, /* Source mask. */
1245 0xffffffff, /* Dest mask. */
1246 FALSE
), /* PC rel offset. */
1248 HOWTO (ALPHA_R_NOP
, /* Type. */
1249 0, /* Rightshift. */
1250 3, /* Size (0 = byte, 1 = short, 2 = long). */
1252 /* The following value must match that of ALPHA_R_BSR/ALPHA_R_BOH
1253 because the calculations for the 3 relocations are the same.
1254 See B.4.5.2 of the OpenVMS Linker Utility Manual. */
1255 TRUE
, /* PC relative. */
1257 complain_overflow_dont
,/* Complain_on_overflow. */
1258 reloc_nil
, /* Special_function. */
1260 FALSE
, /* Partial_inplace. */
1261 0xffffffff, /* Source mask. */
1262 0xffffffff, /* Dest mask. */
1263 FALSE
), /* PC rel offset. */
1265 HOWTO (ALPHA_R_BSR
, /* Type. */
1266 0, /* Rightshift. */
1267 3, /* Size (0 = byte, 1 = short, 2 = long). */
1269 TRUE
, /* PC relative. */
1271 complain_overflow_dont
,/* Complain_on_overflow. */
1272 reloc_nil
, /* Special_function. */
1274 FALSE
, /* Partial_inplace. */
1275 0xffffffff, /* Source mask. */
1276 0xffffffff, /* Dest mask. */
1277 FALSE
), /* PC rel offset. */
1279 HOWTO (ALPHA_R_LDA
, /* Type. */
1280 0, /* Rightshift. */
1281 3, /* Size (0 = byte, 1 = short, 2 = long). */
1283 FALSE
, /* PC relative. */
1285 complain_overflow_dont
,/* Complain_on_overflow. */
1286 reloc_nil
, /* Special_function. */
1288 FALSE
, /* Partial_inplace. */
1289 0xffffffff, /* Source mask. */
1290 0xffffffff, /* Dest mask. */
1291 FALSE
), /* PC rel offset. */
1293 HOWTO (ALPHA_R_BOH
, /* Type. */
1294 0, /* Rightshift. */
1295 3, /* Size (0 = byte, 1 = short, 2 = long, 3 = nil). */
1297 TRUE
, /* PC relative. */
1299 complain_overflow_dont
,/* Complain_on_overflow. */
1300 reloc_nil
, /* Special_function. */
1302 FALSE
, /* Partial_inplace. */
1303 0xffffffff, /* Source mask. */
1304 0xffffffff, /* Dest mask. */
1305 FALSE
), /* PC rel offset. */
1308 /* Return a pointer to a howto structure which, when invoked, will perform
1309 the relocation code on data from the architecture noted. */
1311 static const struct reloc_howto_struct
*
1312 vms_bfd_reloc_type_lookup (bfd
* abfd ATTRIBUTE_UNUSED
,
1313 bfd_reloc_code_real_type code
)
1317 vms_debug2 ((1, "vms_bfd_reloc_type_lookup (%p, %d)\t", abfd
, code
));
1321 case BFD_RELOC_16
: alpha_type
= ALPHA_R_SREL16
; break;
1322 case BFD_RELOC_32
: alpha_type
= ALPHA_R_REFLONG
; break;
1323 case BFD_RELOC_64
: alpha_type
= ALPHA_R_REFQUAD
; break;
1324 case BFD_RELOC_CTOR
: alpha_type
= ALPHA_R_REFQUAD
; break;
1325 case BFD_RELOC_23_PCREL_S2
: alpha_type
= ALPHA_R_BRADDR
; break;
1326 case BFD_RELOC_ALPHA_HINT
: alpha_type
= ALPHA_R_HINT
; break;
1327 case BFD_RELOC_16_PCREL
: alpha_type
= ALPHA_R_SREL16
; break;
1328 case BFD_RELOC_32_PCREL
: alpha_type
= ALPHA_R_SREL32
; break;
1329 case BFD_RELOC_64_PCREL
: alpha_type
= ALPHA_R_SREL64
; break;
1330 case BFD_RELOC_ALPHA_LINKAGE
: alpha_type
= ALPHA_R_LINKAGE
; break;
1331 case BFD_RELOC_ALPHA_CODEADDR
: alpha_type
= ALPHA_R_CODEADDR
; break;
1332 case BFD_RELOC_ALPHA_NOP
: alpha_type
= ALPHA_R_NOP
; break;
1333 case BFD_RELOC_ALPHA_BSR
: alpha_type
= ALPHA_R_BSR
; break;
1334 case BFD_RELOC_ALPHA_LDA
: alpha_type
= ALPHA_R_LDA
; break;
1335 case BFD_RELOC_ALPHA_BOH
: alpha_type
= ALPHA_R_BOH
; break;
1337 (*_bfd_error_handler
) ("reloc (%d) is *UNKNOWN*", code
);
1340 vms_debug2 ((2, "reloc is %s\n", alpha_howto_table
[alpha_type
].name
));
1341 return & alpha_howto_table
[alpha_type
];
1344 static reloc_howto_type
*
1345 vms_bfd_reloc_name_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
1351 i
< sizeof (alpha_howto_table
) / sizeof (alpha_howto_table
[0]);
1353 if (alpha_howto_table
[i
].name
!= NULL
1354 && strcasecmp (alpha_howto_table
[i
].name
, r_name
) == 0)
1355 return &alpha_howto_table
[i
];
1360 /* Part 4.7, writing an object file. */
1362 /* Set the architecture and machine type in BFD abfd to arch and mach.
1363 Find the correct pointer to a structure and insert it into the arch_info
1367 vms_set_arch_mach (bfd
* abfd
,
1368 enum bfd_architecture arch ATTRIBUTE_UNUSED
,
1369 unsigned long mach ATTRIBUTE_UNUSED
)
1371 vms_debug2 ((1, "vms_set_arch_mach (%p, %d, %ld)\n", abfd
, arch
, mach
));
1373 if (arch
!= bfd_arch_alpha
1374 && arch
!= bfd_arch_vax
1375 && arch
!= bfd_arch_unknown
)
1378 return bfd_default_set_arch_mach (abfd
, arch
, mach
);
1381 /* Sets the contents of the section section in BFD abfd to the data starting
1382 in memory at LOCATION. The data is written to the output section starting
1383 at offset offset for count bytes.
1385 Normally TRUE is returned, else FALSE. Possible error returns are:
1386 o bfd_error_no_contents - The output section does not have the
1387 SEC_HAS_CONTENTS attribute, so nothing can be written to it.
1388 o and some more too */
1391 vms_set_section_contents (bfd
* abfd
,
1393 const void * location
,
1395 bfd_size_type count
)
1398 vms_debug (1, "vms_set_section_contents (%p, sec %s, loc %p, off %ld, count %d)\n",
1399 abfd
, section
->name
, location
, (long int)offset
, (int)count
);
1400 vms_debug (2, "size %d\n", (int) section
->size
);
1402 if (count
== (bfd_size_type
)0)
1405 if (section
->contents
== NULL
)
1406 section
->contents
= bfd_alloc (abfd
, section
->size
);
1407 if (section
->contents
== NULL
)
1410 memcpy (section
->contents
+ offset
, location
, (size_t) count
);
1415 vms_bfd_print_private_bfd_data (bfd
*abfd
, void *ptr
)
1417 FILE *file
= (FILE *)ptr
;
1419 fprintf (file
, _("structure level: %d\n"), PRIV(hdr_data
.hdr_b_strlvl
));
1420 fprintf (file
, _("module name : %s\n"), PRIV(hdr_data
.hdr_t_name
));
1421 fprintf (file
, _("module version : %s\n"), PRIV(hdr_data
.hdr_t_version
));
1422 fprintf (file
, _("module date : %s\n"), PRIV(hdr_data
.hdr_t_date
));
1423 fprintf (file
, _("language name : %s\n"), PRIV(hdr_data
.hdr_c_lnm
));
1424 fprintf (file
, _("source files : %s\n"), PRIV(hdr_data
.hdr_c_src
));
1425 fprintf (file
, _("title : %s\n"), PRIV(hdr_data
.hdr_c_ttl
));
1430 const bfd_target vms_alpha_vec
=
1432 "vms-alpha", /* Name. */
1433 bfd_target_evax_flavour
,
1434 BFD_ENDIAN_LITTLE
, /* Data byte order is little. */
1435 BFD_ENDIAN_LITTLE
, /* Header byte order is little. */
1437 (HAS_RELOC
| EXEC_P
| HAS_LINENO
| HAS_DEBUG
| HAS_SYMS
| HAS_LOCALS
1438 | WP_TEXT
| D_PAGED
), /* Object flags. */
1439 (SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
1440 | SEC_READONLY
| SEC_CODE
| SEC_DATA
1441 | SEC_HAS_CONTENTS
| SEC_IN_MEMORY
), /* Sect flags. */
1442 0, /* symbol_leading_char. */
1443 ' ', /* ar_pad_char. */
1444 15, /* ar_max_namelen. */
1445 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
1446 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
1447 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
,
1448 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
1449 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
1450 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
,
1452 {_bfd_dummy_target
, vms_object_p
, /* bfd_check_format. */
1453 _bfd_dummy_target
, _bfd_dummy_target
},
1454 {bfd_false
, vms_mkobject
, /* bfd_set_format. */
1455 bfd_false
, bfd_false
},
1456 {bfd_false
, vms_write_object_contents
, /* bfd_write_contents. */
1457 bfd_false
, bfd_false
},
1459 BFD_JUMP_TABLE_GENERIC (vms
),
1460 BFD_JUMP_TABLE_COPY (vms
),
1461 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
1462 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
1463 BFD_JUMP_TABLE_SYMBOLS (vms
),
1464 BFD_JUMP_TABLE_RELOCS (vms
),
1465 BFD_JUMP_TABLE_WRITE (vms
),
1466 BFD_JUMP_TABLE_LINK (_bfd_nolink
),
1467 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),
1474 const bfd_target vms_vax_vec
=
1476 "vms-vax", /* Name. */
1477 bfd_target_ovax_flavour
,
1478 BFD_ENDIAN_LITTLE
, /* Data byte order is little. */
1479 BFD_ENDIAN_LITTLE
, /* Header byte order is little. */
1481 (HAS_RELOC
| HAS_SYMS
/* Object flags. */
1483 | HAS_LINENO
| HAS_DEBUG
| HAS_LOCALS
),
1485 (SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
1486 | SEC_READONLY
| SEC_CODE
| SEC_DATA
1487 | SEC_HAS_CONTENTS
| SEC_IN_MEMORY
), /* Sect flags. */
1488 0, /* symbol_leading_char */
1489 ' ', /* ar_pad_char */
1490 15, /* ar_max_namelen */
1491 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
1492 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
1493 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
, /* Data. */
1494 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
1495 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
1496 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
, /* Hdrs. */
1498 {_bfd_dummy_target
, vms_object_p
, /* bfd_check_format. */
1499 _bfd_dummy_target
, _bfd_dummy_target
},
1500 {bfd_false
, vms_mkobject
, /* bfd_set_format. */
1501 bfd_false
, bfd_false
},
1502 {bfd_false
, vms_write_object_contents
, /* bfd_write_contents. */
1503 bfd_false
, bfd_false
},
1505 BFD_JUMP_TABLE_GENERIC (vms
),
1506 BFD_JUMP_TABLE_COPY (vms
),
1507 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
1508 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
1509 BFD_JUMP_TABLE_SYMBOLS (vms
),
1510 BFD_JUMP_TABLE_RELOCS (vms
),
1511 BFD_JUMP_TABLE_WRITE (vms
),
1512 BFD_JUMP_TABLE_LINK (_bfd_nolink
),
1513 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),