1 /* vms.c -- BFD back-end for EVAX (openVMS/Alpha) files.
2 Copyright 1996-2013 Free Software Foundation, Inc.
4 Initial version written by Klaus Kaempf (kkaempf@rmi.de)
5 Major rewrite by Adacore.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
25 o Generation of shared image
26 o Relocation optimizations
32 o protected sections (for messages)
50 #include "vms/eihvn.h"
51 #include "vms/eobjrec.h"
54 #include "vms/esgps.h"
63 #include "vms/esdfm.h"
64 #include "vms/esdfv.h"
70 #include "vms/internal.h"
73 #define MIN(a,b) ((a) < (b) ? (a) : (b))
75 /* The r_type field in a reloc is one of the following values. */
76 #define ALPHA_R_IGNORE 0
77 #define ALPHA_R_REFQUAD 1
78 #define ALPHA_R_BRADDR 2
79 #define ALPHA_R_HINT 3
80 #define ALPHA_R_SREL16 4
81 #define ALPHA_R_SREL32 5
82 #define ALPHA_R_SREL64 6
83 #define ALPHA_R_OP_PUSH 7
84 #define ALPHA_R_OP_STORE 8
85 #define ALPHA_R_OP_PSUB 9
86 #define ALPHA_R_OP_PRSHIFT 10
87 #define ALPHA_R_LINKAGE 11
88 #define ALPHA_R_REFLONG 12
89 #define ALPHA_R_CODEADDR 13
90 #define ALPHA_R_NOP 14
91 #define ALPHA_R_BSR 15
92 #define ALPHA_R_LDA 16
93 #define ALPHA_R_BOH 17
95 /* These are used with DST_S_C_LINE_NUM. */
96 #define DST_S_C_LINE_NUM_HEADER_SIZE 4
98 /* These are used with DST_S_C_SOURCE */
100 #define DST_S_B_PCLINE_UNSBYTE 1
101 #define DST_S_W_PCLINE_UNSWORD 1
102 #define DST_S_L_PCLINE_UNSLONG 1
104 #define DST_S_B_MODBEG_NAME 14
105 #define DST_S_L_RTNBEG_ADDRESS 5
106 #define DST_S_B_RTNBEG_NAME 13
107 #define DST_S_L_RTNEND_SIZE 5
109 /* These are used with DST_S_C_SOURCE. */
110 #define DST_S_C_SOURCE_HEADER_SIZE 4
112 #define DST_S_B_SRC_DF_LENGTH 1
113 #define DST_S_W_SRC_DF_FILEID 3
114 #define DST_S_B_SRC_DF_FILENAME 20
115 #define DST_S_B_SRC_UNSBYTE 1
116 #define DST_S_W_SRC_UNSWORD 1
117 #define DST_S_L_SRC_UNSLONG 1
119 /* Debugger symbol definitions. */
121 #define DBG_S_L_DMT_MODBEG 0
122 #define DBG_S_L_DST_SIZE 4
123 #define DBG_S_W_DMT_PSECT_COUNT 8
124 #define DBG_S_C_DMT_HEADER_SIZE 12
126 #define DBG_S_L_DMT_PSECT_START 0
127 #define DBG_S_L_DMT_PSECT_LENGTH 4
128 #define DBG_S_C_DMT_PSECT_SIZE 8
130 /* VMS module header. */
146 #define EMH_DATE_LENGTH 17
148 /* VMS End-Of-Module records (EOM/EEOM). */
152 unsigned int eom_l_total_lps
;
153 unsigned short eom_w_comcod
;
154 bfd_boolean eom_has_transfer
;
155 unsigned char eom_b_tfrflg
;
156 unsigned int eom_l_psindx
;
157 unsigned int eom_l_tfradr
;
160 struct vms_symbol_entry
166 unsigned char data_type
;
167 unsigned short flags
;
169 /* Section and offset/value of the symbol. */
173 /* Section and offset/value for the entry point (only for subprg). */
174 asection
*code_section
;
175 unsigned int code_value
;
177 /* Symbol vector offset. */
178 unsigned int symbol_vector
;
180 /* Length of the name. */
181 unsigned char namelen
;
186 /* Stack value for push/pop commands. */
194 #define STACKSIZE 128
196 /* A minimal decoding of DST compilation units. We only decode
197 what's needed to get to the line number information. */
207 struct srecinfo
*next
;
215 struct lineinfo
*next
;
222 struct funcinfo
*next
;
230 /* Chain the previously read compilation unit. */
233 /* The module name. */
236 /* The start offset and size of debug info in the DST section. */
240 /* The lowest and highest addresses contained in this compilation
241 unit as specified in the compilation unit header. */
245 /* The listing line table. */
246 struct lineinfo
*line_table
;
248 /* The source record table. */
249 struct srecinfo
*srec_table
;
251 /* A list of the functions found in this module. */
252 struct funcinfo
*func_table
;
254 /* Current allocation of file_table. */
255 unsigned int file_table_count
;
257 /* An array of the files making up this module. */
258 struct fileinfo
*file_table
;
261 /* BFD private data for alpha-vms. */
263 struct vms_private_data_struct
265 /* If true, relocs have been read. */
266 bfd_boolean reloc_done
;
268 /* Record input buffer. */
269 struct vms_rec_rd recrd
;
270 struct vms_rec_wr recwr
;
272 struct hdr_struct hdr_data
; /* data from HDR/EMH record */
273 struct eom_struct eom_data
; /* data from EOM/EEOM record */
275 /* Transfer addresses (entry points). */
276 bfd_vma transfer_address
[4];
278 /* Array of GSD sections to get the correspond BFD one. */
279 unsigned int section_max
; /* Size of the sections array. */
280 unsigned int section_count
; /* Number of GSD sections. */
283 /* Array of raw symbols. */
284 struct vms_symbol_entry
**syms
;
286 /* Canonicalized symbols. */
289 /* Number of symbols. */
290 unsigned int gsd_sym_count
;
291 /* Size of the syms array. */
292 unsigned int max_sym_count
;
293 /* Number of procedure symbols. */
294 unsigned int norm_sym_count
;
296 /* Stack used to evaluate TIR/ETIR commands. */
297 struct stack_struct
*stack
;
300 /* Content reading. */
301 asection
*image_section
; /* section for image_ptr */
302 file_ptr image_offset
; /* Offset for image_ptr. */
304 struct module
*modules
; /* list of all compilation units */
306 /* The DST section. */
307 asection
*dst_section
;
309 unsigned int dst_ptr_offsets_count
; /* # of offsets in following array */
310 unsigned int *dst_ptr_offsets
; /* array of saved image_ptr offsets */
312 /* Shared library support */
313 bfd_vma symvva
; /* relative virtual address of symbol vector */
315 unsigned char matchctl
;
317 /* Shared library index. This is used for input bfd while linking. */
318 unsigned int shr_index
;
320 /* Used to place structures in the file. */
323 /* Simply linked list of eisd. */
324 struct vms_internal_eisd_map
*eisd_head
;
325 struct vms_internal_eisd_map
*eisd_tail
;
327 /* Simply linked list of eisd for shared libraries. */
328 struct vms_internal_eisd_map
*gbl_eisd_head
;
329 struct vms_internal_eisd_map
*gbl_eisd_tail
;
331 /* linkage index counter used by conditional store commands */
332 unsigned int vms_linkage_index
;
334 /* see tc-alpha.c of gas for a description. */
335 int flag_hash_long_names
; /* -+, hash instead of truncate */
336 int flag_show_after_trunc
; /* -H, show hashing/truncation */
339 #define PRIV2(abfd, name) \
340 (((struct vms_private_data_struct *)(abfd)->tdata.any)->name)
341 #define PRIV(name) PRIV2(abfd,name)
344 /* Used to keep extra VMS specific information for a given section.
346 reloc_size holds the size of the relocation stream, note this
347 is very different from the number of relocations as VMS relocations
350 reloc_stream is the actual stream of relocation entries. */
352 struct vms_section_data_struct
354 /* Maximnum number of entries in sec->relocation. */
357 /* Corresponding eisd. Used only while generating executables. */
358 struct vms_internal_eisd_map
*eisd
;
360 /* PSC flags to be clear. */
363 /* PSC flags to be set. */
367 #define vms_section_data(sec) \
368 ((struct vms_section_data_struct *)sec->used_by_bfd)
370 /* To be called from the debugger. */
371 struct vms_private_data_struct
*bfd_vms_get_data (bfd
*abfd
);
373 static int vms_get_remaining_object_record (bfd
*abfd
, int read_so_far
);
374 static bfd_boolean
_bfd_vms_slurp_object_records (bfd
* abfd
);
375 static void alpha_vms_add_fixup_lp (struct bfd_link_info
*, bfd
*, bfd
*);
376 static void alpha_vms_add_fixup_ca (struct bfd_link_info
*, bfd
*, bfd
*);
377 static void alpha_vms_add_fixup_qr (struct bfd_link_info
*, bfd
*, bfd
*,
379 static void alpha_vms_add_fixup_lr (struct bfd_link_info
*, unsigned int,
381 static void alpha_vms_add_lw_reloc (struct bfd_link_info
*info
);
382 static void alpha_vms_add_qw_reloc (struct bfd_link_info
*info
);
391 /* Number of elements in VEC. */
393 #define VEC_COUNT(VEC) ((VEC).nbr_el)
395 /* Get the address of the Nth element. */
397 #define VEC_EL(VEC, TYPE, N) (((TYPE *)((VEC).els))[N])
399 #define VEC_INIT(VEC) \
406 /* Be sure there is room for a new element. */
408 static void vector_grow1 (struct vector_type
*vec
, size_t elsz
);
410 /* Allocate room for a new element and return its address. */
412 #define VEC_APPEND(VEC, TYPE) \
413 (vector_grow1 (&VEC, sizeof (TYPE)), &VEC_EL(VEC, TYPE, (VEC).nbr_el++))
415 /* Append an element. */
417 #define VEC_APPEND_EL(VEC, TYPE, EL) \
418 (*(VEC_APPEND (VEC, TYPE)) = EL)
420 struct alpha_vms_vma_ref
422 bfd_vma vma
; /* Vma in the output. */
423 bfd_vma ref
; /* Reference in the input. */
426 struct alpha_vms_shlib_el
429 bfd_boolean has_fixups
;
431 struct vector_type lp
; /* Vector of bfd_vma. */
432 struct vector_type ca
; /* Vector of bfd_vma. */
433 struct vector_type qr
; /* Vector of struct alpha_vms_vma_ref. */
436 /* Alpha VMS linker hash table. */
438 struct alpha_vms_link_hash_table
440 struct bfd_link_hash_table root
;
442 /* Vector of shared libraries. */
443 struct vector_type shrlibs
;
448 /* Base address. Used by fixups. */
452 #define alpha_vms_link_hash(INFO) \
453 ((struct alpha_vms_link_hash_table *)(INFO->hash))
455 /* Alpha VMS linker hash table entry. */
457 struct alpha_vms_link_hash_entry
459 struct bfd_link_hash_entry root
;
461 /* Pointer to the original vms symbol. */
462 struct vms_symbol_entry
*sym
;
467 /* Read & process EIHD record.
468 Return TRUE on success, FALSE on error. */
471 _bfd_vms_slurp_eihd (bfd
*abfd
, unsigned int *eisd_offset
,
472 unsigned int *eihs_offset
)
474 unsigned int imgtype
, size
;
476 struct vms_eihd
*eihd
= (struct vms_eihd
*)PRIV (recrd
.rec
);
478 vms_debug2 ((8, "_bfd_vms_slurp_eihd\n"));
480 size
= bfd_getl32 (eihd
->size
);
481 imgtype
= bfd_getl32 (eihd
->imgtype
);
483 if (imgtype
== EIHD__K_EXE
|| imgtype
== EIHD__K_LIM
)
484 abfd
->flags
|= EXEC_P
;
486 symvva
= bfd_getl64 (eihd
->symvva
);
489 PRIV (symvva
) = symvva
;
490 abfd
->flags
|= DYNAMIC
;
493 PRIV (ident
) = bfd_getl32 (eihd
->ident
);
494 PRIV (matchctl
) = eihd
->matchctl
;
496 *eisd_offset
= bfd_getl32 (eihd
->isdoff
);
497 *eihs_offset
= bfd_getl32 (eihd
->symdbgoff
);
499 vms_debug2 ((4, "EIHD size %d imgtype %d symvva 0x%lx eisd %d eihs %d\n",
500 size
, imgtype
, (unsigned long)symvva
,
501 *eisd_offset
, *eihs_offset
));
506 /* Read & process EISD record.
507 Return TRUE on success, FALSE on error. */
510 _bfd_vms_slurp_eisd (bfd
*abfd
, unsigned int offset
)
512 int section_count
= 0;
514 vms_debug2 ((8, "_bfd_vms_slurp_eisd\n"));
518 struct vms_eisd
*eisd
;
519 unsigned int rec_size
;
521 unsigned long long vaddr
;
528 eisd
= (struct vms_eisd
*)(PRIV (recrd
.rec
) + offset
);
529 rec_size
= bfd_getl32 (eisd
->eisdsize
);
534 /* Skip to next block if pad. */
535 if (rec_size
== 0xffffffff)
537 offset
= (offset
+ VMS_BLOCK_SIZE
) & ~(VMS_BLOCK_SIZE
- 1);
543 size
= bfd_getl32 (eisd
->secsize
);
544 vaddr
= bfd_getl64 (eisd
->virt_addr
);
545 flags
= bfd_getl32 (eisd
->flags
);
546 vbn
= bfd_getl32 (eisd
->vbn
);
548 vms_debug2 ((4, "EISD at 0x%x size 0x%x addr 0x%lx flags 0x%x blk %d\n",
549 offset
, size
, (unsigned long)vaddr
, flags
, vbn
));
551 /* VMS combines psects from .obj files into isects in the .exe. This
552 process doesn't preserve enough information to reliably determine
553 what's in each section without examining the data. This is
554 especially true of DWARF debug sections. */
555 bfd_flags
= SEC_ALLOC
;
557 bfd_flags
|= SEC_HAS_CONTENTS
| SEC_LOAD
;
559 if (flags
& EISD__M_EXE
)
560 bfd_flags
|= SEC_CODE
;
562 if (flags
& EISD__M_NONSHRADR
)
563 bfd_flags
|= SEC_DATA
;
565 if (!(flags
& EISD__M_WRT
))
566 bfd_flags
|= SEC_READONLY
;
568 if (flags
& EISD__M_DZRO
)
569 bfd_flags
|= SEC_DATA
;
571 if (flags
& EISD__M_FIXUPVEC
)
572 bfd_flags
|= SEC_DATA
;
574 if (flags
& EISD__M_CRF
)
575 bfd_flags
|= SEC_DATA
;
577 if (flags
& EISD__M_GBL
)
579 name
= _bfd_vms_save_counted_string (eisd
->gblnam
);
580 bfd_flags
|= SEC_COFF_SHARED_LIBRARY
;
581 bfd_flags
&= ~(SEC_ALLOC
| SEC_LOAD
);
583 else if (flags
& EISD__M_FIXUPVEC
)
585 else if (eisd
->type
== EISD__K_USRSTACK
)
591 name
= (char*) bfd_alloc (abfd
, 32);
592 if (flags
& EISD__M_DZRO
)
594 else if (flags
& EISD__M_EXE
)
596 else if (!(flags
& EISD__M_WRT
))
600 BFD_ASSERT (section_count
< 999);
601 sprintf (name
, "$%s_%03d$", pfx
, section_count
++);
604 section
= bfd_make_section (abfd
, name
);
609 section
->filepos
= vbn
? VMS_BLOCK_SIZE
* (vbn
- 1) : 0;
610 section
->size
= size
;
611 section
->vma
= vaddr
;
613 if (!bfd_set_section_flags (abfd
, section
, bfd_flags
))
620 /* Read & process EIHS record.
621 Return TRUE on success, FALSE on error. */
624 _bfd_vms_slurp_eihs (bfd
*abfd
, unsigned int offset
)
626 unsigned char *p
= PRIV (recrd
.rec
) + offset
;
627 unsigned int gstvbn
= bfd_getl32 (p
+ EIHS__L_GSTVBN
);
628 unsigned int gstsize ATTRIBUTE_UNUSED
= bfd_getl32 (p
+ EIHS__L_GSTSIZE
);
629 unsigned int dstvbn
= bfd_getl32 (p
+ EIHS__L_DSTVBN
);
630 unsigned int dstsize
= bfd_getl32 (p
+ EIHS__L_DSTSIZE
);
631 unsigned int dmtvbn
= bfd_getl32 (p
+ EIHS__L_DMTVBN
);
632 unsigned int dmtbytes
= bfd_getl32 (p
+ EIHS__L_DMTBYTES
);
636 vms_debug (8, "_bfd_vms_slurp_ihs\n");
637 vms_debug (4, "EIHS record gstvbn %d gstsize %d dstvbn %d dstsize %d dmtvbn %d dmtbytes %d\n",
638 gstvbn
, gstsize
, dstvbn
, dstsize
, dmtvbn
, dmtbytes
);
643 flagword bfd_flags
= SEC_HAS_CONTENTS
| SEC_DEBUGGING
;
645 section
= bfd_make_section (abfd
, "$DST$");
649 section
->size
= dstsize
;
650 section
->filepos
= VMS_BLOCK_SIZE
* (dstvbn
- 1);
652 if (!bfd_set_section_flags (abfd
, section
, bfd_flags
))
655 PRIV (dst_section
) = section
;
656 abfd
->flags
|= (HAS_DEBUG
| HAS_LINENO
);
661 flagword bfd_flags
= SEC_HAS_CONTENTS
| SEC_DEBUGGING
;
663 section
= bfd_make_section (abfd
, "$DMT$");
667 section
->size
= dmtbytes
;
668 section
->filepos
= VMS_BLOCK_SIZE
* (dmtvbn
- 1);
670 if (!bfd_set_section_flags (abfd
, section
, bfd_flags
))
676 if (bfd_seek (abfd
, VMS_BLOCK_SIZE
* (gstvbn
- 1), SEEK_SET
))
678 bfd_set_error (bfd_error_file_truncated
);
682 if (_bfd_vms_slurp_object_records (abfd
) != TRUE
)
685 abfd
->flags
|= HAS_SYMS
;
691 /* Object file reading. */
693 /* Object file input functions. */
695 /* Get next record from object file to vms_buf.
696 Set PRIV(buf_size) and return it
698 This is a little tricky since it should be portable.
700 The openVMS object file has 'variable length' which means that
701 read() returns data in chunks of (hopefully) correct and expected
702 size. The linker (and other tools on VMS) depend on that. Unix
703 doesn't know about 'formatted' files, so reading and writing such
704 an object file in a Unix environment is not trivial.
706 With the tool 'file' (available on all VMS FTP sites), one
707 can view and change the attributes of a file. Changing from
708 'variable length' to 'fixed length, 512 bytes' reveals the
709 record size at the first 2 bytes of every record. The same
710 may happen during the transfer of object files from VMS to Unix,
711 at least with UCX, the DEC implementation of TCP/IP.
713 The VMS format repeats the size at bytes 2 & 3 of every record.
715 On the first call (file_format == FF_UNKNOWN) we check if
716 the first and the third byte pair (!) of the record match.
717 If they do it's an object file in an Unix environment or with
718 wrong attributes (FF_FOREIGN), else we should be in a VMS
719 environment where read() returns the record size (FF_NATIVE).
721 Reading is always done in 2 steps:
722 1. first just the record header is read and the size extracted,
723 2. then the read buffer is adjusted and the remaining bytes are
726 All file I/O is done on even file positions. */
728 #define VMS_OBJECT_ADJUSTMENT 2
731 maybe_adjust_record_pointer_for_object (bfd
*abfd
)
733 /* Set the file format once for all on the first invocation. */
734 if (PRIV (recrd
.file_format
) == FF_UNKNOWN
)
736 if (PRIV (recrd
.rec
)[0] == PRIV (recrd
.rec
)[4]
737 && PRIV (recrd
.rec
)[1] == PRIV (recrd
.rec
)[5])
738 PRIV (recrd
.file_format
) = FF_FOREIGN
;
740 PRIV (recrd
.file_format
) = FF_NATIVE
;
743 /* The adjustment is needed only in an Unix environment. */
744 if (PRIV (recrd
.file_format
) == FF_FOREIGN
)
745 PRIV (recrd
.rec
) += VMS_OBJECT_ADJUSTMENT
;
748 /* Implement step #1 of the object record reading procedure.
749 Return the record type or -1 on failure. */
752 _bfd_vms_get_object_record (bfd
*abfd
)
754 unsigned int test_len
= 6;
757 vms_debug2 ((8, "_bfd_vms_get_obj_record\n"));
759 /* Skip alignment byte if the current position is odd. */
760 if (PRIV (recrd
.file_format
) == FF_FOREIGN
&& (bfd_tell (abfd
) & 1))
762 if (bfd_bread (PRIV (recrd
.buf
), 1, abfd
) != 1)
764 bfd_set_error (bfd_error_file_truncated
);
769 /* Read the record header */
770 if (bfd_bread (PRIV (recrd
.buf
), test_len
, abfd
) != test_len
)
772 bfd_set_error (bfd_error_file_truncated
);
776 /* Reset the record pointer. */
777 PRIV (recrd
.rec
) = PRIV (recrd
.buf
);
778 maybe_adjust_record_pointer_for_object (abfd
);
780 if (vms_get_remaining_object_record (abfd
, test_len
) <= 0)
783 type
= bfd_getl16 (PRIV (recrd
.rec
));
785 vms_debug2 ((8, "_bfd_vms_get_obj_record: rec %p, size %d, type %d\n",
786 PRIV (recrd
.rec
), PRIV (recrd
.rec_size
), type
));
791 /* Implement step #2 of the object record reading procedure.
792 Return the size of the record or 0 on failure. */
795 vms_get_remaining_object_record (bfd
*abfd
, int read_so_far
)
797 unsigned int to_read
;
799 vms_debug2 ((8, "vms_get_remaining_obj_record\n"));
801 /* Extract record size. */
802 PRIV (recrd
.rec_size
) = bfd_getl16 (PRIV (recrd
.rec
) + 2);
804 if (PRIV (recrd
.rec_size
) == 0)
806 bfd_set_error (bfd_error_file_truncated
);
810 /* That's what the linker manual says. */
811 if (PRIV (recrd
.rec_size
) > EOBJ__C_MAXRECSIZ
)
813 bfd_set_error (bfd_error_file_truncated
);
817 /* Take into account object adjustment. */
818 to_read
= PRIV (recrd
.rec_size
);
819 if (PRIV (recrd
.file_format
) == FF_FOREIGN
)
820 to_read
+= VMS_OBJECT_ADJUSTMENT
;
822 /* Adjust the buffer. */
823 if (to_read
> PRIV (recrd
.buf_size
))
826 = (unsigned char *) bfd_realloc (PRIV (recrd
.buf
), to_read
);
827 if (PRIV (recrd
.buf
) == NULL
)
829 PRIV (recrd
.buf_size
) = to_read
;
832 /* Read the remaining record. */
833 to_read
-= read_so_far
;
835 vms_debug2 ((8, "vms_get_remaining_obj_record: to_read %d\n", to_read
));
837 if (bfd_bread (PRIV (recrd
.buf
) + read_so_far
, to_read
, abfd
) != to_read
)
839 bfd_set_error (bfd_error_file_truncated
);
843 /* Reset the record pointer. */
844 PRIV (recrd
.rec
) = PRIV (recrd
.buf
);
845 maybe_adjust_record_pointer_for_object (abfd
);
847 vms_debug2 ((8, "vms_get_remaining_obj_record: size %d\n",
848 PRIV (recrd
.rec_size
)));
850 return PRIV (recrd
.rec_size
);
853 /* Read and process emh record.
854 Return TRUE on success, FALSE on error. */
857 _bfd_vms_slurp_ehdr (bfd
*abfd
)
860 unsigned char *vms_rec
;
863 vms_rec
= PRIV (recrd
.rec
);
865 vms_debug2 ((2, "HDR/EMH\n"));
867 subtype
= bfd_getl16 (vms_rec
+ 4);
869 vms_debug2 ((3, "subtype %d\n", subtype
));
875 PRIV (hdr_data
).hdr_b_strlvl
= vms_rec
[6];
876 PRIV (hdr_data
).hdr_l_arch1
= bfd_getl32 (vms_rec
+ 8);
877 PRIV (hdr_data
).hdr_l_arch2
= bfd_getl32 (vms_rec
+ 12);
878 PRIV (hdr_data
).hdr_l_recsiz
= bfd_getl32 (vms_rec
+ 16);
879 PRIV (hdr_data
).hdr_t_name
= _bfd_vms_save_counted_string (vms_rec
+ 20);
880 ptr
= vms_rec
+ 20 + vms_rec
[20] + 1;
881 PRIV (hdr_data
).hdr_t_version
=_bfd_vms_save_counted_string (ptr
);
883 PRIV (hdr_data
).hdr_t_date
= _bfd_vms_save_sized_string (ptr
, 17);
887 PRIV (hdr_data
).hdr_c_lnm
=
888 _bfd_vms_save_sized_string (vms_rec
, PRIV (recrd
.rec_size
- 6));
892 PRIV (hdr_data
).hdr_c_src
=
893 _bfd_vms_save_sized_string (vms_rec
, PRIV (recrd
.rec_size
- 6));
897 PRIV (hdr_data
).hdr_c_ttl
=
898 _bfd_vms_save_sized_string (vms_rec
, PRIV (recrd
.rec_size
- 6));
907 bfd_set_error (bfd_error_wrong_format
);
914 /* Typical sections for evax object files. */
916 #define EVAX_ABS_NAME "$ABS$"
917 #define EVAX_CODE_NAME "$CODE$"
918 #define EVAX_LINK_NAME "$LINK$"
919 #define EVAX_DATA_NAME "$DATA$"
920 #define EVAX_BSS_NAME "$BSS$"
921 #define EVAX_READONLYADDR_NAME "$READONLY_ADDR$"
922 #define EVAX_READONLY_NAME "$READONLY$"
923 #define EVAX_LITERAL_NAME "$LITERAL$"
924 #define EVAX_LITERALS_NAME "$LITERALS"
925 #define EVAX_COMMON_NAME "$COMMON$"
926 #define EVAX_LOCAL_NAME "$LOCAL$"
928 struct sec_flags_struct
930 const char *name
; /* Name of section. */
932 flagword flags_always
; /* Flags we set always. */
934 flagword flags_hassize
; /* Flags we set if the section has a size > 0. */
937 /* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible. */
939 static const struct sec_flags_struct evax_section_flags
[] =
947 EGPS__V_PIC
| EGPS__V_REL
| EGPS__V_SHR
| EGPS__V_EXE
,
948 SEC_CODE
| SEC_READONLY
,
949 EGPS__V_PIC
| EGPS__V_REL
| EGPS__V_SHR
| EGPS__V_EXE
,
950 SEC_CODE
| SEC_READONLY
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
},
952 EGPS__V_PIC
| EGPS__V_REL
| EGPS__V_SHR
| EGPS__V_RD
| EGPS__V_NOMOD
,
953 SEC_DATA
| SEC_READONLY
,
954 EGPS__V_PIC
| EGPS__V_REL
| EGPS__V_SHR
| EGPS__V_RD
,
955 SEC_DATA
| SEC_READONLY
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
},
957 EGPS__V_REL
| EGPS__V_RD
,
958 SEC_DATA
| SEC_READONLY
,
959 EGPS__V_REL
| EGPS__V_RD
,
960 SEC_DATA
| SEC_READONLY
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
},
962 EGPS__V_REL
| EGPS__V_RD
| EGPS__V_WRT
| EGPS__V_NOMOD
,
964 EGPS__V_REL
| EGPS__V_RD
| EGPS__V_WRT
,
965 SEC_DATA
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
},
967 EGPS__V_REL
| EGPS__V_RD
| EGPS__V_WRT
| EGPS__V_NOMOD
,
969 EGPS__V_REL
| EGPS__V_RD
| EGPS__V_WRT
| EGPS__V_NOMOD
,
971 { EVAX_READONLYADDR_NAME
,
972 EGPS__V_PIC
| EGPS__V_REL
| EGPS__V_RD
,
973 SEC_DATA
| SEC_READONLY
,
974 EGPS__V_PIC
| EGPS__V_REL
| EGPS__V_RD
,
975 SEC_DATA
| SEC_READONLY
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
},
976 { EVAX_READONLY_NAME
,
977 EGPS__V_PIC
| EGPS__V_REL
| EGPS__V_SHR
| EGPS__V_RD
| EGPS__V_NOMOD
,
978 SEC_DATA
| SEC_READONLY
,
979 EGPS__V_PIC
| EGPS__V_REL
| EGPS__V_SHR
| EGPS__V_RD
,
980 SEC_DATA
| SEC_READONLY
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
},
982 EGPS__V_REL
| EGPS__V_RD
| EGPS__V_WRT
,
984 EGPS__V_REL
| EGPS__V_RD
| EGPS__V_WRT
,
985 SEC_DATA
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
},
986 { EVAX_LITERALS_NAME
,
987 EGPS__V_PIC
| EGPS__V_OVR
,
988 SEC_DATA
| SEC_READONLY
,
989 EGPS__V_PIC
| EGPS__V_OVR
,
990 SEC_DATA
| SEC_READONLY
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
},
992 EGPS__V_REL
| EGPS__V_RD
| EGPS__V_WRT
,
994 EGPS__V_REL
| EGPS__V_RD
| EGPS__V_WRT
,
995 SEC_DATA
| SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
}
998 /* Retrieve BFD section flags by name and size. */
1001 vms_secflag_by_name (const struct sec_flags_struct
*section_flags
,
1007 while (section_flags
[i
].name
!= NULL
)
1009 if (strcmp (name
, section_flags
[i
].name
) == 0)
1012 return section_flags
[i
].flags_hassize
;
1014 return section_flags
[i
].flags_always
;
1019 return section_flags
[i
].flags_hassize
;
1020 return section_flags
[i
].flags_always
;
1023 /* Retrieve VMS section flags by name and size. */
1026 vms_esecflag_by_name (const struct sec_flags_struct
*section_flags
,
1032 while (section_flags
[i
].name
!= NULL
)
1034 if (strcmp (name
, section_flags
[i
].name
) == 0)
1037 return section_flags
[i
].vflags_hassize
;
1039 return section_flags
[i
].vflags_always
;
1044 return section_flags
[i
].vflags_hassize
;
1045 return section_flags
[i
].vflags_always
;
1048 /* Add SYM to the symbol table of ABFD.
1049 Return FALSE in case of error. */
1052 add_symbol_entry (bfd
*abfd
, struct vms_symbol_entry
*sym
)
1054 if (PRIV (gsd_sym_count
) >= PRIV (max_sym_count
))
1056 if (PRIV (max_sym_count
) == 0)
1058 PRIV (max_sym_count
) = 128;
1059 PRIV (syms
) = bfd_malloc
1060 (PRIV (max_sym_count
) * sizeof (struct vms_symbol_entry
*));
1064 PRIV (max_sym_count
) *= 2;
1065 PRIV (syms
) = bfd_realloc
1067 (PRIV (max_sym_count
) * sizeof (struct vms_symbol_entry
*)));
1069 if (PRIV (syms
) == NULL
)
1073 PRIV (syms
)[PRIV (gsd_sym_count
)++] = sym
;
1077 /* Create a symbol whose name is ASCIC and add it to ABFD.
1078 Return NULL in case of error. */
1080 static struct vms_symbol_entry
*
1081 add_symbol (bfd
*abfd
, const unsigned char *ascic
)
1083 struct vms_symbol_entry
*entry
;
1087 entry
= (struct vms_symbol_entry
*)bfd_zalloc (abfd
, sizeof (*entry
) + len
);
1090 entry
->namelen
= len
;
1091 memcpy (entry
->name
, ascic
, len
);
1092 entry
->name
[len
] = 0;
1093 entry
->owner
= abfd
;
1095 if (!add_symbol_entry (abfd
, entry
))
1100 /* Read and process EGSD. Return FALSE on failure. */
1103 _bfd_vms_slurp_egsd (bfd
*abfd
)
1105 int gsd_type
, gsd_size
;
1106 unsigned char *vms_rec
;
1107 unsigned long base_addr
;
1109 vms_debug2 ((2, "EGSD\n"));
1111 PRIV (recrd
.rec
) += 8; /* Skip type, size, align pad. */
1112 PRIV (recrd
.rec_size
) -= 8;
1114 /* Calculate base address for each section. */
1117 while (PRIV (recrd
.rec_size
) > 0)
1119 vms_rec
= PRIV (recrd
.rec
);
1121 gsd_type
= bfd_getl16 (vms_rec
);
1122 gsd_size
= bfd_getl16 (vms_rec
+ 2);
1124 vms_debug2 ((3, "egsd_type %d\n", gsd_type
));
1129 /* Program section definition. */
1131 struct vms_egps
*egps
= (struct vms_egps
*)vms_rec
;
1132 flagword new_flags
, vms_flags
;
1135 vms_flags
= bfd_getl16 (egps
->flags
);
1137 if ((vms_flags
& EGPS__V_REL
) == 0)
1139 /* Use the global absolute section for all
1140 absolute sections. */
1141 section
= bfd_abs_section_ptr
;
1146 unsigned long align_addr
;
1148 name
= _bfd_vms_save_counted_string (&egps
->namlng
);
1150 section
= bfd_make_section (abfd
, name
);
1154 section
->filepos
= 0;
1155 section
->size
= bfd_getl32 (egps
->alloc
);
1156 section
->alignment_power
= egps
->align
;
1158 vms_section_data (section
)->flags
= vms_flags
;
1159 vms_section_data (section
)->no_flags
= 0;
1161 new_flags
= vms_secflag_by_name (evax_section_flags
, name
,
1163 if (section
->size
> 0)
1164 new_flags
|= SEC_LOAD
;
1165 if (!(vms_flags
& EGPS__V_NOMOD
) && section
->size
> 0)
1167 /* Set RELOC and HAS_CONTENTS if the section is not
1168 demand-zero and not empty. */
1169 new_flags
|= SEC_HAS_CONTENTS
;
1170 if (vms_flags
& EGPS__V_REL
)
1171 new_flags
|= SEC_RELOC
;
1173 if (vms_flags
& EGPS__V_EXE
)
1175 /* Set CODE if section is executable. */
1176 new_flags
|= SEC_CODE
;
1177 new_flags
&= ~SEC_DATA
;
1179 if (!bfd_set_section_flags (abfd
, section
, new_flags
))
1182 /* Give a non-overlapping vma to non absolute sections. */
1183 align_addr
= (1 << section
->alignment_power
);
1184 if ((base_addr
% align_addr
) != 0)
1185 base_addr
+= (align_addr
- (base_addr
% align_addr
));
1186 section
->vma
= (bfd_vma
)base_addr
;
1187 base_addr
+= section
->size
;
1190 /* Append it to the section array. */
1191 if (PRIV (section_count
) >= PRIV (section_max
))
1193 if (PRIV (section_max
) == 0)
1194 PRIV (section_max
) = 16;
1196 PRIV (section_max
) *= 2;
1197 PRIV (sections
) = bfd_realloc_or_free
1198 (PRIV (sections
), PRIV (section_max
) * sizeof (asection
*));
1199 if (PRIV (sections
) == NULL
)
1203 PRIV (sections
)[PRIV (section_count
)] = section
;
1204 PRIV (section_count
)++;
1211 struct vms_symbol_entry
*entry
;
1212 struct vms_egsy
*egsy
= (struct vms_egsy
*) vms_rec
;
1215 old_flags
= bfd_getl16 (egsy
->flags
);
1216 if (old_flags
& EGSY__V_DEF
)
1217 nameoff
= ESDF__B_NAMLNG
;
1219 nameoff
= ESRF__B_NAMLNG
;
1221 entry
= add_symbol (abfd
, vms_rec
+ nameoff
);
1225 /* Allow only duplicate reference. */
1226 if ((entry
->flags
& EGSY__V_DEF
) && (old_flags
& EGSY__V_DEF
))
1229 if (entry
->typ
== 0)
1231 entry
->typ
= gsd_type
;
1232 entry
->data_type
= egsy
->datyp
;
1233 entry
->flags
= old_flags
;
1236 if (old_flags
& EGSY__V_DEF
)
1238 struct vms_esdf
*esdf
= (struct vms_esdf
*)vms_rec
;
1240 entry
->value
= bfd_getl64 (esdf
->value
);
1241 entry
->section
= PRIV (sections
)[bfd_getl32 (esdf
->psindx
)];
1243 if (old_flags
& EGSY__V_NORM
)
1245 PRIV (norm_sym_count
)++;
1247 entry
->code_value
= bfd_getl64 (esdf
->code_address
);
1248 entry
->code_section
=
1249 PRIV (sections
)[bfd_getl32 (esdf
->ca_psindx
)];
1257 struct vms_symbol_entry
*entry
;
1258 struct vms_egst
*egst
= (struct vms_egst
*)vms_rec
;
1261 old_flags
= bfd_getl16 (egst
->header
.flags
);
1263 entry
= add_symbol (abfd
, &egst
->namlng
);
1268 entry
->typ
= gsd_type
;
1269 entry
->data_type
= egst
->header
.datyp
;
1270 entry
->flags
= old_flags
;
1272 entry
->symbol_vector
= bfd_getl32 (egst
->value
);
1274 if (old_flags
& EGSY__V_REL
)
1275 entry
->section
= PRIV (sections
)[bfd_getl32 (egst
->psindx
)];
1277 entry
->section
= bfd_abs_section_ptr
;
1279 entry
->value
= bfd_getl64 (egst
->lp_2
);
1281 if (old_flags
& EGSY__V_NORM
)
1283 PRIV (norm_sym_count
)++;
1285 entry
->code_value
= bfd_getl64 (egst
->lp_1
);
1286 entry
->code_section
= bfd_abs_section_ptr
;
1293 /* Currently ignored. */
1298 (*_bfd_error_handler
) (_("Unknown EGSD subtype %d"), gsd_type
);
1299 bfd_set_error (bfd_error_bad_value
);
1303 PRIV (recrd
.rec_size
) -= gsd_size
;
1304 PRIV (recrd
.rec
) += gsd_size
;
1307 if (PRIV (gsd_sym_count
) > 0)
1308 abfd
->flags
|= HAS_SYMS
;
1313 /* Stack routines for vms ETIR commands. */
1315 /* Push value and section index. */
1318 _bfd_vms_push (bfd
*abfd
, bfd_vma val
, unsigned int reloc
)
1320 vms_debug2 ((4, "<push %08lx (0x%08x) at %d>\n",
1321 (unsigned long)val
, reloc
, PRIV (stackptr
)));
1323 PRIV (stack
[PRIV (stackptr
)]).value
= val
;
1324 PRIV (stack
[PRIV (stackptr
)]).reloc
= reloc
;
1326 if (PRIV (stackptr
) >= STACKSIZE
)
1328 bfd_set_error (bfd_error_bad_value
);
1329 (*_bfd_error_handler
) (_("Stack overflow (%d) in _bfd_vms_push"), PRIV (stackptr
));
1334 /* Pop value and section index. */
1337 _bfd_vms_pop (bfd
*abfd
, bfd_vma
*val
, unsigned int *rel
)
1339 if (PRIV (stackptr
) == 0)
1341 bfd_set_error (bfd_error_bad_value
);
1342 (*_bfd_error_handler
) (_("Stack underflow in _bfd_vms_pop"));
1346 *val
= PRIV (stack
[PRIV (stackptr
)]).value
;
1347 *rel
= PRIV (stack
[PRIV (stackptr
)]).reloc
;
1349 vms_debug2 ((4, "<pop %08lx (0x%08x)>\n", (unsigned long)*val
, *rel
));
1352 /* Routines to fill sections contents during tir/etir read. */
1354 /* Initialize image buffer pointer to be filled. */
1357 image_set_ptr (bfd
*abfd
, bfd_vma vma
, int sect
, struct bfd_link_info
*info
)
1361 vms_debug2 ((4, "image_set_ptr (0x%08x, sect=%d)\n", (unsigned)vma
, sect
));
1363 sec
= PRIV (sections
)[sect
];
1367 /* Reading contents to an output bfd. */
1369 if (sec
->output_section
== NULL
)
1371 /* Section discarded. */
1372 vms_debug2 ((5, " section %s discarded\n", sec
->name
));
1374 /* This is not used. */
1375 PRIV (image_section
) = NULL
;
1376 PRIV (image_offset
) = 0;
1379 PRIV (image_offset
) = sec
->output_offset
+ vma
;
1380 PRIV (image_section
) = sec
->output_section
;
1384 PRIV (image_offset
) = vma
;
1385 PRIV (image_section
) = sec
;
1389 /* Increment image buffer pointer by offset. */
1392 image_inc_ptr (bfd
*abfd
, bfd_vma offset
)
1394 vms_debug2 ((4, "image_inc_ptr (%u)\n", (unsigned)offset
));
1396 PRIV (image_offset
) += offset
;
1399 /* Save current DST location counter under specified index. */
1402 dst_define_location (bfd
*abfd
, unsigned int loc
)
1404 vms_debug2 ((4, "dst_define_location (%d)\n", (int)loc
));
1406 /* Grow the ptr offset table if necessary. */
1407 if (loc
+ 1 > PRIV (dst_ptr_offsets_count
))
1409 PRIV (dst_ptr_offsets
) = bfd_realloc (PRIV (dst_ptr_offsets
),
1410 (loc
+ 1) * sizeof (unsigned int));
1411 PRIV (dst_ptr_offsets_count
) = loc
+ 1;
1414 PRIV (dst_ptr_offsets
)[loc
] = PRIV (image_offset
);
1417 /* Restore saved DST location counter from specified index. */
1420 dst_restore_location (bfd
*abfd
, unsigned int loc
)
1422 vms_debug2 ((4, "dst_restore_location (%d)\n", (int)loc
));
1424 PRIV (image_offset
) = PRIV (dst_ptr_offsets
)[loc
];
1427 /* Retrieve saved DST location counter from specified index. */
1430 dst_retrieve_location (bfd
*abfd
, unsigned int loc
)
1432 vms_debug2 ((4, "dst_retrieve_location (%d)\n", (int)loc
));
1434 return PRIV (dst_ptr_offsets
)[loc
];
1437 /* Write multiple bytes to section image. */
1440 image_write (bfd
*abfd
, unsigned char *ptr
, int size
)
1443 _bfd_vms_debug (8, "image_write from (%p, %d) to (%ld)\n", ptr
, size
,
1444 (long)PRIV (image_offset
));
1445 _bfd_hexdump (9, ptr
, size
, 0);
1448 if (PRIV (image_section
)->contents
!= NULL
)
1450 asection
*sec
= PRIV (image_section
);
1451 file_ptr off
= PRIV (image_offset
);
1454 if (off
> (file_ptr
)sec
->size
1455 || size
> (file_ptr
)sec
->size
1456 || off
+ size
> (file_ptr
)sec
->size
)
1458 bfd_set_error (bfd_error_bad_value
);
1462 memcpy (sec
->contents
+ off
, ptr
, size
);
1465 PRIV (image_offset
) += size
;
1469 /* Write byte to section image. */
1472 image_write_b (bfd
* abfd
, unsigned int value
)
1474 unsigned char data
[1];
1476 vms_debug2 ((6, "image_write_b (%02x)\n", (int) value
));
1480 return image_write (abfd
, data
, sizeof (data
));
1483 /* Write 2-byte word to image. */
1486 image_write_w (bfd
* abfd
, unsigned int value
)
1488 unsigned char data
[2];
1490 vms_debug2 ((6, "image_write_w (%04x)\n", (int) value
));
1492 bfd_putl16 (value
, data
);
1493 return image_write (abfd
, data
, sizeof (data
));
1496 /* Write 4-byte long to image. */
1499 image_write_l (bfd
* abfd
, unsigned long value
)
1501 unsigned char data
[4];
1503 vms_debug2 ((6, "image_write_l (%08lx)\n", value
));
1505 bfd_putl32 (value
, data
);
1506 return image_write (abfd
, data
, sizeof (data
));
1509 /* Write 8-byte quad to image. */
1512 image_write_q (bfd
* abfd
, bfd_vma value
)
1514 unsigned char data
[8];
1516 vms_debug2 ((6, "image_write_q (%08lx)\n", (unsigned long)value
));
1518 bfd_putl64 (value
, data
);
1519 return image_write (abfd
, data
, sizeof (data
));
1523 _bfd_vms_etir_name (int cmd
)
1527 case ETIR__C_STA_GBL
: return "ETIR__C_STA_GBL";
1528 case ETIR__C_STA_LW
: return "ETIR__C_STA_LW";
1529 case ETIR__C_STA_QW
: return "ETIR__C_STA_QW";
1530 case ETIR__C_STA_PQ
: return "ETIR__C_STA_PQ";
1531 case ETIR__C_STA_LI
: return "ETIR__C_STA_LI";
1532 case ETIR__C_STA_MOD
: return "ETIR__C_STA_MOD";
1533 case ETIR__C_STA_CKARG
: return "ETIR__C_STA_CKARG";
1534 case ETIR__C_STO_B
: return "ETIR__C_STO_B";
1535 case ETIR__C_STO_W
: return "ETIR__C_STO_W";
1536 case ETIR__C_STO_GBL
: return "ETIR__C_STO_GBL";
1537 case ETIR__C_STO_CA
: return "ETIR__C_STO_CA";
1538 case ETIR__C_STO_RB
: return "ETIR__C_STO_RB";
1539 case ETIR__C_STO_AB
: return "ETIR__C_STO_AB";
1540 case ETIR__C_STO_OFF
: return "ETIR__C_STO_OFF";
1541 case ETIR__C_STO_IMM
: return "ETIR__C_STO_IMM";
1542 case ETIR__C_STO_IMMR
: return "ETIR__C_STO_IMMR";
1543 case ETIR__C_STO_LW
: return "ETIR__C_STO_LW";
1544 case ETIR__C_STO_QW
: return "ETIR__C_STO_QW";
1545 case ETIR__C_STO_GBL_LW
: return "ETIR__C_STO_GBL_LW";
1546 case ETIR__C_STO_LP_PSB
: return "ETIR__C_STO_LP_PSB";
1547 case ETIR__C_STO_HINT_GBL
: return "ETIR__C_STO_HINT_GBL";
1548 case ETIR__C_STO_HINT_PS
: return "ETIR__C_STO_HINT_PS";
1549 case ETIR__C_OPR_ADD
: return "ETIR__C_OPR_ADD";
1550 case ETIR__C_OPR_SUB
: return "ETIR__C_OPR_SUB";
1551 case ETIR__C_OPR_INSV
: return "ETIR__C_OPR_INSV";
1552 case ETIR__C_OPR_USH
: return "ETIR__C_OPR_USH";
1553 case ETIR__C_OPR_ROT
: return "ETIR__C_OPR_ROT";
1554 case ETIR__C_OPR_REDEF
: return "ETIR__C_OPR_REDEF";
1555 case ETIR__C_OPR_DFLIT
: return "ETIR__C_OPR_DFLIT";
1556 case ETIR__C_STC_LP
: return "ETIR__C_STC_LP";
1557 case ETIR__C_STC_GBL
: return "ETIR__C_STC_GBL";
1558 case ETIR__C_STC_GCA
: return "ETIR__C_STC_GCA";
1559 case ETIR__C_STC_PS
: return "ETIR__C_STC_PS";
1560 case ETIR__C_STC_NBH_PS
: return "ETIR__C_STC_NBH_PS";
1561 case ETIR__C_STC_NOP_GBL
: return "ETIR__C_STC_NOP_GBL";
1562 case ETIR__C_STC_NOP_PS
: return "ETIR__C_STC_NOP_PS";
1563 case ETIR__C_STC_BSR_GBL
: return "ETIR__C_STC_BSR_GBL";
1564 case ETIR__C_STC_BSR_PS
: return "ETIR__C_STC_BSR_PS";
1565 case ETIR__C_STC_LDA_GBL
: return "ETIR__C_STC_LDA_GBL";
1566 case ETIR__C_STC_LDA_PS
: return "ETIR__C_STC_LDA_PS";
1567 case ETIR__C_STC_BOH_GBL
: return "ETIR__C_STC_BOH_GBL";
1568 case ETIR__C_STC_BOH_PS
: return "ETIR__C_STC_BOH_PS";
1569 case ETIR__C_STC_NBH_GBL
: return "ETIR__C_STC_NBH_GBL";
1570 case ETIR__C_STC_LP_PSB
: return "ETIR__C_STC_LP_PSB";
1571 case ETIR__C_CTL_SETRB
: return "ETIR__C_CTL_SETRB";
1572 case ETIR__C_CTL_AUGRB
: return "ETIR__C_CTL_AUGRB";
1573 case ETIR__C_CTL_DFLOC
: return "ETIR__C_CTL_DFLOC";
1574 case ETIR__C_CTL_STLOC
: return "ETIR__C_CTL_STLOC";
1575 case ETIR__C_CTL_STKDL
: return "ETIR__C_CTL_STKDL";
1578 /* These names have not yet been added to this switch statement. */
1579 (*_bfd_error_handler
) (_("unknown ETIR command %d"), cmd
);
1584 #define HIGHBIT(op) ((op & 0x80000000L) == 0x80000000L)
1587 _bfd_vms_get_value (bfd
*abfd
, const unsigned char *ascic
,
1588 struct bfd_link_info
*info
,
1590 struct alpha_vms_link_hash_entry
**hp
)
1595 struct alpha_vms_link_hash_entry
*h
;
1597 /* Not linking. Do not try to resolve the symbol. */
1606 for (i
= 0; i
< len
; i
++)
1607 name
[i
] = ascic
[i
+ 1];
1610 h
= (struct alpha_vms_link_hash_entry
*)
1611 bfd_link_hash_lookup (info
->hash
, name
, FALSE
, FALSE
, TRUE
);
1616 && (h
->root
.type
== bfd_link_hash_defined
1617 || h
->root
.type
== bfd_link_hash_defweak
))
1618 *vma
= h
->root
.u
.def
.value
1619 + h
->root
.u
.def
.section
->output_offset
1620 + h
->root
.u
.def
.section
->output_section
->vma
;
1621 else if (h
&& h
->root
.type
== bfd_link_hash_undefweak
)
1625 if (!(*info
->callbacks
->undefined_symbol
)
1626 (info
, name
, abfd
, PRIV (image_section
), PRIV (image_offset
), TRUE
))
1634 #define RELC_SHR_BASE 0x10000
1635 #define RELC_SEC_BASE 0x20000
1636 #define RELC_MASK 0x0ffff
1639 alpha_vms_sym_to_ctxt (struct alpha_vms_link_hash_entry
*h
)
1641 /* Handle undefined symbols. */
1642 if (h
== NULL
|| h
->sym
== NULL
)
1645 if (h
->sym
->typ
== EGSD__C_SYMG
)
1647 if (h
->sym
->flags
& EGSY__V_REL
)
1648 return RELC_SHR_BASE
+ PRIV2 (h
->sym
->owner
, shr_index
);
1651 /* Can this happen (non-relocatable symg) ? I'd like to see
1656 if (h
->sym
->typ
== EGSD__C_SYM
)
1658 if (h
->sym
->flags
& EGSY__V_REL
)
1667 alpha_vms_get_sym_value (asection
*sect
, bfd_vma addr
)
1669 return sect
->output_section
->vma
+ sect
->output_offset
+ addr
;
1673 alpha_vms_fix_sec_rel (bfd
*abfd
, struct bfd_link_info
*info
,
1674 unsigned int rel
, bfd_vma vma
)
1676 asection
*sec
= PRIV (sections
)[rel
& RELC_MASK
];
1680 if (sec
->output_section
== NULL
)
1682 return vma
+ sec
->output_section
->vma
+ sec
->output_offset
;
1685 return vma
+ sec
->vma
;
1688 /* Read an ETIR record from ABFD. If INFO is not null, put the content into
1689 the output section (used during linking).
1690 Return FALSE in case of error. */
1693 _bfd_vms_slurp_etir (bfd
*abfd
, struct bfd_link_info
*info
)
1696 unsigned int length
;
1697 unsigned char *maxptr
;
1702 struct alpha_vms_link_hash_entry
*h
;
1704 PRIV (recrd
.rec
) += ETIR__C_HEADER_SIZE
;
1705 PRIV (recrd
.rec_size
) -= ETIR__C_HEADER_SIZE
;
1707 ptr
= PRIV (recrd
.rec
);
1708 length
= PRIV (recrd
.rec_size
);
1709 maxptr
= ptr
+ length
;
1711 vms_debug2 ((2, "ETIR: %d bytes\n", length
));
1713 while (ptr
< maxptr
)
1715 int cmd
= bfd_getl16 (ptr
);
1716 int cmd_length
= bfd_getl16 (ptr
+ 2);
1721 _bfd_vms_debug (4, "etir: %s(%d)\n",
1722 _bfd_vms_etir_name (cmd
), cmd
);
1723 _bfd_hexdump (8, ptr
, cmd_length
- 4, 0);
1731 stack 32 bit value of symbol (high bits set to 0). */
1732 case ETIR__C_STA_GBL
:
1733 _bfd_vms_get_value (abfd
, ptr
, info
, &op1
, &h
);
1734 _bfd_vms_push (abfd
, op1
, alpha_vms_sym_to_ctxt (h
));
1740 stack 32 bit value, sign extend to 64 bit. */
1741 case ETIR__C_STA_LW
:
1742 _bfd_vms_push (abfd
, bfd_getl32 (ptr
), RELC_NONE
);
1748 stack 64 bit value of symbol. */
1749 case ETIR__C_STA_QW
:
1750 _bfd_vms_push (abfd
, bfd_getl64 (ptr
), RELC_NONE
);
1753 /* Stack psect base plus quadword offset
1754 arg: lw section index
1755 qw signed quadword offset (low 32 bits)
1757 Stack qw argument and section index
1758 (see ETIR__C_STO_OFF, ETIR__C_CTL_SETRB). */
1759 case ETIR__C_STA_PQ
:
1763 psect
= bfd_getl32 (ptr
);
1764 if ((unsigned int) psect
>= PRIV (section_count
))
1766 (*_bfd_error_handler
) (_("bad section index in %s"),
1767 _bfd_vms_etir_name (cmd
));
1768 bfd_set_error (bfd_error_bad_value
);
1771 op1
= bfd_getl64 (ptr
+ 4);
1772 _bfd_vms_push (abfd
, op1
, psect
| RELC_SEC_BASE
);
1776 case ETIR__C_STA_LI
:
1777 case ETIR__C_STA_MOD
:
1778 case ETIR__C_STA_CKARG
:
1779 (*_bfd_error_handler
) (_("unsupported STA cmd %s"),
1780 _bfd_vms_etir_name (cmd
));
1784 /* Store byte: pop stack, write byte
1787 _bfd_vms_pop (abfd
, &op1
, &rel1
);
1788 if (rel1
!= RELC_NONE
)
1790 image_write_b (abfd
, (unsigned int) op1
& 0xff);
1793 /* Store word: pop stack, write word
1796 _bfd_vms_pop (abfd
, &op1
, &rel1
);
1797 if (rel1
!= RELC_NONE
)
1799 image_write_w (abfd
, (unsigned int) op1
& 0xffff);
1802 /* Store longword: pop stack, write longword
1804 case ETIR__C_STO_LW
:
1805 _bfd_vms_pop (abfd
, &op1
, &rel1
);
1806 if (rel1
& RELC_SEC_BASE
)
1808 op1
= alpha_vms_fix_sec_rel (abfd
, info
, rel1
, op1
);
1811 else if (rel1
& RELC_SHR_BASE
)
1813 alpha_vms_add_fixup_lr (info
, rel1
& RELC_MASK
, op1
);
1816 if (rel1
!= RELC_NONE
)
1818 if (rel1
!= RELC_REL
)
1820 alpha_vms_add_lw_reloc (info
);
1822 image_write_l (abfd
, op1
);
1825 /* Store quadword: pop stack, write quadword
1827 case ETIR__C_STO_QW
:
1828 _bfd_vms_pop (abfd
, &op1
, &rel1
);
1829 if (rel1
& RELC_SEC_BASE
)
1831 op1
= alpha_vms_fix_sec_rel (abfd
, info
, rel1
, op1
);
1834 else if (rel1
& RELC_SHR_BASE
)
1836 if (rel1
!= RELC_NONE
)
1838 if (rel1
!= RELC_REL
)
1840 alpha_vms_add_qw_reloc (info
);
1842 image_write_q (abfd
, op1
);
1845 /* Store immediate repeated: pop stack for repeat count
1848 case ETIR__C_STO_IMMR
:
1852 size
= bfd_getl32 (ptr
);
1853 _bfd_vms_pop (abfd
, &op1
, &rel1
);
1854 if (rel1
!= RELC_NONE
)
1857 image_write (abfd
, ptr
+ 4, size
);
1861 /* Store global: write symbol value
1862 arg: cs global symbol name. */
1863 case ETIR__C_STO_GBL
:
1864 _bfd_vms_get_value (abfd
, ptr
, info
, &op1
, &h
);
1867 if (h
->sym
->typ
== EGSD__C_SYMG
)
1869 alpha_vms_add_fixup_qr
1870 (info
, abfd
, h
->sym
->owner
, h
->sym
->symbol_vector
);
1875 op1
= alpha_vms_get_sym_value (h
->sym
->section
,
1877 alpha_vms_add_qw_reloc (info
);
1880 image_write_q (abfd
, op1
);
1883 /* Store code address: write address of entry point
1884 arg: cs global symbol name (procedure). */
1885 case ETIR__C_STO_CA
:
1886 _bfd_vms_get_value (abfd
, ptr
, info
, &op1
, &h
);
1889 if (h
->sym
->flags
& EGSY__V_NORM
)
1891 /* That's really a procedure. */
1892 if (h
->sym
->typ
== EGSD__C_SYMG
)
1894 alpha_vms_add_fixup_ca (info
, abfd
, h
->sym
->owner
);
1895 op1
= h
->sym
->symbol_vector
;
1899 op1
= alpha_vms_get_sym_value (h
->sym
->code_section
,
1900 h
->sym
->code_value
);
1901 alpha_vms_add_qw_reloc (info
);
1906 /* Symbol is not a procedure. */
1910 image_write_q (abfd
, op1
);
1913 /* Store offset to psect: pop stack, add low 32 bits to base of psect
1915 case ETIR__C_STO_OFF
:
1916 _bfd_vms_pop (abfd
, &op1
, &rel1
);
1918 if (!(rel1
& RELC_SEC_BASE
))
1921 op1
= alpha_vms_fix_sec_rel (abfd
, info
, rel1
, op1
);
1923 image_write_q (abfd
, op1
);
1927 arg: lw count of bytes
1929 case ETIR__C_STO_IMM
:
1933 size
= bfd_getl32 (ptr
);
1934 image_write (abfd
, ptr
+ 4, size
);
1938 /* This code is 'reserved to digital' according to the openVMS
1939 linker manual, however it is generated by the DEC C compiler
1940 and defined in the include file.
1941 FIXME, since the following is just a guess
1942 store global longword: store 32bit value of symbol
1943 arg: cs symbol name. */
1944 case ETIR__C_STO_GBL_LW
:
1945 _bfd_vms_get_value (abfd
, ptr
, info
, &op1
, &h
);
1949 image_write_l (abfd
, op1
);
1952 case ETIR__C_STO_RB
:
1953 case ETIR__C_STO_AB
:
1954 case ETIR__C_STO_LP_PSB
:
1955 (*_bfd_error_handler
) (_("%s: not supported"),
1956 _bfd_vms_etir_name (cmd
));
1959 case ETIR__C_STO_HINT_GBL
:
1960 case ETIR__C_STO_HINT_PS
:
1961 (*_bfd_error_handler
) (_("%s: not implemented"),
1962 _bfd_vms_etir_name (cmd
));
1966 /* 200 Store-conditional Linkage Pair
1968 case ETIR__C_STC_LP
:
1970 /* 202 Store-conditional Address at global address
1974 case ETIR__C_STC_GBL
:
1976 /* 203 Store-conditional Code Address at global address
1978 cs procedure name. */
1979 case ETIR__C_STC_GCA
:
1981 /* 204 Store-conditional Address at psect + offset
1985 case ETIR__C_STC_PS
:
1986 (*_bfd_error_handler
) (_("%s: not supported"),
1987 _bfd_vms_etir_name (cmd
));
1991 /* 201 Store-conditional Linkage Pair with Procedure Signature
1997 case ETIR__C_STC_LP_PSB
:
1998 _bfd_vms_get_value (abfd
, ptr
+ 4, info
, &op1
, &h
);
2001 if (h
->sym
->typ
== EGSD__C_SYMG
)
2003 alpha_vms_add_fixup_lp (info
, abfd
, h
->sym
->owner
);
2004 op1
= h
->sym
->symbol_vector
;
2009 op1
= alpha_vms_get_sym_value (h
->sym
->code_section
,
2010 h
->sym
->code_value
);
2011 op2
= alpha_vms_get_sym_value (h
->sym
->section
,
2017 /* Undefined symbol. */
2021 image_write_q (abfd
, op1
);
2022 image_write_q (abfd
, op2
);
2025 /* 205 Store-conditional NOP at address of global
2027 case ETIR__C_STC_NOP_GBL
:
2030 /* 207 Store-conditional BSR at global address
2033 case ETIR__C_STC_BSR_GBL
:
2036 /* 209 Store-conditional LDA at global address
2039 case ETIR__C_STC_LDA_GBL
:
2042 /* 211 Store-conditional BSR or Hint at global address
2045 case ETIR__C_STC_BOH_GBL
:
2046 /* Currentl ignored. */
2049 /* 213 Store-conditional NOP,BSR or HINT at global address
2052 case ETIR__C_STC_NBH_GBL
:
2054 /* 206 Store-conditional NOP at pect + offset
2057 case ETIR__C_STC_NOP_PS
:
2059 /* 208 Store-conditional BSR at pect + offset
2062 case ETIR__C_STC_BSR_PS
:
2064 /* 210 Store-conditional LDA at psect + offset
2067 case ETIR__C_STC_LDA_PS
:
2069 /* 212 Store-conditional BSR or Hint at pect + offset
2072 case ETIR__C_STC_BOH_PS
:
2074 /* 214 Store-conditional NOP, BSR or HINT at psect + offset
2076 case ETIR__C_STC_NBH_PS
:
2077 (*_bfd_error_handler
) ("%s: not supported",
2078 _bfd_vms_etir_name (cmd
));
2082 /* Det relocation base: pop stack, set image location counter
2084 case ETIR__C_CTL_SETRB
:
2085 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2086 if (!(rel1
& RELC_SEC_BASE
))
2088 image_set_ptr (abfd
, op1
, rel1
& RELC_MASK
, info
);
2091 /* Augment relocation base: increment image location counter by offset
2092 arg: lw offset value. */
2093 case ETIR__C_CTL_AUGRB
:
2094 op1
= bfd_getl32 (ptr
);
2095 image_inc_ptr (abfd
, op1
);
2098 /* Define location: pop index, save location counter under index
2100 case ETIR__C_CTL_DFLOC
:
2101 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2102 if (rel1
!= RELC_NONE
)
2104 dst_define_location (abfd
, op1
);
2107 /* Set location: pop index, restore location counter from index
2109 case ETIR__C_CTL_STLOC
:
2110 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2111 if (rel1
!= RELC_NONE
)
2113 dst_restore_location (abfd
, op1
);
2116 /* Stack defined location: pop index, push location counter from index
2118 case ETIR__C_CTL_STKDL
:
2119 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2120 if (rel1
!= RELC_NONE
)
2122 _bfd_vms_push (abfd
, dst_retrieve_location (abfd
, op1
), RELC_NONE
);
2125 case ETIR__C_OPR_NOP
: /* No-op. */
2128 case ETIR__C_OPR_ADD
: /* Add. */
2129 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2130 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2131 if (rel1
== RELC_NONE
&& rel2
!= RELC_NONE
)
2133 else if (rel1
!= RELC_NONE
&& rel2
!= RELC_NONE
)
2135 _bfd_vms_push (abfd
, op1
+ op2
, rel1
);
2138 case ETIR__C_OPR_SUB
: /* Subtract. */
2139 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2140 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2141 if (rel1
== RELC_NONE
&& rel2
!= RELC_NONE
)
2143 else if ((rel1
& RELC_SEC_BASE
) && (rel2
& RELC_SEC_BASE
))
2145 op1
= alpha_vms_fix_sec_rel (abfd
, info
, rel1
, op1
);
2146 op2
= alpha_vms_fix_sec_rel (abfd
, info
, rel2
, op2
);
2149 else if (rel1
!= RELC_NONE
&& rel2
!= RELC_NONE
)
2151 _bfd_vms_push (abfd
, op2
- op1
, rel1
);
2154 case ETIR__C_OPR_MUL
: /* Multiply. */
2155 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2156 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2157 if (rel1
!= RELC_NONE
|| rel2
!= RELC_NONE
)
2159 _bfd_vms_push (abfd
, op1
* op2
, RELC_NONE
);
2162 case ETIR__C_OPR_DIV
: /* Divide. */
2163 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2164 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2165 if (rel1
!= RELC_NONE
|| rel2
!= RELC_NONE
)
2168 _bfd_vms_push (abfd
, 0, RELC_NONE
);
2170 _bfd_vms_push (abfd
, op2
/ op1
, RELC_NONE
);
2173 case ETIR__C_OPR_AND
: /* Logical AND. */
2174 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2175 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2176 if (rel1
!= RELC_NONE
|| rel2
!= RELC_NONE
)
2178 _bfd_vms_push (abfd
, op1
& op2
, RELC_NONE
);
2181 case ETIR__C_OPR_IOR
: /* Logical inclusive OR. */
2182 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2183 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2184 if (rel1
!= RELC_NONE
|| rel2
!= RELC_NONE
)
2186 _bfd_vms_push (abfd
, op1
| op2
, RELC_NONE
);
2189 case ETIR__C_OPR_EOR
: /* Logical exclusive OR. */
2190 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2191 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2192 if (rel1
!= RELC_NONE
|| rel2
!= RELC_NONE
)
2194 _bfd_vms_push (abfd
, op1
^ op2
, RELC_NONE
);
2197 case ETIR__C_OPR_NEG
: /* Negate. */
2198 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2199 if (rel1
!= RELC_NONE
)
2201 _bfd_vms_push (abfd
, -op1
, RELC_NONE
);
2204 case ETIR__C_OPR_COM
: /* Complement. */
2205 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2206 if (rel1
!= RELC_NONE
)
2208 _bfd_vms_push (abfd
, ~op1
, RELC_NONE
);
2211 case ETIR__C_OPR_ASH
: /* Arithmetic shift. */
2212 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2213 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2214 if (rel1
!= RELC_NONE
|| rel2
!= RELC_NONE
)
2217 (*_bfd_error_handler
) (_("invalid use of %s with contexts"),
2218 _bfd_vms_etir_name (cmd
));
2221 if ((int)op2
< 0) /* Shift right. */
2223 else /* Shift left. */
2225 _bfd_vms_push (abfd
, op1
, RELC_NONE
); /* FIXME: sym. */
2228 case ETIR__C_OPR_INSV
: /* Insert field. */
2229 case ETIR__C_OPR_USH
: /* Unsigned shift. */
2230 case ETIR__C_OPR_ROT
: /* Rotate. */
2231 case ETIR__C_OPR_REDEF
: /* Redefine symbol to current location. */
2232 case ETIR__C_OPR_DFLIT
: /* Define a literal. */
2233 (*_bfd_error_handler
) (_("%s: not supported"),
2234 _bfd_vms_etir_name (cmd
));
2238 case ETIR__C_OPR_SEL
: /* Select. */
2239 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2241 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2244 _bfd_vms_pop (abfd
, &op1
, &rel1
);
2245 _bfd_vms_pop (abfd
, &op2
, &rel2
);
2246 _bfd_vms_push (abfd
, op1
, rel1
);
2251 (*_bfd_error_handler
) (_("reserved cmd %d"), cmd
);
2256 ptr
+= cmd_length
- 4;
2262 /* Process EDBG/ETBT record.
2263 Return TRUE on success, FALSE on error */
2266 vms_slurp_debug (bfd
*abfd
)
2268 asection
*section
= PRIV (dst_section
);
2270 if (section
== NULL
)
2272 /* We have no way to find out beforehand how much debug info there
2273 is in an object file, so pick an initial amount and grow it as
2275 flagword flags
= SEC_HAS_CONTENTS
| SEC_DEBUGGING
| SEC_RELOC
2278 section
= bfd_make_section (abfd
, "$DST$");
2281 if (!bfd_set_section_flags (abfd
, section
, flags
))
2283 PRIV (dst_section
) = section
;
2286 PRIV (image_section
) = section
;
2287 PRIV (image_offset
) = section
->size
;
2289 if (!_bfd_vms_slurp_etir (abfd
, NULL
))
2292 section
->size
= PRIV (image_offset
);
2296 /* Process EDBG record.
2297 Return TRUE on success, FALSE on error. */
2300 _bfd_vms_slurp_edbg (bfd
*abfd
)
2302 vms_debug2 ((2, "EDBG\n"));
2304 abfd
->flags
|= HAS_DEBUG
| HAS_LINENO
;
2306 return vms_slurp_debug (abfd
);
2309 /* Process ETBT record.
2310 Return TRUE on success, FALSE on error. */
2313 _bfd_vms_slurp_etbt (bfd
*abfd
)
2315 vms_debug2 ((2, "ETBT\n"));
2317 abfd
->flags
|= HAS_LINENO
;
2319 return vms_slurp_debug (abfd
);
2322 /* Process EEOM record.
2323 Return TRUE on success, FALSE on error. */
2326 _bfd_vms_slurp_eeom (bfd
*abfd
)
2328 struct vms_eeom
*eeom
= (struct vms_eeom
*) PRIV (recrd
.rec
);
2330 vms_debug2 ((2, "EEOM\n"));
2332 PRIV (eom_data
).eom_l_total_lps
= bfd_getl32 (eeom
->total_lps
);
2333 PRIV (eom_data
).eom_w_comcod
= bfd_getl16 (eeom
->comcod
);
2334 if (PRIV (eom_data
).eom_w_comcod
> 1)
2336 (*_bfd_error_handler
) (_("Object module NOT error-free !\n"));
2337 bfd_set_error (bfd_error_bad_value
);
2341 PRIV (eom_data
).eom_has_transfer
= FALSE
;
2342 if (PRIV (recrd
.rec_size
) > 10)
2344 PRIV (eom_data
).eom_has_transfer
= TRUE
;
2345 PRIV (eom_data
).eom_b_tfrflg
= eeom
->tfrflg
;
2346 PRIV (eom_data
).eom_l_psindx
= bfd_getl32 (eeom
->psindx
);
2347 PRIV (eom_data
).eom_l_tfradr
= bfd_getl32 (eeom
->tfradr
);
2349 abfd
->start_address
= PRIV (eom_data
).eom_l_tfradr
;
2354 /* Slurp an ordered set of VMS object records. Return FALSE on error. */
2357 _bfd_vms_slurp_object_records (bfd
* abfd
)
2364 vms_debug2 ((7, "reading at %08lx\n", (unsigned long)bfd_tell (abfd
)));
2366 type
= _bfd_vms_get_object_record (abfd
);
2369 vms_debug2 ((2, "next_record failed\n"));
2376 err
= _bfd_vms_slurp_ehdr (abfd
);
2379 err
= _bfd_vms_slurp_eeom (abfd
);
2382 err
= _bfd_vms_slurp_egsd (abfd
);
2385 err
= TRUE
; /* _bfd_vms_slurp_etir (abfd); */
2388 err
= _bfd_vms_slurp_edbg (abfd
);
2391 err
= _bfd_vms_slurp_etbt (abfd
);
2398 vms_debug2 ((2, "slurp type %d failed\n", type
));
2402 while (type
!= EOBJ__C_EEOM
);
2407 /* Initialize private data */
2409 vms_initialize (bfd
* abfd
)
2413 amt
= sizeof (struct vms_private_data_struct
);
2414 abfd
->tdata
.any
= bfd_zalloc (abfd
, amt
);
2415 if (abfd
->tdata
.any
== NULL
)
2418 PRIV (recrd
.file_format
) = FF_UNKNOWN
;
2420 amt
= sizeof (struct stack_struct
) * STACKSIZE
;
2421 PRIV (stack
) = bfd_alloc (abfd
, amt
);
2422 if (PRIV (stack
) == NULL
)
2428 bfd_release (abfd
, abfd
->tdata
.any
);
2429 abfd
->tdata
.any
= NULL
;
2433 /* Check the format for a file being read.
2434 Return a (bfd_target *) if it's an object file or zero if not. */
2436 static const struct bfd_target
*
2437 alpha_vms_object_p (bfd
*abfd
)
2439 void *tdata_save
= abfd
->tdata
.any
;
2440 unsigned int test_len
;
2443 vms_debug2 ((1, "vms_object_p(%p)\n", abfd
));
2445 /* Allocate alpha-vms specific data. */
2446 if (!vms_initialize (abfd
))
2449 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
))
2450 goto err_wrong_format
;
2452 /* The first challenge with VMS is to discover the kind of the file.
2454 Image files (executable or shared images) are stored as a raw
2455 stream of bytes (like on UNIX), but there is no magic number.
2457 Object files are written with RMS (record management service), ie
2458 each records are preceeded by its length (on a word - 2 bytes), and
2459 padded for word-alignment. That would be simple but when files
2460 are transfered to a UNIX filesystem (using ftp), records are lost.
2461 Only the raw content of the records are transfered. Fortunately,
2462 the Alpha Object file format also store the length of the record
2463 in the records. Is that clear ? */
2465 /* Minimum is 6 bytes for objects (2 bytes size, 2 bytes record id,
2466 2 bytes size repeated) and 12 bytes for images (4 bytes major id,
2467 4 bytes minor id, 4 bytes length). */
2470 /* Size the main buffer. */
2471 buf
= (unsigned char *) bfd_malloc (test_len
);
2474 PRIV (recrd
.buf
) = buf
;
2475 PRIV (recrd
.buf_size
) = test_len
;
2477 /* Initialize the record pointer. */
2478 PRIV (recrd
.rec
) = buf
;
2480 if (bfd_bread (buf
, test_len
, abfd
) != test_len
)
2482 bfd_set_error (bfd_error_file_truncated
);
2486 /* Is it an image? */
2487 if ((bfd_getl32 (buf
) == EIHD__K_MAJORID
)
2488 && (bfd_getl32 (buf
+ 4) == EIHD__K_MINORID
))
2490 unsigned int to_read
;
2491 unsigned int read_so_far
;
2492 unsigned int remaining
;
2493 unsigned int eisd_offset
, eihs_offset
;
2495 /* Extract the header size. */
2496 PRIV (recrd
.rec_size
) = bfd_getl32 (buf
+ EIHD__L_SIZE
);
2498 /* The header size is 0 for DSF files. */
2499 if (PRIV (recrd
.rec_size
) == 0)
2500 PRIV (recrd
.rec_size
) = sizeof (struct vms_eihd
);
2502 if (PRIV (recrd
.rec_size
) > PRIV (recrd
.buf_size
))
2504 buf
= bfd_realloc_or_free (buf
, PRIV (recrd
.rec_size
));
2508 PRIV (recrd
.buf
) = NULL
;
2509 bfd_set_error (bfd_error_no_memory
);
2512 PRIV (recrd
.buf
) = buf
;
2513 PRIV (recrd
.buf_size
) = PRIV (recrd
.rec_size
);
2516 /* Read the remaining record. */
2517 remaining
= PRIV (recrd
.rec_size
) - test_len
;
2518 to_read
= MIN (VMS_BLOCK_SIZE
- test_len
, remaining
);
2519 read_so_far
= test_len
;
2521 while (remaining
> 0)
2523 if (bfd_bread (buf
+ read_so_far
, to_read
, abfd
) != to_read
)
2525 bfd_set_error (bfd_error_file_truncated
);
2526 goto err_wrong_format
;
2529 read_so_far
+= to_read
;
2530 remaining
-= to_read
;
2532 to_read
= MIN (VMS_BLOCK_SIZE
, remaining
);
2535 /* Reset the record pointer. */
2536 PRIV (recrd
.rec
) = buf
;
2538 vms_debug2 ((2, "file type is image\n"));
2540 if (_bfd_vms_slurp_eihd (abfd
, &eisd_offset
, &eihs_offset
) != TRUE
)
2541 goto err_wrong_format
;
2543 if (_bfd_vms_slurp_eisd (abfd
, eisd_offset
) != TRUE
)
2544 goto err_wrong_format
;
2546 /* EIHS is optional. */
2547 if (eihs_offset
!= 0 && _bfd_vms_slurp_eihs (abfd
, eihs_offset
) != TRUE
)
2548 goto err_wrong_format
;
2554 /* Assume it's a module and adjust record pointer if necessary. */
2555 maybe_adjust_record_pointer_for_object (abfd
);
2557 /* But is it really a module? */
2558 if (bfd_getl16 (PRIV (recrd
.rec
)) <= EOBJ__C_MAXRECTYP
2559 && bfd_getl16 (PRIV (recrd
.rec
) + 2) <= EOBJ__C_MAXRECSIZ
)
2561 if (vms_get_remaining_object_record (abfd
, test_len
) <= 0)
2562 goto err_wrong_format
;
2564 vms_debug2 ((2, "file type is module\n"));
2566 type
= bfd_getl16 (PRIV (recrd
.rec
));
2567 if (type
!= EOBJ__C_EMH
|| _bfd_vms_slurp_ehdr (abfd
) != TRUE
)
2568 goto err_wrong_format
;
2570 if (_bfd_vms_slurp_object_records (abfd
) != TRUE
)
2571 goto err_wrong_format
;
2574 goto err_wrong_format
;
2577 /* Set arch_info to alpha. */
2579 if (! bfd_default_set_arch_mach (abfd
, bfd_arch_alpha
, 0))
2580 goto err_wrong_format
;
2585 bfd_set_error (bfd_error_wrong_format
);
2588 if (PRIV (recrd
.buf
))
2589 free (PRIV (recrd
.buf
));
2590 if (abfd
->tdata
.any
!= tdata_save
&& abfd
->tdata
.any
!= NULL
)
2591 bfd_release (abfd
, abfd
->tdata
.any
);
2592 abfd
->tdata
.any
= tdata_save
;
2598 /* Write an EMH/MHD record. */
2601 _bfd_vms_write_emh (bfd
*abfd
)
2603 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
2605 _bfd_vms_output_alignment (recwr
, 2);
2608 _bfd_vms_output_begin (recwr
, EOBJ__C_EMH
);
2609 _bfd_vms_output_short (recwr
, EMH__C_MHD
);
2610 _bfd_vms_output_short (recwr
, EOBJ__C_STRLVL
);
2611 _bfd_vms_output_long (recwr
, 0);
2612 _bfd_vms_output_long (recwr
, 0);
2613 _bfd_vms_output_long (recwr
, MAX_OUTREC_SIZE
);
2615 /* Create module name from filename. */
2616 if (bfd_get_filename (abfd
) != 0)
2618 char *module
= vms_get_module_name (bfd_get_filename (abfd
), TRUE
);
2619 _bfd_vms_output_counted (recwr
, module
);
2623 _bfd_vms_output_counted (recwr
, "NONAME");
2625 _bfd_vms_output_counted (recwr
, BFD_VERSION_STRING
);
2626 _bfd_vms_output_dump (recwr
, get_vms_time_string (), EMH_DATE_LENGTH
);
2627 _bfd_vms_output_fill (recwr
, 0, EMH_DATE_LENGTH
);
2628 _bfd_vms_output_end (abfd
, recwr
);
2631 /* Write an EMH/LMN record. */
2634 _bfd_vms_write_lmn (bfd
*abfd
, const char *name
)
2637 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
2638 unsigned int ver
= BFD_VERSION
/ 10000;
2641 _bfd_vms_output_begin (recwr
, EOBJ__C_EMH
);
2642 _bfd_vms_output_short (recwr
, EMH__C_LNM
);
2643 snprintf (version
, sizeof (version
), "%s %d.%d.%d", name
,
2644 ver
/ 10000, (ver
/ 100) % 100, ver
% 100);
2645 _bfd_vms_output_dump (recwr
, (unsigned char *)version
, strlen (version
));
2646 _bfd_vms_output_end (abfd
, recwr
);
2650 /* Write eom record for bfd abfd. Return FALSE on error. */
2653 _bfd_vms_write_eeom (bfd
*abfd
)
2655 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
2657 vms_debug2 ((2, "vms_write_eeom\n"));
2659 _bfd_vms_output_alignment (recwr
, 2);
2661 _bfd_vms_output_begin (recwr
, EOBJ__C_EEOM
);
2662 _bfd_vms_output_long (recwr
, PRIV (vms_linkage_index
+ 1) >> 1);
2663 _bfd_vms_output_byte (recwr
, 0); /* Completion code. */
2664 _bfd_vms_output_byte (recwr
, 0); /* Fill byte. */
2666 if ((abfd
->flags
& EXEC_P
) == 0
2667 && bfd_get_start_address (abfd
) != (bfd_vma
)-1)
2671 section
= bfd_get_section_by_name (abfd
, ".link");
2674 bfd_set_error (bfd_error_nonrepresentable_section
);
2677 _bfd_vms_output_short (recwr
, 0);
2678 _bfd_vms_output_long (recwr
, (unsigned long) section
->target_index
);
2679 _bfd_vms_output_long (recwr
,
2680 (unsigned long) bfd_get_start_address (abfd
));
2681 _bfd_vms_output_long (recwr
, 0);
2684 _bfd_vms_output_end (abfd
, recwr
);
2688 /* This hash routine borrowed from GNU-EMACS, and strengthened
2692 hash_string (const char *ptr
)
2694 const unsigned char *p
= (unsigned char *) ptr
;
2695 const unsigned char *end
= p
+ strlen (ptr
);
2702 hash
= ((hash
<< 3) + (hash
<< 15) + (hash
>> 28) + c
);
2707 /* Generate a length-hashed VMS symbol name (limited to maxlen chars). */
2710 _bfd_vms_length_hash_symbol (bfd
*abfd
, const char *in
, int maxlen
)
2712 unsigned long result
;
2715 const char *old_name
;
2717 static char outbuf
[EOBJ__C_SYMSIZ
+ 1];
2721 vms_debug (4, "_bfd_vms_length_hash_symbol \"%s\"\n", in
);
2724 if (maxlen
> EOBJ__C_SYMSIZ
)
2725 maxlen
= EOBJ__C_SYMSIZ
;
2727 /* Save this for later. */
2730 /* We may need to truncate the symbol, save the hash for later. */
2731 in_len
= strlen (in
);
2733 result
= (in_len
> maxlen
) ? hash_string (in
) : 0;
2737 /* Do the length checking. */
2738 if (in_len
<= maxlen
)
2742 if (PRIV (flag_hash_long_names
))
2748 strncpy (out
, in
, (size_t) i
);
2752 if ((in_len
> maxlen
)
2753 && PRIV (flag_hash_long_names
))
2754 sprintf (out
, "_%08lx", result
);
2759 vms_debug (4, "--> [%d]\"%s\"\n", (int)strlen (outbuf
), outbuf
);
2763 && PRIV (flag_hash_long_names
)
2764 && PRIV (flag_show_after_trunc
))
2765 printf (_("Symbol %s replaced by %s\n"), old_name
, new_name
);
2771 vector_grow1 (struct vector_type
*vec
, size_t elsz
)
2773 if (vec
->nbr_el
+ 1 < vec
->max_el
)
2776 if (vec
->max_el
== 0)
2779 vec
->els
= bfd_malloc2 (vec
->max_el
, elsz
);
2784 vec
->els
= bfd_realloc2 (vec
->els
, vec
->max_el
, elsz
);
2788 /* Bump ABFD file position to next block. */
2791 alpha_vms_file_position_block (bfd
*abfd
)
2794 PRIV (file_pos
) += VMS_BLOCK_SIZE
- 1;
2795 PRIV (file_pos
) -= (PRIV (file_pos
) % VMS_BLOCK_SIZE
);
2798 /* Convert from internal structure SRC to external structure DST. */
2801 alpha_vms_swap_eisd_out (struct vms_internal_eisd_map
*src
,
2802 struct vms_eisd
*dst
)
2804 bfd_putl32 (src
->u
.eisd
.majorid
, dst
->majorid
);
2805 bfd_putl32 (src
->u
.eisd
.minorid
, dst
->minorid
);
2806 bfd_putl32 (src
->u
.eisd
.eisdsize
, dst
->eisdsize
);
2807 if (src
->u
.eisd
.eisdsize
<= EISD__K_LENEND
)
2809 bfd_putl32 (src
->u
.eisd
.secsize
, dst
->secsize
);
2810 bfd_putl64 (src
->u
.eisd
.virt_addr
, dst
->virt_addr
);
2811 bfd_putl32 (src
->u
.eisd
.flags
, dst
->flags
);
2812 bfd_putl32 (src
->u
.eisd
.vbn
, dst
->vbn
);
2813 dst
->pfc
= src
->u
.eisd
.pfc
;
2814 dst
->matchctl
= src
->u
.eisd
.matchctl
;
2815 dst
->type
= src
->u
.eisd
.type
;
2817 if (src
->u
.eisd
.flags
& EISD__M_GBL
)
2819 bfd_putl32 (src
->u
.gbl_eisd
.ident
, dst
->ident
);
2820 memcpy (dst
->gblnam
, src
->u
.gbl_eisd
.gblnam
,
2821 src
->u
.gbl_eisd
.gblnam
[0] + 1);
2825 /* Append EISD to the list of extra eisd for ABFD. */
2828 alpha_vms_append_extra_eisd (bfd
*abfd
, struct vms_internal_eisd_map
*eisd
)
2831 if (PRIV (gbl_eisd_head
) == NULL
)
2832 PRIV (gbl_eisd_head
) = eisd
;
2834 PRIV (gbl_eisd_tail
)->next
= eisd
;
2835 PRIV (gbl_eisd_tail
) = eisd
;
2838 /* Create an EISD for shared image SHRIMG.
2839 Return FALSE in case of error. */
2842 alpha_vms_create_eisd_for_shared (bfd
*abfd
, bfd
*shrimg
)
2844 struct vms_internal_eisd_map
*eisd
;
2847 namlen
= strlen (PRIV2 (shrimg
, hdr_data
.hdr_t_name
));
2848 if (namlen
+ 5 > EISD__K_GBLNAMLEN
)
2854 eisd
= bfd_alloc (abfd
, sizeof (*eisd
));
2858 /* Fill the fields. */
2859 eisd
->u
.gbl_eisd
.common
.majorid
= EISD__K_MAJORID
;
2860 eisd
->u
.gbl_eisd
.common
.minorid
= EISD__K_MINORID
;
2861 eisd
->u
.gbl_eisd
.common
.eisdsize
= (EISD__K_LEN
+ 4 + namlen
+ 5 + 3) & ~3;
2862 eisd
->u
.gbl_eisd
.common
.secsize
= VMS_BLOCK_SIZE
; /* Must not be 0. */
2863 eisd
->u
.gbl_eisd
.common
.virt_addr
= 0;
2864 eisd
->u
.gbl_eisd
.common
.flags
= EISD__M_GBL
;
2865 eisd
->u
.gbl_eisd
.common
.vbn
= 0;
2866 eisd
->u
.gbl_eisd
.common
.pfc
= 0;
2867 eisd
->u
.gbl_eisd
.common
.matchctl
= PRIV2 (shrimg
, matchctl
);
2868 eisd
->u
.gbl_eisd
.common
.type
= EISD__K_SHRPIC
;
2870 eisd
->u
.gbl_eisd
.ident
= PRIV2 (shrimg
, ident
);
2871 eisd
->u
.gbl_eisd
.gblnam
[0] = namlen
+ 4;
2872 memcpy (eisd
->u
.gbl_eisd
.gblnam
+ 1, PRIV2 (shrimg
, hdr_data
.hdr_t_name
),
2874 memcpy (eisd
->u
.gbl_eisd
.gblnam
+ 1 + namlen
, "_001", 4);
2876 /* Append it to the list. */
2877 alpha_vms_append_extra_eisd (abfd
, eisd
);
2882 /* Create an EISD for section SEC.
2883 Return FALSE in case of failure. */
2886 alpha_vms_create_eisd_for_section (bfd
*abfd
, asection
*sec
)
2888 struct vms_internal_eisd_map
*eisd
;
2890 /* Only for allocating section. */
2891 if (!(sec
->flags
& SEC_ALLOC
))
2894 BFD_ASSERT (vms_section_data (sec
)->eisd
== NULL
);
2895 eisd
= bfd_alloc (abfd
, sizeof (*eisd
));
2898 vms_section_data (sec
)->eisd
= eisd
;
2900 /* Fill the fields. */
2901 eisd
->u
.eisd
.majorid
= EISD__K_MAJORID
;
2902 eisd
->u
.eisd
.minorid
= EISD__K_MINORID
;
2903 eisd
->u
.eisd
.eisdsize
= EISD__K_LEN
;
2904 eisd
->u
.eisd
.secsize
=
2905 (sec
->size
+ VMS_BLOCK_SIZE
- 1) & ~(VMS_BLOCK_SIZE
- 1);
2906 eisd
->u
.eisd
.virt_addr
= sec
->vma
;
2907 eisd
->u
.eisd
.flags
= 0;
2908 eisd
->u
.eisd
.vbn
= 0; /* To be later defined. */
2909 eisd
->u
.eisd
.pfc
= 0; /* Default. */
2910 eisd
->u
.eisd
.matchctl
= EISD__K_MATALL
;
2911 eisd
->u
.eisd
.type
= EISD__K_NORMAL
;
2913 if (sec
->flags
& SEC_CODE
)
2914 eisd
->u
.eisd
.flags
|= EISD__M_EXE
;
2915 if (!(sec
->flags
& SEC_READONLY
))
2916 eisd
->u
.eisd
.flags
|= EISD__M_WRT
| EISD__M_CRF
;
2918 /* If relocations or fixup will be applied, make this isect writeable. */
2919 if (sec
->flags
& SEC_RELOC
)
2920 eisd
->u
.eisd
.flags
|= EISD__M_WRT
| EISD__M_CRF
;
2922 if (!(sec
->flags
& SEC_HAS_CONTENTS
))
2924 eisd
->u
.eisd
.flags
|= EISD__M_DZRO
;
2925 eisd
->u
.eisd
.flags
&= ~EISD__M_CRF
;
2927 if (sec
->flags
& SEC_LINKER_CREATED
)
2929 if (strcmp (sec
->name
, "$FIXUP$") == 0)
2930 eisd
->u
.eisd
.flags
|= EISD__M_FIXUPVEC
;
2933 /* Append it to the list. */
2935 if (PRIV (eisd_head
) == NULL
)
2936 PRIV (eisd_head
) = eisd
;
2938 PRIV (eisd_tail
)->next
= eisd
;
2939 PRIV (eisd_tail
) = eisd
;
2944 /* Layout executable ABFD and write it to the disk.
2945 Return FALSE in case of failure. */
2948 alpha_vms_write_exec (bfd
*abfd
)
2950 struct vms_eihd eihd
;
2951 struct vms_eiha
*eiha
;
2952 struct vms_eihi
*eihi
;
2953 struct vms_eihs
*eihs
= NULL
;
2955 struct vms_internal_eisd_map
*first_eisd
;
2956 struct vms_internal_eisd_map
*eisd
;
2959 file_ptr gst_filepos
= 0;
2960 unsigned int lnkflags
= 0;
2962 /* Build the EIHD. */
2963 PRIV (file_pos
) = EIHD__C_LENGTH
;
2965 memset (&eihd
, 0, sizeof (eihd
));
2966 memset (eihd
.fill_2
, 0xff, sizeof (eihd
.fill_2
));
2968 bfd_putl32 (EIHD__K_MAJORID
, eihd
.majorid
);
2969 bfd_putl32 (EIHD__K_MINORID
, eihd
.minorid
);
2971 bfd_putl32 (sizeof (eihd
), eihd
.size
);
2972 bfd_putl32 (0, eihd
.isdoff
);
2973 bfd_putl32 (0, eihd
.activoff
);
2974 bfd_putl32 (0, eihd
.symdbgoff
);
2975 bfd_putl32 (0, eihd
.imgidoff
);
2976 bfd_putl32 (0, eihd
.patchoff
);
2977 bfd_putl64 (0, eihd
.iafva
);
2978 bfd_putl32 (0, eihd
.version_array_off
);
2980 bfd_putl32 (EIHD__K_EXE
, eihd
.imgtype
);
2981 bfd_putl32 (0, eihd
.subtype
);
2983 bfd_putl32 (0, eihd
.imgiocnt
);
2984 bfd_putl32 (-1, eihd
.privreqs
);
2985 bfd_putl32 (-1, eihd
.privreqs
+ 4);
2987 bfd_putl32 ((sizeof (eihd
) + VMS_BLOCK_SIZE
- 1) / VMS_BLOCK_SIZE
,
2989 bfd_putl32 (0, eihd
.ident
);
2990 bfd_putl32 (0, eihd
.sysver
);
2993 bfd_putl32 (0, eihd
.symvect_size
);
2994 bfd_putl32 (16, eihd
.virt_mem_block_size
);
2995 bfd_putl32 (0, eihd
.ext_fixup_off
);
2996 bfd_putl32 (0, eihd
.noopt_psect_off
);
2997 bfd_putl32 (-1, eihd
.alias
);
3000 eiha
= (struct vms_eiha
*)((char *) &eihd
+ PRIV (file_pos
));
3001 bfd_putl32 (PRIV (file_pos
), eihd
.activoff
);
3002 PRIV (file_pos
) += sizeof (struct vms_eiha
);
3004 bfd_putl32 (sizeof (struct vms_eiha
), eiha
->size
);
3005 bfd_putl32 (0, eiha
->spare
);
3006 bfd_putl64 (PRIV (transfer_address
[0]), eiha
->tfradr1
);
3007 bfd_putl64 (PRIV (transfer_address
[1]), eiha
->tfradr2
);
3008 bfd_putl64 (PRIV (transfer_address
[2]), eiha
->tfradr3
);
3009 bfd_putl64 (PRIV (transfer_address
[3]), eiha
->tfradr4
);
3010 bfd_putl64 (0, eiha
->inishr
);
3013 eihi
= (struct vms_eihi
*)((char *) &eihd
+ PRIV (file_pos
));
3014 bfd_putl32 (PRIV (file_pos
), eihd
.imgidoff
);
3015 PRIV (file_pos
) += sizeof (struct vms_eihi
);
3017 bfd_putl32 (EIHI__K_MAJORID
, eihi
->majorid
);
3018 bfd_putl32 (EIHI__K_MINORID
, eihi
->minorid
);
3023 /* Set module name. */
3024 module
= vms_get_module_name (bfd_get_filename (abfd
), TRUE
);
3025 len
= strlen (module
);
3026 if (len
> sizeof (eihi
->imgnam
) - 1)
3027 len
= sizeof (eihi
->imgnam
) - 1;
3028 eihi
->imgnam
[0] = len
;
3029 memcpy (eihi
->imgnam
+ 1, module
, len
);
3037 vms_get_time (&hi
, &lo
);
3038 bfd_putl32 (lo
, eihi
->linktime
+ 0);
3039 bfd_putl32 (hi
, eihi
->linktime
+ 4);
3042 eihi
->linkid
[0] = 0;
3043 eihi
->imgbid
[0] = 0;
3046 dst
= PRIV (dst_section
);
3047 dmt
= bfd_get_section_by_name (abfd
, "$DMT$");
3048 if (dst
!= NULL
&& dst
->size
!= 0)
3050 eihs
= (struct vms_eihs
*)((char *) &eihd
+ PRIV (file_pos
));
3051 bfd_putl32 (PRIV (file_pos
), eihd
.symdbgoff
);
3052 PRIV (file_pos
) += sizeof (struct vms_eihs
);
3054 bfd_putl32 (EIHS__K_MAJORID
, eihs
->majorid
);
3055 bfd_putl32 (EIHS__K_MINORID
, eihs
->minorid
);
3056 bfd_putl32 (0, eihs
->dstvbn
);
3057 bfd_putl32 (0, eihs
->dstsize
);
3058 bfd_putl32 (0, eihs
->gstvbn
);
3059 bfd_putl32 (0, eihs
->gstsize
);
3060 bfd_putl32 (0, eihs
->dmtvbn
);
3061 bfd_putl32 (0, eihs
->dmtsize
);
3064 /* One EISD per section. */
3065 for (sec
= abfd
->sections
; sec
; sec
= sec
->next
)
3067 if (!alpha_vms_create_eisd_for_section (abfd
, sec
))
3071 /* Merge section EIDS which extra ones. */
3072 if (PRIV (eisd_tail
))
3073 PRIV (eisd_tail
)->next
= PRIV (gbl_eisd_head
);
3075 PRIV (eisd_head
) = PRIV (gbl_eisd_head
);
3076 if (PRIV (gbl_eisd_tail
))
3077 PRIV (eisd_tail
) = PRIV (gbl_eisd_tail
);
3079 first_eisd
= PRIV (eisd_head
);
3081 /* Add end of eisd. */
3084 eisd
= bfd_zalloc (abfd
, sizeof (*eisd
));
3087 eisd
->u
.eisd
.majorid
= 0;
3088 eisd
->u
.eisd
.minorid
= 0;
3089 eisd
->u
.eisd
.eisdsize
= 0;
3090 alpha_vms_append_extra_eisd (abfd
, eisd
);
3093 /* Place EISD in the file. */
3094 for (eisd
= first_eisd
; eisd
; eisd
= eisd
->next
)
3096 file_ptr room
= VMS_BLOCK_SIZE
- (PRIV (file_pos
) % VMS_BLOCK_SIZE
);
3098 /* First block is a little bit special: there is a word at the end. */
3099 if (PRIV (file_pos
) < VMS_BLOCK_SIZE
&& room
> 2)
3101 if (room
< eisd
->u
.eisd
.eisdsize
+ EISD__K_LENEND
)
3102 alpha_vms_file_position_block (abfd
);
3104 eisd
->file_pos
= PRIV (file_pos
);
3105 PRIV (file_pos
) += eisd
->u
.eisd
.eisdsize
;
3107 if (eisd
->u
.eisd
.flags
& EISD__M_FIXUPVEC
)
3108 bfd_putl64 (eisd
->u
.eisd
.virt_addr
, eihd
.iafva
);
3111 if (first_eisd
!= NULL
)
3113 bfd_putl32 (first_eisd
->file_pos
, eihd
.isdoff
);
3114 /* Real size of end of eisd marker. */
3115 PRIV (file_pos
) += EISD__K_LENEND
;
3118 bfd_putl32 (PRIV (file_pos
), eihd
.size
);
3119 bfd_putl32 ((PRIV (file_pos
) + VMS_BLOCK_SIZE
- 1) / VMS_BLOCK_SIZE
,
3122 /* Place sections. */
3123 for (sec
= abfd
->sections
; sec
; sec
= sec
->next
)
3125 if (!(sec
->flags
& SEC_HAS_CONTENTS
))
3128 eisd
= vms_section_data (sec
)->eisd
;
3130 /* Align on a block. */
3131 alpha_vms_file_position_block (abfd
);
3132 sec
->filepos
= PRIV (file_pos
);
3135 eisd
->u
.eisd
.vbn
= (sec
->filepos
/ VMS_BLOCK_SIZE
) + 1;
3137 PRIV (file_pos
) += sec
->size
;
3141 if (eihs
!= NULL
&& dst
!= NULL
)
3143 bfd_putl32 ((dst
->filepos
/ VMS_BLOCK_SIZE
) + 1, eihs
->dstvbn
);
3144 bfd_putl32 (dst
->size
, eihs
->dstsize
);
3148 lnkflags
|= EIHD__M_DBGDMT
;
3149 bfd_putl32 ((dmt
->filepos
/ VMS_BLOCK_SIZE
) + 1, eihs
->dmtvbn
);
3150 bfd_putl32 (dmt
->size
, eihs
->dmtsize
);
3152 if (PRIV (gsd_sym_count
) != 0)
3154 alpha_vms_file_position_block (abfd
);
3155 gst_filepos
= PRIV (file_pos
);
3156 bfd_putl32 ((gst_filepos
/ VMS_BLOCK_SIZE
) + 1, eihs
->gstvbn
);
3157 bfd_putl32 ((PRIV (gsd_sym_count
) + 4) / 5 + 4, eihs
->gstsize
);
3161 /* Write EISD in hdr. */
3162 for (eisd
= first_eisd
; eisd
&& eisd
->file_pos
< VMS_BLOCK_SIZE
;
3164 alpha_vms_swap_eisd_out
3165 (eisd
, (struct vms_eisd
*)((char *)&eihd
+ eisd
->file_pos
));
3167 /* Write first block. */
3168 bfd_putl32 (lnkflags
, eihd
.lnkflags
);
3169 if (bfd_bwrite (&eihd
, sizeof (eihd
), abfd
) != sizeof (eihd
))
3172 /* Write remaining eisd. */
3175 unsigned char blk
[VMS_BLOCK_SIZE
];
3176 struct vms_internal_eisd_map
*next_eisd
;
3178 memset (blk
, 0xff, sizeof (blk
));
3179 while (eisd
!= NULL
)
3181 alpha_vms_swap_eisd_out
3183 (struct vms_eisd
*)(blk
+ (eisd
->file_pos
% VMS_BLOCK_SIZE
)));
3185 next_eisd
= eisd
->next
;
3186 if (next_eisd
== NULL
3187 || (next_eisd
->file_pos
/ VMS_BLOCK_SIZE
3188 != eisd
->file_pos
/ VMS_BLOCK_SIZE
))
3190 if (bfd_bwrite (blk
, sizeof (blk
), abfd
) != sizeof (blk
))
3193 memset (blk
, 0xff, sizeof (blk
));
3199 /* Write sections. */
3200 for (sec
= abfd
->sections
; sec
; sec
= sec
->next
)
3202 unsigned char blk
[VMS_BLOCK_SIZE
];
3205 if (sec
->size
== 0 || !(sec
->flags
& SEC_HAS_CONTENTS
))
3207 if (bfd_bwrite (sec
->contents
, sec
->size
, abfd
) != sec
->size
)
3211 len
= VMS_BLOCK_SIZE
- sec
->size
% VMS_BLOCK_SIZE
;
3212 if (len
!= VMS_BLOCK_SIZE
)
3214 memset (blk
, 0, len
);
3215 if (bfd_bwrite (blk
, len
, abfd
) != len
)
3221 if (gst_filepos
!= 0)
3223 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
3226 _bfd_vms_write_emh (abfd
);
3227 _bfd_vms_write_lmn (abfd
, "GNU LD");
3229 /* PSC for the absolute section. */
3230 _bfd_vms_output_begin (recwr
, EOBJ__C_EGSD
);
3231 _bfd_vms_output_long (recwr
, 0);
3232 _bfd_vms_output_begin_subrec (recwr
, EGSD__C_PSC
);
3233 _bfd_vms_output_short (recwr
, 0);
3234 _bfd_vms_output_short (recwr
, EGPS__V_PIC
| EGPS__V_LIB
| EGPS__V_RD
);
3235 _bfd_vms_output_long (recwr
, 0);
3236 _bfd_vms_output_counted (recwr
, ".$$ABS$$.");
3237 _bfd_vms_output_end_subrec (recwr
);
3238 _bfd_vms_output_end (abfd
, recwr
);
3240 for (i
= 0; i
< PRIV (gsd_sym_count
); i
++)
3242 struct vms_symbol_entry
*sym
= PRIV (syms
)[i
];
3249 _bfd_vms_output_alignment (recwr
, 8);
3250 _bfd_vms_output_begin (recwr
, EOBJ__C_EGSD
);
3251 _bfd_vms_output_long (recwr
, 0);
3253 _bfd_vms_output_begin_subrec (recwr
, EGSD__C_SYMG
);
3254 _bfd_vms_output_short (recwr
, 0); /* Data type, alignment. */
3255 _bfd_vms_output_short (recwr
, sym
->flags
);
3257 if (sym
->code_section
)
3258 ep
= alpha_vms_get_sym_value (sym
->code_section
, sym
->code_value
);
3261 BFD_ASSERT (sym
->code_value
== 0);
3264 val
= alpha_vms_get_sym_value (sym
->section
, sym
->value
);
3265 _bfd_vms_output_quad
3266 (recwr
, sym
->typ
== EGSD__C_SYMG
? sym
->symbol_vector
: val
);
3267 _bfd_vms_output_quad (recwr
, ep
);
3268 _bfd_vms_output_quad (recwr
, val
);
3269 _bfd_vms_output_long (recwr
, 0);
3270 hash
= _bfd_vms_length_hash_symbol (abfd
, sym
->name
, EOBJ__C_SYMSIZ
);
3271 _bfd_vms_output_counted (recwr
, hash
);
3272 _bfd_vms_output_end_subrec (recwr
);
3274 _bfd_vms_output_end (abfd
, recwr
);
3277 _bfd_vms_output_end (abfd
, recwr
);
3279 if (!_bfd_vms_write_eeom (abfd
))
3287 /* Write section and symbol directory of bfd abfd. Return FALSE on error. */
3290 _bfd_vms_write_egsd (bfd
*abfd
)
3294 unsigned int symnum
;
3296 flagword new_flags
, old_flags
;
3297 int abs_section_index
= -1;
3298 unsigned int target_index
= 0;
3299 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
3301 vms_debug2 ((2, "vms_write_egsd\n"));
3303 /* Egsd is quadword aligned. */
3304 _bfd_vms_output_alignment (recwr
, 8);
3306 _bfd_vms_output_begin (recwr
, EOBJ__C_EGSD
);
3307 _bfd_vms_output_long (recwr
, 0);
3309 /* Number sections. */
3310 for (section
= abfd
->sections
; section
!= NULL
; section
= section
->next
)
3312 if (section
->flags
& SEC_DEBUGGING
)
3314 if (!strcmp (section
->name
, ".vmsdebug"))
3316 section
->flags
|= SEC_DEBUGGING
;
3319 section
->target_index
= target_index
++;
3322 for (section
= abfd
->sections
; section
!= NULL
; section
= section
->next
)
3324 vms_debug2 ((3, "Section #%d %s, %d bytes\n",
3325 section
->target_index
, section
->name
, (int)section
->size
));
3327 /* Don't write out the VMS debug info section since it is in the
3328 ETBT and EDBG sections in etir. */
3329 if (section
->flags
& SEC_DEBUGGING
)
3332 /* 13 bytes egsd, max 31 chars name -> should be 44 bytes. */
3333 if (_bfd_vms_output_check (recwr
, 64) < 0)
3335 _bfd_vms_output_end (abfd
, recwr
);
3336 _bfd_vms_output_begin (recwr
, EOBJ__C_EGSD
);
3337 _bfd_vms_output_long (recwr
, 0);
3340 /* Don't know if this is necessary for the linker but for now it keeps
3341 vms_slurp_gsd happy. */
3342 sname
= section
->name
;
3345 /* Remove leading dot. */
3347 if ((*sname
== 't') && (strcmp (sname
, "text") == 0))
3348 sname
= EVAX_CODE_NAME
;
3349 else if ((*sname
== 'd') && (strcmp (sname
, "data") == 0))
3350 sname
= EVAX_DATA_NAME
;
3351 else if ((*sname
== 'b') && (strcmp (sname
, "bss") == 0))
3352 sname
= EVAX_BSS_NAME
;
3353 else if ((*sname
== 'l') && (strcmp (sname
, "link") == 0))
3354 sname
= EVAX_LINK_NAME
;
3355 else if ((*sname
== 'r') && (strcmp (sname
, "rdata") == 0))
3356 sname
= EVAX_READONLY_NAME
;
3357 else if ((*sname
== 'l') && (strcmp (sname
, "literal") == 0))
3358 sname
= EVAX_LITERAL_NAME
;
3359 else if ((*sname
== 'l') && (strcmp (sname
, "literals") == 0))
3360 sname
= EVAX_LITERALS_NAME
;
3361 else if ((*sname
== 'c') && (strcmp (sname
, "comm") == 0))
3362 sname
= EVAX_COMMON_NAME
;
3363 else if ((*sname
== 'l') && (strcmp (sname
, "lcomm") == 0))
3364 sname
= EVAX_LOCAL_NAME
;
3367 sname
= _bfd_vms_length_hash_symbol (abfd
, sname
, EOBJ__C_SECSIZ
);
3369 if (bfd_is_com_section (section
))
3370 new_flags
= (EGPS__V_OVR
| EGPS__V_REL
| EGPS__V_GBL
| EGPS__V_RD
3371 | EGPS__V_WRT
| EGPS__V_NOMOD
| EGPS__V_COM
);
3373 new_flags
= vms_esecflag_by_name (evax_section_flags
, sname
,
3376 /* Modify them as directed. */
3377 if (section
->flags
& SEC_READONLY
)
3378 new_flags
&= ~EGPS__V_WRT
;
3380 new_flags
&= ~vms_section_data (section
)->no_flags
;
3381 new_flags
|= vms_section_data (section
)->flags
;
3383 vms_debug2 ((3, "sec flags %x\n", section
->flags
));
3384 vms_debug2 ((3, "new_flags %x, _raw_size %lu\n",
3385 new_flags
, (unsigned long)section
->size
));
3387 _bfd_vms_output_begin_subrec (recwr
, EGSD__C_PSC
);
3388 _bfd_vms_output_short (recwr
, section
->alignment_power
& 0xff);
3389 _bfd_vms_output_short (recwr
, new_flags
);
3390 _bfd_vms_output_long (recwr
, (unsigned long) section
->size
);
3391 _bfd_vms_output_counted (recwr
, sname
);
3392 _bfd_vms_output_end_subrec (recwr
);
3394 /* If the section is an obsolute one, remind its index as it will be
3395 used later for absolute symbols. */
3396 if ((new_flags
& EGPS__V_REL
) == 0 && abs_section_index
< 0)
3397 abs_section_index
= section
->target_index
;
3400 /* Output symbols. */
3401 vms_debug2 ((3, "%d symbols found\n", abfd
->symcount
));
3403 bfd_set_start_address (abfd
, (bfd_vma
) -1);
3405 for (symnum
= 0; symnum
< abfd
->symcount
; symnum
++)
3409 symbol
= abfd
->outsymbols
[symnum
];
3410 old_flags
= symbol
->flags
;
3412 /* Work-around a missing feature: consider __main as the main entry
3414 if (*(symbol
->name
) == '_')
3416 if (strcmp (symbol
->name
, "__main") == 0)
3417 bfd_set_start_address (abfd
, (bfd_vma
)symbol
->value
);
3420 /* Only put in the GSD the global and the undefined symbols. */
3421 if (old_flags
& BSF_FILE
)
3424 if ((old_flags
& BSF_GLOBAL
) == 0 && !bfd_is_und_section (symbol
->section
))
3426 /* If the LIB$INITIIALIZE section is present, add a reference to
3427 LIB$INITIALIZE symbol. FIXME: this should be done explicitely
3428 in the assembly file. */
3429 if (!((old_flags
& BSF_SECTION_SYM
) != 0
3430 && strcmp (symbol
->section
->name
, "LIB$INITIALIZE") == 0))
3434 /* 13 bytes egsd, max 64 chars name -> should be 77 bytes. Add 16 more
3435 bytes for a possible ABS section. */
3436 if (_bfd_vms_output_check (recwr
, 80 + 16) < 0)
3438 _bfd_vms_output_end (abfd
, recwr
);
3439 _bfd_vms_output_begin (recwr
, EOBJ__C_EGSD
);
3440 _bfd_vms_output_long (recwr
, 0);
3443 if ((old_flags
& BSF_GLOBAL
) != 0
3444 && bfd_is_abs_section (symbol
->section
)
3445 && abs_section_index
<= 0)
3447 /* Create an absolute section if none was defined. It is highly
3448 unlikely that the name $ABS$ clashes with a user defined
3449 non-absolute section name. */
3450 _bfd_vms_output_begin_subrec (recwr
, EGSD__C_PSC
);
3451 _bfd_vms_output_short (recwr
, 4);
3452 _bfd_vms_output_short (recwr
, EGPS__V_SHR
);
3453 _bfd_vms_output_long (recwr
, 0);
3454 _bfd_vms_output_counted (recwr
, "$ABS$");
3455 _bfd_vms_output_end_subrec (recwr
);
3457 abs_section_index
= target_index
++;
3460 _bfd_vms_output_begin_subrec (recwr
, EGSD__C_SYM
);
3462 /* Data type, alignment. */
3463 _bfd_vms_output_short (recwr
, 0);
3467 if (old_flags
& BSF_WEAK
)
3468 new_flags
|= EGSY__V_WEAK
;
3469 if (bfd_is_com_section (symbol
->section
)) /* .comm */
3470 new_flags
|= (EGSY__V_WEAK
| EGSY__V_COMM
);
3472 if (old_flags
& BSF_FUNCTION
)
3474 new_flags
|= EGSY__V_NORM
;
3475 new_flags
|= EGSY__V_REL
;
3477 if (old_flags
& BSF_GLOBAL
)
3479 new_flags
|= EGSY__V_DEF
;
3480 if (!bfd_is_abs_section (symbol
->section
))
3481 new_flags
|= EGSY__V_REL
;
3483 _bfd_vms_output_short (recwr
, new_flags
);
3485 if (old_flags
& BSF_GLOBAL
)
3487 /* Symbol definition. */
3488 bfd_vma code_address
= 0;
3489 unsigned long ca_psindx
= 0;
3490 unsigned long psindx
;
3492 if ((old_flags
& BSF_FUNCTION
) && symbol
->udata
.p
!= NULL
)
3497 ((struct evax_private_udata_struct
*)symbol
->udata
.p
)->enbsym
;
3498 code_address
= sym
->value
;
3499 ca_psindx
= sym
->section
->target_index
;
3501 if (bfd_is_abs_section (symbol
->section
))
3502 psindx
= abs_section_index
;
3504 psindx
= symbol
->section
->target_index
;
3506 _bfd_vms_output_quad (recwr
, symbol
->value
);
3507 _bfd_vms_output_quad (recwr
, code_address
);
3508 _bfd_vms_output_long (recwr
, ca_psindx
);
3509 _bfd_vms_output_long (recwr
, psindx
);
3511 hash
= _bfd_vms_length_hash_symbol (abfd
, symbol
->name
, EOBJ__C_SYMSIZ
);
3512 _bfd_vms_output_counted (recwr
, hash
);
3514 _bfd_vms_output_end_subrec (recwr
);
3517 _bfd_vms_output_alignment (recwr
, 8);
3518 _bfd_vms_output_end (abfd
, recwr
);
3523 /* Write object header for bfd abfd. Return FALSE on error. */
3526 _bfd_vms_write_ehdr (bfd
*abfd
)
3529 unsigned int symnum
;
3532 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
3534 vms_debug2 ((2, "vms_write_ehdr (%p)\n", abfd
));
3536 _bfd_vms_output_alignment (recwr
, 2);
3538 _bfd_vms_write_emh (abfd
);
3539 _bfd_vms_write_lmn (abfd
, "GNU AS");
3542 _bfd_vms_output_begin (recwr
, EOBJ__C_EMH
);
3543 _bfd_vms_output_short (recwr
, EMH__C_SRC
);
3545 for (symnum
= 0; symnum
< abfd
->symcount
; symnum
++)
3547 symbol
= abfd
->outsymbols
[symnum
];
3549 if (symbol
->flags
& BSF_FILE
)
3551 if (CONST_STRNEQ ((char *)symbol
->name
, "<CASE:"))
3553 PRIV (flag_hash_long_names
) = symbol
->name
[6] - '0';
3554 PRIV (flag_show_after_trunc
) = symbol
->name
[7] - '0';
3562 _bfd_vms_output_dump (recwr
, (unsigned char *) symbol
->name
,
3563 (int) strlen (symbol
->name
));
3570 if (symnum
== abfd
->symcount
)
3571 _bfd_vms_output_dump (recwr
, (unsigned char *) STRING_COMMA_LEN ("noname"));
3573 _bfd_vms_output_end (abfd
, recwr
);
3576 _bfd_vms_output_begin (recwr
, EOBJ__C_EMH
);
3577 _bfd_vms_output_short (recwr
, EMH__C_TTL
);
3578 _bfd_vms_output_dump (recwr
, (unsigned char *) STRING_COMMA_LEN ("TTL"));
3579 _bfd_vms_output_end (abfd
, recwr
);
3582 _bfd_vms_output_begin (recwr
, EOBJ__C_EMH
);
3583 _bfd_vms_output_short (recwr
, EMH__C_CPR
);
3584 _bfd_vms_output_dump (recwr
,
3585 (unsigned char *)"GNU BFD ported by Klaus Kämpf 1994-1996",
3587 _bfd_vms_output_end (abfd
, recwr
);
3592 /* Part 4.6, relocations. */
3595 /* WRITE ETIR SECTION
3597 This is still under construction and therefore not documented. */
3599 /* Close the etir/etbt record. */
3602 end_etir_record (bfd
* abfd
)
3604 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
3606 _bfd_vms_output_end (abfd
, recwr
);
3610 start_etir_or_etbt_record (bfd
*abfd
, asection
*section
, bfd_vma offset
)
3612 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
3614 if (section
->flags
& SEC_DEBUGGING
)
3616 _bfd_vms_output_begin (recwr
, EOBJ__C_ETBT
);
3620 /* Push start offset. */
3621 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_LW
);
3622 _bfd_vms_output_long (recwr
, (unsigned long) 0);
3623 _bfd_vms_output_end_subrec (recwr
);
3626 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_CTL_DFLOC
);
3627 _bfd_vms_output_end_subrec (recwr
);
3632 _bfd_vms_output_begin (recwr
, EOBJ__C_ETIR
);
3636 /* Push start offset. */
3637 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_PQ
);
3638 _bfd_vms_output_long (recwr
, (unsigned long) section
->target_index
);
3639 _bfd_vms_output_quad (recwr
, offset
);
3640 _bfd_vms_output_end_subrec (recwr
);
3642 /* Start = pop (). */
3643 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_CTL_SETRB
);
3644 _bfd_vms_output_end_subrec (recwr
);
3649 /* Output a STO_IMM command for SSIZE bytes of data from CPR at virtual
3650 address VADDR in section specified by SEC_INDEX and NAME. */
3653 sto_imm (bfd
*abfd
, asection
*section
,
3654 bfd_size_type ssize
, unsigned char *cptr
, bfd_vma vaddr
)
3657 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
3660 _bfd_vms_debug (8, "sto_imm %d bytes\n", (int) ssize
);
3661 _bfd_hexdump (9, cptr
, (int) ssize
, (int) vaddr
);
3666 /* Try all the rest. */
3669 if (_bfd_vms_output_check (recwr
, size
) < 0)
3671 /* Doesn't fit, split ! */
3672 end_etir_record (abfd
);
3674 start_etir_or_etbt_record (abfd
, section
, vaddr
);
3676 size
= _bfd_vms_output_check (recwr
, 0); /* get max size */
3677 if (size
> ssize
) /* more than what's left ? */
3681 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_IMM
);
3682 _bfd_vms_output_long (recwr
, (unsigned long) (size
));
3683 _bfd_vms_output_dump (recwr
, cptr
, size
);
3684 _bfd_vms_output_end_subrec (recwr
);
3687 _bfd_vms_debug (10, "dumped %d bytes\n", (int) size
);
3688 _bfd_hexdump (10, cptr
, (int) size
, (int) vaddr
);
3698 etir_output_check (bfd
*abfd
, asection
*section
, bfd_vma vaddr
, int checklen
)
3700 if (_bfd_vms_output_check (&PRIV (recwr
), checklen
) < 0)
3702 /* Not enough room in this record. Close it and open a new one. */
3703 end_etir_record (abfd
);
3704 start_etir_or_etbt_record (abfd
, section
, vaddr
);
3708 /* Return whether RELOC must be deferred till the end. */
3711 defer_reloc_p (arelent
*reloc
)
3713 switch (reloc
->howto
->type
)
3726 /* Write section contents for bfd abfd. Return FALSE on error. */
3729 _bfd_vms_write_etir (bfd
* abfd
, int objtype ATTRIBUTE_UNUSED
)
3732 struct vms_rec_wr
*recwr
= &PRIV (recwr
);
3734 vms_debug2 ((2, "vms_write_tir (%p, %d)\n", abfd
, objtype
));
3736 _bfd_vms_output_alignment (recwr
, 4);
3738 PRIV (vms_linkage_index
) = 0;
3740 for (section
= abfd
->sections
; section
; section
= section
->next
)
3742 vms_debug2 ((4, "writing %d. section '%s' (%d bytes)\n",
3743 section
->target_index
, section
->name
, (int) (section
->size
)));
3745 if (!(section
->flags
& SEC_HAS_CONTENTS
)
3746 || bfd_is_com_section (section
))
3749 if (!section
->contents
)
3751 bfd_set_error (bfd_error_no_contents
);
3755 start_etir_or_etbt_record (abfd
, section
, 0);
3757 if (section
->flags
& SEC_RELOC
)
3759 bfd_vma curr_addr
= 0;
3760 unsigned char *curr_data
= section
->contents
;
3762 int pass2_needed
= 0;
3763 int pass2_in_progress
= 0;
3766 if (section
->reloc_count
== 0)
3767 (*_bfd_error_handler
)
3768 (_("SEC_RELOC with no relocs in section %s"), section
->name
);
3773 int i
= section
->reloc_count
;
3774 arelent
**rptr
= section
->orelocation
;
3775 _bfd_vms_debug (4, "%d relocations:\n", i
);
3778 _bfd_vms_debug (4, "sym %s in sec %s, value %08lx, "
3779 "addr %08lx, off %08lx, len %d: %s\n",
3780 (*(*rptr
)->sym_ptr_ptr
)->name
,
3781 (*(*rptr
)->sym_ptr_ptr
)->section
->name
,
3782 (long) (*(*rptr
)->sym_ptr_ptr
)->value
,
3783 (unsigned long)(*rptr
)->address
,
3784 (unsigned long)(*rptr
)->addend
,
3785 bfd_get_reloc_size ((*rptr
)->howto
),
3786 ( *rptr
)->howto
->name
);
3793 for (irel
= 0; irel
< section
->reloc_count
; irel
++)
3795 struct evax_private_udata_struct
*udata
;
3796 arelent
*rptr
= section
->orelocation
[irel
];
3797 bfd_vma addr
= rptr
->address
;
3798 asymbol
*sym
= *rptr
->sym_ptr_ptr
;
3799 asection
*sec
= sym
->section
;
3800 bfd_boolean defer
= defer_reloc_p (rptr
);
3804 if (pass2_in_progress
)
3806 /* Non-deferred relocs have already been output. */
3812 /* Deferred relocs must be output at the very end. */
3819 /* Regular relocs are intertwined with binary data. */
3820 if (curr_addr
> addr
)
3821 (*_bfd_error_handler
) (_("Size error in section %s"),
3823 size
= addr
- curr_addr
;
3824 sto_imm (abfd
, section
, size
, curr_data
, curr_addr
);
3829 size
= bfd_get_reloc_size (rptr
->howto
);
3831 switch (rptr
->howto
->type
)
3833 case ALPHA_R_IGNORE
:
3836 case ALPHA_R_REFLONG
:
3837 if (bfd_is_und_section (sym
->section
))
3839 bfd_vma addend
= rptr
->addend
;
3840 slen
= strlen ((char *) sym
->name
);
3841 hash
= _bfd_vms_length_hash_symbol
3842 (abfd
, sym
->name
, EOBJ__C_SYMSIZ
);
3843 etir_output_check (abfd
, section
, curr_addr
, slen
);
3846 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_GBL
);
3847 _bfd_vms_output_counted (recwr
, hash
);
3848 _bfd_vms_output_end_subrec (recwr
);
3849 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_LW
);
3850 _bfd_vms_output_long (recwr
, (unsigned long) addend
);
3851 _bfd_vms_output_end_subrec (recwr
);
3852 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_OPR_ADD
);
3853 _bfd_vms_output_end_subrec (recwr
);
3854 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_LW
);
3855 _bfd_vms_output_end_subrec (recwr
);
3859 _bfd_vms_output_begin_subrec
3860 (recwr
, ETIR__C_STO_GBL_LW
);
3861 _bfd_vms_output_counted (recwr
, hash
);
3862 _bfd_vms_output_end_subrec (recwr
);
3865 else if (bfd_is_abs_section (sym
->section
))
3867 etir_output_check (abfd
, section
, curr_addr
, 16);
3868 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_LW
);
3869 _bfd_vms_output_long (recwr
, (unsigned long) sym
->value
);
3870 _bfd_vms_output_end_subrec (recwr
);
3871 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_LW
);
3872 _bfd_vms_output_end_subrec (recwr
);
3876 etir_output_check (abfd
, section
, curr_addr
, 32);
3877 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_PQ
);
3878 _bfd_vms_output_long (recwr
,
3879 (unsigned long) sec
->target_index
);
3880 _bfd_vms_output_quad (recwr
, rptr
->addend
+ sym
->value
);
3881 _bfd_vms_output_end_subrec (recwr
);
3882 /* ??? Table B-8 of the OpenVMS Linker Utilily Manual
3883 says that we should have a ETIR__C_STO_OFF here.
3884 But the relocation would not be BFD_RELOC_32 then.
3885 This case is very likely unreachable. */
3886 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_LW
);
3887 _bfd_vms_output_end_subrec (recwr
);
3891 case ALPHA_R_REFQUAD
:
3892 if (bfd_is_und_section (sym
->section
))
3894 bfd_vma addend
= rptr
->addend
;
3895 slen
= strlen ((char *) sym
->name
);
3896 hash
= _bfd_vms_length_hash_symbol
3897 (abfd
, sym
->name
, EOBJ__C_SYMSIZ
);
3898 etir_output_check (abfd
, section
, curr_addr
, slen
);
3901 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_GBL
);
3902 _bfd_vms_output_counted (recwr
, hash
);
3903 _bfd_vms_output_end_subrec (recwr
);
3904 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_QW
);
3905 _bfd_vms_output_quad (recwr
, addend
);
3906 _bfd_vms_output_end_subrec (recwr
);
3907 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_OPR_ADD
);
3908 _bfd_vms_output_end_subrec (recwr
);
3909 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_QW
);
3910 _bfd_vms_output_end_subrec (recwr
);
3914 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_GBL
);
3915 _bfd_vms_output_counted (recwr
, hash
);
3916 _bfd_vms_output_end_subrec (recwr
);
3919 else if (bfd_is_abs_section (sym
->section
))
3921 etir_output_check (abfd
, section
, curr_addr
, 16);
3922 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_QW
);
3923 _bfd_vms_output_quad (recwr
, sym
->value
);
3924 _bfd_vms_output_end_subrec (recwr
);
3925 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_QW
);
3926 _bfd_vms_output_end_subrec (recwr
);
3930 etir_output_check (abfd
, section
, curr_addr
, 32);
3931 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STA_PQ
);
3932 _bfd_vms_output_long (recwr
,
3933 (unsigned long) sec
->target_index
);
3934 _bfd_vms_output_quad (recwr
, rptr
->addend
+ sym
->value
);
3935 _bfd_vms_output_end_subrec (recwr
);
3936 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_OFF
);
3937 _bfd_vms_output_end_subrec (recwr
);
3942 sto_imm (abfd
, section
, size
, curr_data
, curr_addr
);
3945 case ALPHA_R_LINKAGE
:
3946 etir_output_check (abfd
, section
, curr_addr
, 64);
3947 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STC_LP_PSB
);
3948 _bfd_vms_output_long
3949 (recwr
, (unsigned long) rptr
->addend
);
3950 if (rptr
->addend
> PRIV (vms_linkage_index
))
3951 PRIV (vms_linkage_index
) = rptr
->addend
;
3952 hash
= _bfd_vms_length_hash_symbol
3953 (abfd
, sym
->name
, EOBJ__C_SYMSIZ
);
3954 _bfd_vms_output_counted (recwr
, hash
);
3955 _bfd_vms_output_byte (recwr
, 0);
3956 _bfd_vms_output_end_subrec (recwr
);
3959 case ALPHA_R_CODEADDR
:
3960 slen
= strlen ((char *) sym
->name
);
3961 hash
= _bfd_vms_length_hash_symbol
3962 (abfd
, sym
->name
, EOBJ__C_SYMSIZ
);
3963 etir_output_check (abfd
, section
, curr_addr
, slen
);
3964 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STO_CA
);
3965 _bfd_vms_output_counted (recwr
, hash
);
3966 _bfd_vms_output_end_subrec (recwr
);
3971 = (struct evax_private_udata_struct
*) rptr
->sym_ptr_ptr
;
3972 etir_output_check (abfd
, section
, curr_addr
,
3973 32 + 1 + strlen (udata
->origname
));
3974 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STC_NOP_GBL
);
3975 _bfd_vms_output_long (recwr
, (unsigned long) udata
->lkindex
);
3976 _bfd_vms_output_long
3977 (recwr
, (unsigned long) section
->target_index
);
3978 _bfd_vms_output_quad (recwr
, rptr
->address
);
3979 _bfd_vms_output_long (recwr
, (unsigned long) 0x47ff041f);
3980 _bfd_vms_output_long
3981 (recwr
, (unsigned long) section
->target_index
);
3982 _bfd_vms_output_quad (recwr
, rptr
->addend
);
3983 _bfd_vms_output_counted
3984 (recwr
, _bfd_vms_length_hash_symbol
3985 (abfd
, udata
->origname
, EOBJ__C_SYMSIZ
));
3986 _bfd_vms_output_end_subrec (recwr
);
3990 (*_bfd_error_handler
) (_("Spurious ALPHA_R_BSR reloc"));
3995 = (struct evax_private_udata_struct
*) rptr
->sym_ptr_ptr
;
3996 etir_output_check (abfd
, section
, curr_addr
,
3997 32 + 1 + strlen (udata
->origname
));
3998 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STC_LDA_GBL
);
3999 _bfd_vms_output_long
4000 (recwr
, (unsigned long) udata
->lkindex
+ 1);
4001 _bfd_vms_output_long
4002 (recwr
, (unsigned long) section
->target_index
);
4003 _bfd_vms_output_quad (recwr
, rptr
->address
);
4004 _bfd_vms_output_long (recwr
, (unsigned long) 0x237B0000);
4005 _bfd_vms_output_long
4006 (recwr
, (unsigned long) udata
->bsym
->section
->target_index
);
4007 _bfd_vms_output_quad (recwr
, rptr
->addend
);
4008 _bfd_vms_output_counted
4009 (recwr
, _bfd_vms_length_hash_symbol
4010 (abfd
, udata
->origname
, EOBJ__C_SYMSIZ
));
4011 _bfd_vms_output_end_subrec (recwr
);
4016 = (struct evax_private_udata_struct
*) rptr
->sym_ptr_ptr
;
4017 etir_output_check (abfd
, section
, curr_addr
,
4018 32 + 1 + strlen (udata
->origname
));
4019 _bfd_vms_output_begin_subrec (recwr
, ETIR__C_STC_BOH_GBL
);
4020 _bfd_vms_output_long (recwr
, (unsigned long) udata
->lkindex
);
4021 _bfd_vms_output_long
4022 (recwr
, (unsigned long) section
->target_index
);
4023 _bfd_vms_output_quad (recwr
, rptr
->address
);
4024 _bfd_vms_output_long (recwr
, (unsigned long) 0xD3400000);
4025 _bfd_vms_output_long
4026 (recwr
, (unsigned long) section
->target_index
);
4027 _bfd_vms_output_quad (recwr
, rptr
->addend
);
4028 _bfd_vms_output_counted
4029 (recwr
, _bfd_vms_length_hash_symbol
4030 (abfd
, udata
->origname
, EOBJ__C_SYMSIZ
));
4031 _bfd_vms_output_end_subrec (recwr
);
4035 (*_bfd_error_handler
) (_("Unhandled relocation %s"),
4042 } /* End of relocs loop. */
4044 if (!pass2_in_progress
)
4046 /* Output rest of section. */
4047 if (curr_addr
> section
->size
)
4048 (*_bfd_error_handler
) (_("Size error in section %s"),
4050 size
= section
->size
- curr_addr
;
4051 sto_imm (abfd
, section
, size
, curr_data
, curr_addr
);
4057 pass2_in_progress
= 1;
4063 else /* (section->flags & SEC_RELOC) */
4064 sto_imm (abfd
, section
, section
->size
, section
->contents
, 0);
4066 end_etir_record (abfd
);
4069 _bfd_vms_output_alignment (recwr
, 2);
4073 /* Write cached information into a file being written, at bfd_close. */
4076 alpha_vms_write_object_contents (bfd
*abfd
)
4078 vms_debug2 ((1, "vms_write_object_contents (%p)\n", abfd
));
4080 if (abfd
->flags
& (EXEC_P
| DYNAMIC
))
4082 return alpha_vms_write_exec (abfd
);
4086 if (abfd
->section_count
> 0) /* we have sections */
4088 if (_bfd_vms_write_ehdr (abfd
) != TRUE
)
4090 if (_bfd_vms_write_egsd (abfd
) != TRUE
)
4092 if (_bfd_vms_write_etir (abfd
, EOBJ__C_ETIR
) != TRUE
)
4094 if (_bfd_vms_write_eeom (abfd
) != TRUE
)
4101 /* Debug stuff: nearest line. */
4103 #define SET_MODULE_PARSED(m) \
4104 do { if ((m)->name == NULL) (m)->name = ""; } while (0)
4105 #define IS_MODULE_PARSED(m) ((m)->name != NULL)
4107 /* Build a new module for the specified BFD. */
4109 static struct module
*
4110 new_module (bfd
*abfd
)
4112 struct module
*module
4113 = (struct module
*) bfd_zalloc (abfd
, sizeof (struct module
));
4114 module
->file_table_count
= 16; /* Arbitrary. */
4116 = bfd_malloc (module
->file_table_count
* sizeof (struct fileinfo
));
4120 /* Parse debug info for a module and internalize it. */
4123 parse_module (bfd
*abfd
, struct module
*module
, unsigned char *ptr
,
4126 unsigned char *maxptr
= ptr
+ length
;
4127 unsigned char *src_ptr
, *pcl_ptr
;
4128 unsigned int prev_linum
= 0, curr_linenum
= 0;
4129 bfd_vma prev_pc
= 0, curr_pc
= 0;
4130 struct srecinfo
*curr_srec
, *srec
;
4131 struct lineinfo
*curr_line
, *line
;
4132 struct funcinfo
*funcinfo
;
4134 /* Initialize tables with zero element. */
4135 curr_srec
= (struct srecinfo
*) bfd_zalloc (abfd
, sizeof (struct srecinfo
));
4136 module
->srec_table
= curr_srec
;
4138 curr_line
= (struct lineinfo
*) bfd_zalloc (abfd
, sizeof (struct lineinfo
));
4139 module
->line_table
= curr_line
;
4141 while (length
== -1 || ptr
< maxptr
)
4143 /* The first byte is not counted in the recorded length. */
4144 int rec_length
= bfd_getl16 (ptr
) + 1;
4145 int rec_type
= bfd_getl16 (ptr
+ 2);
4147 vms_debug2 ((2, "DST record: leng %d, type %d\n", rec_length
, rec_type
));
4149 if (length
== -1 && rec_type
== DST__K_MODEND
)
4156 = _bfd_vms_save_counted_string (ptr
+ DST_S_B_MODBEG_NAME
);
4163 vms_debug2 ((3, "module: %s\n", module
->name
));
4170 funcinfo
= (struct funcinfo
*)
4171 bfd_zalloc (abfd
, sizeof (struct funcinfo
));
4173 = _bfd_vms_save_counted_string (ptr
+ DST_S_B_RTNBEG_NAME
);
4174 funcinfo
->low
= bfd_getl32 (ptr
+ DST_S_L_RTNBEG_ADDRESS
);
4175 funcinfo
->next
= module
->func_table
;
4176 module
->func_table
= funcinfo
;
4178 vms_debug2 ((3, "routine: %s at 0x%lx\n",
4179 funcinfo
->name
, (unsigned long) funcinfo
->low
));
4183 module
->func_table
->high
= module
->func_table
->low
4184 + bfd_getl32 (ptr
+ DST_S_L_RTNEND_SIZE
) - 1;
4186 if (module
->func_table
->high
> module
->high
)
4187 module
->high
= module
->func_table
->high
;
4189 vms_debug2 ((3, "end routine\n"));
4193 vms_debug2 ((3, "prologue\n"));
4197 vms_debug2 ((3, "epilog\n"));
4201 vms_debug2 ((3, "block\n"));
4205 vms_debug2 ((3, "end block\n"));
4209 src_ptr
= ptr
+ DST_S_C_SOURCE_HEADER_SIZE
;
4211 vms_debug2 ((3, "source info\n"));
4213 while (src_ptr
< ptr
+ rec_length
)
4215 int cmd
= src_ptr
[0], cmd_length
, data
;
4219 case DST__K_SRC_DECLFILE
:
4222 = bfd_getl16 (src_ptr
+ DST_S_W_SRC_DF_FILEID
);
4224 = _bfd_vms_save_counted_string (src_ptr
4225 + DST_S_B_SRC_DF_FILENAME
);
4227 while (fileid
>= module
->file_table_count
)
4229 module
->file_table_count
*= 2;
4231 = bfd_realloc (module
->file_table
,
4232 module
->file_table_count
4233 * sizeof (struct fileinfo
));
4236 module
->file_table
[fileid
].name
= filename
;
4237 module
->file_table
[fileid
].srec
= 1;
4238 cmd_length
= src_ptr
[DST_S_B_SRC_DF_LENGTH
] + 2;
4239 vms_debug2 ((4, "DST_S_C_SRC_DECLFILE: %d, %s\n",
4240 fileid
, module
->file_table
[fileid
].name
));
4244 case DST__K_SRC_DEFLINES_B
:
4245 /* Perform the association and set the next higher index
4247 data
= src_ptr
[DST_S_B_SRC_UNSBYTE
];
4248 srec
= (struct srecinfo
*)
4249 bfd_zalloc (abfd
, sizeof (struct srecinfo
));
4250 srec
->line
= curr_srec
->line
+ data
;
4251 srec
->srec
= curr_srec
->srec
+ data
;
4252 srec
->sfile
= curr_srec
->sfile
;
4253 curr_srec
->next
= srec
;
4256 vms_debug2 ((4, "DST_S_C_SRC_DEFLINES_B: %d\n", data
));
4259 case DST__K_SRC_DEFLINES_W
:
4260 /* Perform the association and set the next higher index
4262 data
= bfd_getl16 (src_ptr
+ DST_S_W_SRC_UNSWORD
);
4263 srec
= (struct srecinfo
*)
4264 bfd_zalloc (abfd
, sizeof (struct srecinfo
));
4265 srec
->line
= curr_srec
->line
+ data
;
4266 srec
->srec
= curr_srec
->srec
+ data
,
4267 srec
->sfile
= curr_srec
->sfile
;
4268 curr_srec
->next
= srec
;
4271 vms_debug2 ((4, "DST_S_C_SRC_DEFLINES_W: %d\n", data
));
4274 case DST__K_SRC_INCRLNUM_B
:
4275 data
= src_ptr
[DST_S_B_SRC_UNSBYTE
];
4276 curr_srec
->line
+= data
;
4278 vms_debug2 ((4, "DST_S_C_SRC_INCRLNUM_B: %d\n", data
));
4281 case DST__K_SRC_SETFILE
:
4282 data
= bfd_getl16 (src_ptr
+ DST_S_W_SRC_UNSWORD
);
4283 curr_srec
->sfile
= data
;
4284 curr_srec
->srec
= module
->file_table
[data
].srec
;
4286 vms_debug2 ((4, "DST_S_C_SRC_SETFILE: %d\n", data
));
4289 case DST__K_SRC_SETLNUM_L
:
4290 data
= bfd_getl32 (src_ptr
+ DST_S_L_SRC_UNSLONG
);
4291 curr_srec
->line
= data
;
4293 vms_debug2 ((4, "DST_S_C_SRC_SETLNUM_L: %d\n", data
));
4296 case DST__K_SRC_SETLNUM_W
:
4297 data
= bfd_getl16 (src_ptr
+ DST_S_W_SRC_UNSWORD
);
4298 curr_srec
->line
= data
;
4300 vms_debug2 ((4, "DST_S_C_SRC_SETLNUM_W: %d\n", data
));
4303 case DST__K_SRC_SETREC_L
:
4304 data
= bfd_getl32 (src_ptr
+ DST_S_L_SRC_UNSLONG
);
4305 curr_srec
->srec
= data
;
4306 module
->file_table
[curr_srec
->sfile
].srec
= data
;
4308 vms_debug2 ((4, "DST_S_C_SRC_SETREC_L: %d\n", data
));
4311 case DST__K_SRC_SETREC_W
:
4312 data
= bfd_getl16 (src_ptr
+ DST_S_W_SRC_UNSWORD
);
4313 curr_srec
->srec
= data
;
4314 module
->file_table
[curr_srec
->sfile
].srec
= data
;
4316 vms_debug2 ((4, "DST_S_C_SRC_SETREC_W: %d\n", data
));
4319 case DST__K_SRC_FORMFEED
:
4321 vms_debug2 ((4, "DST_S_C_SRC_FORMFEED\n"));
4325 (*_bfd_error_handler
) (_("unknown source command %d"),
4331 src_ptr
+= cmd_length
;
4335 case DST__K_LINE_NUM
:
4336 pcl_ptr
= ptr
+ DST_S_C_LINE_NUM_HEADER_SIZE
;
4338 vms_debug2 ((3, "line info\n"));
4340 while (pcl_ptr
< ptr
+ rec_length
)
4342 /* The command byte is signed so we must sign-extend it. */
4343 int cmd
= ((signed char *)pcl_ptr
)[0], cmd_length
, data
;
4347 case DST__K_DELTA_PC_W
:
4348 data
= bfd_getl16 (pcl_ptr
+ DST_S_W_PCLINE_UNSWORD
);
4352 vms_debug2 ((4, "DST__K_DELTA_PC_W: %d\n", data
));
4355 case DST__K_DELTA_PC_L
:
4356 data
= bfd_getl32 (pcl_ptr
+ DST_S_L_PCLINE_UNSLONG
);
4360 vms_debug2 ((4, "DST__K_DELTA_PC_L: %d\n", data
));
4363 case DST__K_INCR_LINUM
:
4364 data
= pcl_ptr
[DST_S_B_PCLINE_UNSBYTE
];
4365 curr_linenum
+= data
;
4367 vms_debug2 ((4, "DST__K_INCR_LINUM: %d\n", data
));
4370 case DST__K_INCR_LINUM_W
:
4371 data
= bfd_getl16 (pcl_ptr
+ DST_S_W_PCLINE_UNSWORD
);
4372 curr_linenum
+= data
;
4374 vms_debug2 ((4, "DST__K_INCR_LINUM_W: %d\n", data
));
4377 case DST__K_INCR_LINUM_L
:
4378 data
= bfd_getl32 (pcl_ptr
+ DST_S_L_PCLINE_UNSLONG
);
4379 curr_linenum
+= data
;
4381 vms_debug2 ((4, "DST__K_INCR_LINUM_L: %d\n", data
));
4384 case DST__K_SET_LINUM_INCR
:
4385 (*_bfd_error_handler
)
4386 (_("DST__K_SET_LINUM_INCR not implemented"));
4390 case DST__K_SET_LINUM_INCR_W
:
4391 (*_bfd_error_handler
)
4392 (_("DST__K_SET_LINUM_INCR_W not implemented"));
4396 case DST__K_RESET_LINUM_INCR
:
4397 (*_bfd_error_handler
)
4398 (_("DST__K_RESET_LINUM_INCR not implemented"));
4402 case DST__K_BEG_STMT_MODE
:
4403 (*_bfd_error_handler
)
4404 (_("DST__K_BEG_STMT_MODE not implemented"));
4408 case DST__K_END_STMT_MODE
:
4409 (*_bfd_error_handler
)
4410 (_("DST__K_END_STMT_MODE not implemented"));
4414 case DST__K_SET_LINUM_B
:
4415 data
= pcl_ptr
[DST_S_B_PCLINE_UNSBYTE
];
4416 curr_linenum
= data
;
4418 vms_debug2 ((4, "DST__K_SET_LINUM_B: %d\n", data
));
4421 case DST__K_SET_LINUM
:
4422 data
= bfd_getl16 (pcl_ptr
+ DST_S_W_PCLINE_UNSWORD
);
4423 curr_linenum
= data
;
4425 vms_debug2 ((4, "DST__K_SET_LINE_NUM: %d\n", data
));
4428 case DST__K_SET_LINUM_L
:
4429 data
= bfd_getl32 (pcl_ptr
+ DST_S_L_PCLINE_UNSLONG
);
4430 curr_linenum
= data
;
4432 vms_debug2 ((4, "DST__K_SET_LINUM_L: %d\n", data
));
4436 (*_bfd_error_handler
)
4437 (_("DST__K_SET_PC not implemented"));
4441 case DST__K_SET_PC_W
:
4442 (*_bfd_error_handler
)
4443 (_("DST__K_SET_PC_W not implemented"));
4447 case DST__K_SET_PC_L
:
4448 (*_bfd_error_handler
)
4449 (_("DST__K_SET_PC_L not implemented"));
4453 case DST__K_SET_STMTNUM
:
4454 (*_bfd_error_handler
)
4455 (_("DST__K_SET_STMTNUM not implemented"));
4460 data
= pcl_ptr
[DST_S_B_PCLINE_UNSBYTE
];
4463 vms_debug2 ((4, "DST__K_TERM: %d\n", data
));
4467 data
= bfd_getl16 (pcl_ptr
+ DST_S_W_PCLINE_UNSWORD
);
4470 vms_debug2 ((4, "DST__K_TERM_W: %d\n", data
));
4474 data
= bfd_getl32 (pcl_ptr
+ DST_S_L_PCLINE_UNSLONG
);
4477 vms_debug2 ((4, "DST__K_TERM_L: %d\n", data
));
4480 case DST__K_SET_ABS_PC
:
4481 data
= bfd_getl32 (pcl_ptr
+ DST_S_L_PCLINE_UNSLONG
);
4484 vms_debug2 ((4, "DST__K_SET_ABS_PC: 0x%x\n", data
));
4493 vms_debug2 ((4, "bump pc to 0x%lx and line to %d\n",
4494 (unsigned long)curr_pc
, curr_linenum
));
4498 (*_bfd_error_handler
) (_("unknown line command %d"),
4505 if ((curr_linenum
!= prev_linum
&& curr_pc
!= prev_pc
)
4507 || cmd
== DST__K_DELTA_PC_L
4508 || cmd
== DST__K_DELTA_PC_W
)
4510 line
= (struct lineinfo
*)
4511 bfd_zalloc (abfd
, sizeof (struct lineinfo
));
4512 line
->address
= curr_pc
;
4513 line
->line
= curr_linenum
;
4515 curr_line
->next
= line
;
4518 prev_linum
= curr_linenum
;
4520 vms_debug2 ((4, "-> correlate pc 0x%lx with line %d\n",
4521 (unsigned long)curr_pc
, curr_linenum
));
4524 pcl_ptr
+= cmd_length
;
4528 case 0x17: /* Undocumented type used by DEC C to declare equates. */
4529 vms_debug2 ((3, "undocumented type 0x17\n"));
4533 vms_debug2 ((3, "ignoring record\n"));
4541 /* Finalize tables with EOL marker. */
4542 srec
= (struct srecinfo
*) bfd_zalloc (abfd
, sizeof (struct srecinfo
));
4543 srec
->line
= (unsigned int) -1;
4544 srec
->srec
= (unsigned int) -1;
4545 curr_srec
->next
= srec
;
4547 line
= (struct lineinfo
*) bfd_zalloc (abfd
, sizeof (struct lineinfo
));
4548 line
->line
= (unsigned int) -1;
4549 line
->address
= (bfd_vma
) -1;
4550 curr_line
->next
= line
;
4552 /* Advertise that this module has been parsed. This is needed
4553 because parsing can be either performed at module creation
4554 or deferred until debug info is consumed. */
4555 SET_MODULE_PARSED (module
);
4558 /* Build the list of modules for the specified BFD. */
4560 static struct module
*
4561 build_module_list (bfd
*abfd
)
4563 struct module
*module
, *list
= NULL
;
4566 if ((dmt
= bfd_get_section_by_name (abfd
, "$DMT$")))
4568 /* We have a DMT section so this must be an image. Parse the
4569 section and build the list of modules. This is sufficient
4570 since we can compute the start address and the end address
4571 of every module from the section contents. */
4572 bfd_size_type size
= bfd_get_section_size (dmt
);
4573 unsigned char *ptr
, *end
;
4575 ptr
= (unsigned char *) bfd_alloc (abfd
, size
);
4579 if (! bfd_get_section_contents (abfd
, dmt
, ptr
, 0, size
))
4582 vms_debug2 ((2, "DMT\n"));
4588 /* Each header declares a module with its start offset and size
4589 of debug info in the DST section, as well as the count of
4590 program sections (i.e. address spans) it contains. */
4591 int modbeg
= bfd_getl32 (ptr
+ DBG_S_L_DMT_MODBEG
);
4592 int msize
= bfd_getl32 (ptr
+ DBG_S_L_DST_SIZE
);
4593 int count
= bfd_getl16 (ptr
+ DBG_S_W_DMT_PSECT_COUNT
);
4594 ptr
+= DBG_S_C_DMT_HEADER_SIZE
;
4596 vms_debug2 ((3, "module: modbeg = %d, size = %d, count = %d\n",
4597 modbeg
, msize
, count
));
4599 /* We create a 'module' structure for each program section since
4600 we only support contiguous addresses in a 'module' structure.
4601 As a consequence, the actual debug info in the DST section is
4602 shared and can be parsed multiple times; that doesn't seem to
4603 cause problems in practice. */
4606 int start
= bfd_getl32 (ptr
+ DBG_S_L_DMT_PSECT_START
);
4607 int length
= bfd_getl32 (ptr
+ DBG_S_L_DMT_PSECT_LENGTH
);
4608 module
= new_module (abfd
);
4609 module
->modbeg
= modbeg
;
4610 module
->size
= msize
;
4611 module
->low
= start
;
4612 module
->high
= start
+ length
;
4613 module
->next
= list
;
4615 ptr
+= DBG_S_C_DMT_PSECT_SIZE
;
4617 vms_debug2 ((4, "section: start = 0x%x, length = %d\n",
4624 /* We don't have a DMT section so this must be an object. Parse
4625 the module right now in order to compute its start address and
4627 void *dst
= PRIV (dst_section
)->contents
;
4632 module
= new_module (abfd
);
4633 parse_module (abfd
, module
, PRIV (dst_section
)->contents
, -1);
4640 /* Calculate and return the name of the source file and the line nearest
4641 to the wanted location in the specified module. */
4644 module_find_nearest_line (bfd
*abfd
, struct module
*module
, bfd_vma addr
,
4645 const char **file
, const char **func
,
4648 struct funcinfo
*funcinfo
;
4649 struct lineinfo
*lineinfo
;
4650 struct srecinfo
*srecinfo
;
4651 bfd_boolean ret
= FALSE
;
4653 /* Parse this module if that was not done at module creation. */
4654 if (! IS_MODULE_PARSED (module
))
4656 unsigned int size
= module
->size
;
4657 unsigned int modbeg
= PRIV (dst_section
)->filepos
+ module
->modbeg
;
4658 unsigned char *buffer
= (unsigned char *) bfd_malloc (module
->size
);
4660 if (bfd_seek (abfd
, modbeg
, SEEK_SET
) != 0
4661 || bfd_bread (buffer
, size
, abfd
) != size
)
4663 bfd_set_error (bfd_error_no_debug_section
);
4667 parse_module (abfd
, module
, buffer
, size
);
4671 /* Find out the function (if any) that contains the address. */
4672 for (funcinfo
= module
->func_table
; funcinfo
; funcinfo
= funcinfo
->next
)
4673 if (addr
>= funcinfo
->low
&& addr
<= funcinfo
->high
)
4675 *func
= funcinfo
->name
;
4680 /* Find out the source file and the line nearest to the address. */
4681 for (lineinfo
= module
->line_table
; lineinfo
; lineinfo
= lineinfo
->next
)
4682 if (lineinfo
->next
&& addr
< lineinfo
->next
->address
)
4684 for (srecinfo
= module
->srec_table
; srecinfo
; srecinfo
= srecinfo
->next
)
4685 if (srecinfo
->next
&& lineinfo
->line
< srecinfo
->next
->line
)
4687 if (srecinfo
->sfile
> 0)
4689 *file
= module
->file_table
[srecinfo
->sfile
].name
;
4690 *line
= srecinfo
->srec
+ lineinfo
->line
- srecinfo
->line
;
4694 *file
= module
->name
;
4695 *line
= lineinfo
->line
;
4706 /* Provided a BFD, a section and an offset into the section, calculate and
4707 return the name of the source file and the line nearest to the wanted
4711 _bfd_vms_find_nearest_dst_line (bfd
*abfd
, asection
*section
,
4712 asymbol
**symbols ATTRIBUTE_UNUSED
,
4713 bfd_vma offset
, const char **file
,
4714 const char **func
, unsigned int *line
)
4716 struct module
*module
;
4718 /* What address are we looking for? */
4719 bfd_vma addr
= section
->vma
+ offset
;
4725 /* We can't do anything if there is no DST (debug symbol table). */
4726 if (PRIV (dst_section
) == NULL
)
4729 /* Create the module list - if not already done. */
4730 if (PRIV (modules
) == NULL
)
4732 PRIV (modules
) = build_module_list (abfd
);
4733 if (PRIV (modules
) == NULL
)
4737 for (module
= PRIV (modules
); module
; module
= module
->next
)
4738 if (addr
>= module
->low
&& addr
<= module
->high
)
4739 return module_find_nearest_line (abfd
, module
, addr
, file
, func
, line
);
4744 /* Canonicalizations. */
4745 /* Set name, value, section and flags of SYM from E. */
4748 alpha_vms_convert_symbol (bfd
*abfd
, struct vms_symbol_entry
*e
, asymbol
*sym
)
4757 flags
= BSF_NO_FLAGS
;
4763 if (e
->flags
& EGSY__V_WEAK
)
4766 if (e
->flags
& EGSY__V_DEF
)
4768 /* Symbol definition. */
4769 flags
|= BSF_GLOBAL
;
4770 if (e
->flags
& EGSY__V_NORM
)
4771 flags
|= BSF_FUNCTION
;
4777 /* Symbol reference. */
4778 sec
= bfd_und_section_ptr
;
4783 /* A universal symbol is by definition global... */
4784 flags
|= BSF_GLOBAL
;
4786 /* ...and dynamic in shared libraries. */
4787 if (abfd
->flags
& DYNAMIC
)
4788 flags
|= BSF_DYNAMIC
;
4790 if (e
->flags
& EGSY__V_WEAK
)
4793 if (!(e
->flags
& EGSY__V_DEF
))
4796 if (e
->flags
& EGSY__V_NORM
)
4797 flags
|= BSF_FUNCTION
;
4800 /* sec = e->section; */
4801 sec
= bfd_abs_section_ptr
;
4816 /* Return the number of bytes required to store a vector of pointers
4817 to asymbols for all the symbols in the BFD abfd, including a
4818 terminal NULL pointer. If there are no symbols in the BFD,
4819 then return 0. If an error occurs, return -1. */
4822 alpha_vms_get_symtab_upper_bound (bfd
*abfd
)
4824 vms_debug2 ((1, "alpha_vms_get_symtab_upper_bound (%p), %d symbols\n",
4825 abfd
, PRIV (gsd_sym_count
)));
4827 return (PRIV (gsd_sym_count
) + 1) * sizeof (asymbol
*);
4830 /* Read the symbols from the BFD abfd, and fills in the vector
4831 location with pointers to the symbols and a trailing NULL.
4833 Return number of symbols read. */
4836 alpha_vms_canonicalize_symtab (bfd
*abfd
, asymbol
**symbols
)
4840 vms_debug2 ((1, "alpha_vms_canonicalize_symtab (%p, <ret>)\n", abfd
));
4842 if (PRIV (csymbols
) == NULL
)
4844 PRIV (csymbols
) = (asymbol
**) bfd_alloc
4845 (abfd
, PRIV (gsd_sym_count
) * sizeof (asymbol
*));
4847 /* Traverse table and fill symbols vector. */
4848 for (i
= 0; i
< PRIV (gsd_sym_count
); i
++)
4850 struct vms_symbol_entry
*e
= PRIV (syms
)[i
];
4853 sym
= bfd_make_empty_symbol (abfd
);
4854 if (sym
== NULL
|| !alpha_vms_convert_symbol (abfd
, e
, sym
))
4856 bfd_release (abfd
, PRIV (csymbols
));
4857 PRIV (csymbols
) = NULL
;
4861 PRIV (csymbols
)[i
] = sym
;
4865 if (symbols
!= NULL
)
4867 for (i
= 0; i
< PRIV (gsd_sym_count
); i
++)
4868 symbols
[i
] = PRIV (csymbols
)[i
];
4872 return PRIV (gsd_sym_count
);
4875 /* Read and convert relocations from ETIR. We do it once for all sections. */
4878 alpha_vms_slurp_relocs (bfd
*abfd
)
4882 vms_debug2 ((3, "alpha_vms_slurp_relocs\n"));
4884 /* We slurp relocs only once, for all sections. */
4885 if (PRIV (reloc_done
))
4887 PRIV (reloc_done
) = TRUE
;
4889 if (alpha_vms_canonicalize_symtab (abfd
, NULL
) < 0)
4892 if (bfd_seek (abfd
, 0, SEEK_SET
) != 0)
4897 unsigned char *begin
;
4900 bfd_reloc_code_real_type reloc_code
;
4906 bfd_vma cur_address
;
4908 unsigned char *cur_sym
= NULL
;
4910 bfd_vma cur_addend
= 0;
4912 /* Skip non-ETIR records. */
4913 type
= _bfd_vms_get_object_record (abfd
);
4914 if (type
== EOBJ__C_EEOM
)
4916 if (type
!= EOBJ__C_ETIR
)
4919 begin
= PRIV (recrd
.rec
) + 4;
4920 end
= PRIV (recrd
.rec
) + PRIV (recrd
.rec_size
);
4922 for (ptr
= begin
; ptr
< end
; ptr
+= length
)
4926 cmd
= bfd_getl16 (ptr
);
4927 length
= bfd_getl16 (ptr
+ 2);
4929 cur_address
= vaddr
;
4931 vms_debug2 ((4, "alpha_vms_slurp_relocs: etir %s\n",
4932 _bfd_vms_etir_name (cmd
)));
4936 case ETIR__C_STA_GBL
: /* ALPHA_R_REFLONG und_section, step 1 */
4937 /* ALPHA_R_REFQUAD und_section, step 1 */
4942 case ETIR__C_STA_PQ
: /* ALPHA_R_REF{LONG|QUAD}, others part 1 */
4943 cur_psidx
= bfd_getl32 (ptr
+ 4);
4944 cur_addend
= bfd_getl64 (ptr
+ 8);
4948 case ETIR__C_CTL_SETRB
:
4949 if (prev_cmd
!= ETIR__C_STA_PQ
)
4951 (*_bfd_error_handler
)
4952 (_("Unknown reloc %s + %s"), _bfd_vms_etir_name (prev_cmd
),
4953 _bfd_vms_etir_name (cmd
));
4956 cur_psect
= cur_psidx
;
4962 case ETIR__C_STA_LW
: /* ALPHA_R_REFLONG abs_section, step 1 */
4963 /* ALPHA_R_REFLONG und_section, step 2 */
4966 if (prev_cmd
!= ETIR__C_STA_GBL
)
4968 (*_bfd_error_handler
)
4969 (_("Unknown reloc %s + %s"), _bfd_vms_etir_name (cmd
),
4970 _bfd_vms_etir_name (ETIR__C_STA_LW
));
4974 cur_addend
= bfd_getl32 (ptr
+ 4);
4978 case ETIR__C_STA_QW
: /* ALPHA_R_REFQUAD abs_section, step 1 */
4979 /* ALPHA_R_REFQUAD und_section, step 2 */
4980 if (prev_cmd
!= -1 && prev_cmd
!= ETIR__C_STA_GBL
)
4982 (*_bfd_error_handler
)
4983 (_("Unknown reloc %s + %s"), _bfd_vms_etir_name (cmd
),
4984 _bfd_vms_etir_name (ETIR__C_STA_QW
));
4987 cur_addend
= bfd_getl64 (ptr
+ 4);
4991 case ETIR__C_STO_LW
: /* ALPHA_R_REFLONG und_section, step 4 */
4992 /* ALPHA_R_REFLONG abs_section, step 2 */
4993 /* ALPHA_R_REFLONG others, step 2 */
4994 if (prev_cmd
!= ETIR__C_OPR_ADD
4995 && prev_cmd
!= ETIR__C_STA_LW
4996 && prev_cmd
!= ETIR__C_STA_PQ
)
4998 (*_bfd_error_handler
) (_("Unknown reloc %s + %s"),
4999 _bfd_vms_etir_name (prev_cmd
),
5000 _bfd_vms_etir_name (ETIR__C_STO_LW
));
5003 reloc_code
= BFD_RELOC_32
;
5006 case ETIR__C_STO_QW
: /* ALPHA_R_REFQUAD und_section, step 4 */
5007 /* ALPHA_R_REFQUAD abs_section, step 2 */
5008 if (prev_cmd
!= ETIR__C_OPR_ADD
&& prev_cmd
!= ETIR__C_STA_QW
)
5010 (*_bfd_error_handler
) (_("Unknown reloc %s + %s"),
5011 _bfd_vms_etir_name (prev_cmd
),
5012 _bfd_vms_etir_name (ETIR__C_STO_QW
));
5015 reloc_code
= BFD_RELOC_64
;
5018 case ETIR__C_STO_OFF
: /* ALPHA_R_REFQUAD others, step 2 */
5019 if (prev_cmd
!= ETIR__C_STA_PQ
)
5021 (*_bfd_error_handler
) (_("Unknown reloc %s + %s"),
5022 _bfd_vms_etir_name (prev_cmd
),
5023 _bfd_vms_etir_name (ETIR__C_STO_OFF
));
5026 reloc_code
= BFD_RELOC_64
;
5029 case ETIR__C_OPR_ADD
: /* ALPHA_R_REFLONG und_section, step 3 */
5030 /* ALPHA_R_REFQUAD und_section, step 3 */
5031 if (prev_cmd
!= ETIR__C_STA_LW
&& prev_cmd
!= ETIR__C_STA_QW
)
5033 (*_bfd_error_handler
) (_("Unknown reloc %s + %s"),
5034 _bfd_vms_etir_name (prev_cmd
),
5035 _bfd_vms_etir_name (ETIR__C_OPR_ADD
));
5038 prev_cmd
= ETIR__C_OPR_ADD
;
5041 case ETIR__C_STO_CA
: /* ALPHA_R_CODEADDR */
5042 reloc_code
= BFD_RELOC_ALPHA_CODEADDR
;
5046 case ETIR__C_STO_GBL
: /* ALPHA_R_REFQUAD und_section */
5047 reloc_code
= BFD_RELOC_64
;
5051 case ETIR__C_STO_GBL_LW
: /* ALPHA_R_REFLONG und_section */
5052 reloc_code
= BFD_RELOC_32
;
5056 case ETIR__C_STC_LP_PSB
: /* ALPHA_R_LINKAGE */
5057 reloc_code
= BFD_RELOC_ALPHA_LINKAGE
;
5061 case ETIR__C_STC_NOP_GBL
: /* ALPHA_R_NOP */
5062 reloc_code
= BFD_RELOC_ALPHA_NOP
;
5065 case ETIR__C_STC_BSR_GBL
: /* ALPHA_R_BSR */
5066 reloc_code
= BFD_RELOC_ALPHA_BSR
;
5069 case ETIR__C_STC_LDA_GBL
: /* ALPHA_R_LDA */
5070 reloc_code
= BFD_RELOC_ALPHA_LDA
;
5073 case ETIR__C_STC_BOH_GBL
: /* ALPHA_R_BOH */
5074 reloc_code
= BFD_RELOC_ALPHA_BOH
;
5078 cur_sym
= ptr
+ 4 + 32;
5079 cur_address
= bfd_getl64 (ptr
+ 4 + 8);
5080 cur_addend
= bfd_getl64 (ptr
+ 4 + 24);
5083 case ETIR__C_STO_IMM
:
5084 vaddr
+= bfd_getl32 (ptr
+ 4);
5088 (*_bfd_error_handler
) (_("Unknown reloc %s"),
5089 _bfd_vms_etir_name (cmd
));
5095 struct vms_section_data_struct
*vms_sec
;
5098 /* Get section to which the relocation applies. */
5099 if (cur_psect
< 0 || cur_psect
> (int)PRIV (section_count
))
5101 (*_bfd_error_handler
) (_("Invalid section index in ETIR"));
5105 sec
= PRIV (sections
)[cur_psect
];
5106 if (sec
== bfd_abs_section_ptr
)
5108 (*_bfd_error_handler
) (_("Relocation for non-REL psect"));
5112 vms_sec
= vms_section_data (sec
);
5114 /* Allocate a reloc entry. */
5115 if (sec
->reloc_count
>= vms_sec
->reloc_max
)
5117 if (vms_sec
->reloc_max
== 0)
5119 vms_sec
->reloc_max
= 64;
5120 sec
->relocation
= bfd_zmalloc
5121 (vms_sec
->reloc_max
* sizeof (arelent
));
5125 vms_sec
->reloc_max
*= 2;
5126 sec
->relocation
= bfd_realloc
5127 (sec
->relocation
, vms_sec
->reloc_max
* sizeof (arelent
));
5130 reloc
= &sec
->relocation
[sec
->reloc_count
];
5133 reloc
->howto
= bfd_reloc_type_lookup (abfd
, reloc_code
);
5135 if (cur_sym
!= NULL
)
5138 unsigned int symlen
= *cur_sym
;
5141 /* Linear search. */
5146 for (j
= 0; j
< PRIV (gsd_sym_count
); j
++)
5147 if (PRIV (syms
)[j
]->namelen
== symlen
5148 && memcmp (PRIV (syms
)[j
]->name
, cur_sym
, symlen
) == 0)
5150 sym
= &PRIV (csymbols
)[j
];
5155 (*_bfd_error_handler
) (_("Unknown symbol in command %s"),
5156 _bfd_vms_etir_name (cmd
));
5157 reloc
->sym_ptr_ptr
= NULL
;
5160 reloc
->sym_ptr_ptr
= sym
;
5162 else if (cur_psidx
>= 0)
5163 reloc
->sym_ptr_ptr
=
5164 PRIV (sections
)[cur_psidx
]->symbol_ptr_ptr
;
5166 reloc
->sym_ptr_ptr
= NULL
;
5168 reloc
->address
= cur_address
;
5169 reloc
->addend
= cur_addend
;
5171 vaddr
+= bfd_get_reloc_size (reloc
->howto
);
5180 vms_debug2 ((3, "alpha_vms_slurp_relocs: result = TRUE\n"));
5185 /* Return the number of bytes required to store the relocation
5186 information associated with the given section. */
5189 alpha_vms_get_reloc_upper_bound (bfd
*abfd ATTRIBUTE_UNUSED
, asection
*section
)
5191 alpha_vms_slurp_relocs (abfd
);
5193 return (section
->reloc_count
+ 1) * sizeof (arelent
*);
5196 /* Convert relocations from VMS (external) form into BFD internal
5197 form. Return the number of relocations. */
5200 alpha_vms_canonicalize_reloc (bfd
*abfd
, asection
*section
, arelent
**relptr
,
5201 asymbol
**symbols ATTRIBUTE_UNUSED
)
5206 if (!alpha_vms_slurp_relocs (abfd
))
5209 count
= section
->reloc_count
;
5210 tblptr
= section
->relocation
;
5213 *relptr
++ = tblptr
++;
5215 *relptr
= (arelent
*) NULL
;
5216 return section
->reloc_count
;
5219 /* This is just copied from ecoff-alpha, needs to be fixed probably. */
5221 /* How to process the various reloc types. */
5223 static bfd_reloc_status_type
5224 reloc_nil (bfd
* abfd ATTRIBUTE_UNUSED
,
5225 arelent
*reloc ATTRIBUTE_UNUSED
,
5226 asymbol
*sym ATTRIBUTE_UNUSED
,
5227 void * data ATTRIBUTE_UNUSED
,
5228 asection
*sec ATTRIBUTE_UNUSED
,
5229 bfd
*output_bfd ATTRIBUTE_UNUSED
,
5230 char **error_message ATTRIBUTE_UNUSED
)
5233 vms_debug (1, "reloc_nil (abfd %p, output_bfd %p)\n", abfd
, output_bfd
);
5234 vms_debug (2, "In section %s, symbol %s\n",
5235 sec
->name
, sym
->name
);
5236 vms_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n",
5237 reloc
->sym_ptr_ptr
[0]->name
,
5238 (unsigned long)reloc
->address
,
5239 (unsigned long)reloc
->addend
, reloc
->howto
->name
);
5240 vms_debug (2, "data at %p\n", data
);
5241 /* _bfd_hexdump (2, data, bfd_get_reloc_size (reloc->howto), 0); */
5244 return bfd_reloc_ok
;
5247 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
5248 from smaller values. Start with zero, widen, *then* decrement. */
5249 #define MINUS_ONE (((bfd_vma)0) - 1)
5251 static reloc_howto_type alpha_howto_table
[] =
5253 HOWTO (ALPHA_R_IGNORE
, /* Type. */
5254 0, /* Rightshift. */
5255 0, /* Size (0 = byte, 1 = short, 2 = long). */
5257 TRUE
, /* PC relative. */
5259 complain_overflow_dont
,/* Complain_on_overflow. */
5260 reloc_nil
, /* Special_function. */
5261 "IGNORE", /* Name. */
5262 TRUE
, /* Partial_inplace. */
5263 0, /* Source mask */
5265 TRUE
), /* PC rel offset. */
5267 /* A 64 bit reference to a symbol. */
5268 HOWTO (ALPHA_R_REFQUAD
, /* Type. */
5269 0, /* Rightshift. */
5270 4, /* Size (0 = byte, 1 = short, 2 = long). */
5272 FALSE
, /* PC relative. */
5274 complain_overflow_bitfield
, /* Complain_on_overflow. */
5275 reloc_nil
, /* Special_function. */
5276 "REFQUAD", /* Name. */
5277 TRUE
, /* Partial_inplace. */
5278 MINUS_ONE
, /* Source mask. */
5279 MINUS_ONE
, /* Dest mask. */
5280 FALSE
), /* PC rel offset. */
5282 /* A 21 bit branch. The native assembler generates these for
5283 branches within the text segment, and also fills in the PC
5284 relative offset in the instruction. */
5285 HOWTO (ALPHA_R_BRADDR
, /* Type. */
5286 2, /* Rightshift. */
5287 2, /* Size (0 = byte, 1 = short, 2 = long). */
5289 TRUE
, /* PC relative. */
5291 complain_overflow_signed
, /* Complain_on_overflow. */
5292 reloc_nil
, /* Special_function. */
5293 "BRADDR", /* Name. */
5294 TRUE
, /* Partial_inplace. */
5295 0x1fffff, /* Source mask. */
5296 0x1fffff, /* Dest mask. */
5297 FALSE
), /* PC rel offset. */
5299 /* A hint for a jump to a register. */
5300 HOWTO (ALPHA_R_HINT
, /* Type. */
5301 2, /* Rightshift. */
5302 1, /* Size (0 = byte, 1 = short, 2 = long). */
5304 TRUE
, /* PC relative. */
5306 complain_overflow_dont
,/* Complain_on_overflow. */
5307 reloc_nil
, /* Special_function. */
5309 TRUE
, /* Partial_inplace. */
5310 0x3fff, /* Source mask. */
5311 0x3fff, /* Dest mask. */
5312 FALSE
), /* PC rel offset. */
5314 /* 16 bit PC relative offset. */
5315 HOWTO (ALPHA_R_SREL16
, /* Type. */
5316 0, /* Rightshift. */
5317 1, /* Size (0 = byte, 1 = short, 2 = long). */
5319 TRUE
, /* PC relative. */
5321 complain_overflow_signed
, /* Complain_on_overflow. */
5322 reloc_nil
, /* Special_function. */
5323 "SREL16", /* Name. */
5324 TRUE
, /* Partial_inplace. */
5325 0xffff, /* Source mask. */
5326 0xffff, /* Dest mask. */
5327 FALSE
), /* PC rel offset. */
5329 /* 32 bit PC relative offset. */
5330 HOWTO (ALPHA_R_SREL32
, /* Type. */
5331 0, /* Rightshift. */
5332 2, /* Size (0 = byte, 1 = short, 2 = long). */
5334 TRUE
, /* PC relative. */
5336 complain_overflow_signed
, /* Complain_on_overflow. */
5337 reloc_nil
, /* Special_function. */
5338 "SREL32", /* Name. */
5339 TRUE
, /* Partial_inplace. */
5340 0xffffffff, /* Source mask. */
5341 0xffffffff, /* Dest mask. */
5342 FALSE
), /* PC rel offset. */
5344 /* A 64 bit PC relative offset. */
5345 HOWTO (ALPHA_R_SREL64
, /* Type. */
5346 0, /* Rightshift. */
5347 4, /* Size (0 = byte, 1 = short, 2 = long). */
5349 TRUE
, /* PC relative. */
5351 complain_overflow_signed
, /* Complain_on_overflow. */
5352 reloc_nil
, /* Special_function. */
5353 "SREL64", /* Name. */
5354 TRUE
, /* Partial_inplace. */
5355 MINUS_ONE
, /* Source mask. */
5356 MINUS_ONE
, /* Dest mask. */
5357 FALSE
), /* PC rel offset. */
5359 /* Push a value on the reloc evaluation stack. */
5360 HOWTO (ALPHA_R_OP_PUSH
, /* Type. */
5361 0, /* Rightshift. */
5362 0, /* Size (0 = byte, 1 = short, 2 = long). */
5364 FALSE
, /* PC relative. */
5366 complain_overflow_dont
,/* Complain_on_overflow. */
5367 reloc_nil
, /* Special_function. */
5368 "OP_PUSH", /* Name. */
5369 FALSE
, /* Partial_inplace. */
5370 0, /* Source mask. */
5372 FALSE
), /* PC rel offset. */
5374 /* Store the value from the stack at the given address. Store it in
5375 a bitfield of size r_size starting at bit position r_offset. */
5376 HOWTO (ALPHA_R_OP_STORE
, /* Type. */
5377 0, /* Rightshift. */
5378 4, /* Size (0 = byte, 1 = short, 2 = long). */
5380 FALSE
, /* PC relative. */
5382 complain_overflow_dont
,/* Complain_on_overflow. */
5383 reloc_nil
, /* Special_function. */
5384 "OP_STORE", /* Name. */
5385 FALSE
, /* Partial_inplace. */
5386 0, /* Source mask. */
5387 MINUS_ONE
, /* Dest mask. */
5388 FALSE
), /* PC rel offset. */
5390 /* Subtract the reloc address from the value on the top of the
5391 relocation stack. */
5392 HOWTO (ALPHA_R_OP_PSUB
, /* Type. */
5393 0, /* Rightshift. */
5394 0, /* Size (0 = byte, 1 = short, 2 = long). */
5396 FALSE
, /* PC relative. */
5398 complain_overflow_dont
,/* Complain_on_overflow. */
5399 reloc_nil
, /* Special_function. */
5400 "OP_PSUB", /* Name. */
5401 FALSE
, /* Partial_inplace. */
5402 0, /* Source mask. */
5404 FALSE
), /* PC rel offset. */
5406 /* Shift the value on the top of the relocation stack right by the
5408 HOWTO (ALPHA_R_OP_PRSHIFT
, /* Type. */
5409 0, /* Rightshift. */
5410 0, /* Size (0 = byte, 1 = short, 2 = long). */
5412 FALSE
, /* PC relative. */
5414 complain_overflow_dont
,/* Complain_on_overflow. */
5415 reloc_nil
, /* Special_function. */
5416 "OP_PRSHIFT", /* Name. */
5417 FALSE
, /* Partial_inplace. */
5418 0, /* Source mask. */
5420 FALSE
), /* PC rel offset. */
5422 /* Hack. Linkage is done by linker. */
5423 HOWTO (ALPHA_R_LINKAGE
, /* Type. */
5424 0, /* Rightshift. */
5425 8, /* Size (0 = byte, 1 = short, 2 = long). */
5427 FALSE
, /* PC relative. */
5429 complain_overflow_dont
,/* Complain_on_overflow. */
5430 reloc_nil
, /* Special_function. */
5431 "LINKAGE", /* Name. */
5432 FALSE
, /* Partial_inplace. */
5433 0, /* Source mask. */
5435 FALSE
), /* PC rel offset. */
5437 /* A 32 bit reference to a symbol. */
5438 HOWTO (ALPHA_R_REFLONG
, /* Type. */
5439 0, /* Rightshift. */
5440 2, /* Size (0 = byte, 1 = short, 2 = long). */
5442 FALSE
, /* PC relative. */
5444 complain_overflow_bitfield
, /* Complain_on_overflow. */
5445 reloc_nil
, /* Special_function. */
5446 "REFLONG", /* Name. */
5447 TRUE
, /* Partial_inplace. */
5448 0xffffffff, /* Source mask. */
5449 0xffffffff, /* Dest mask. */
5450 FALSE
), /* PC rel offset. */
5452 /* A 64 bit reference to a procedure, written as 32 bit value. */
5453 HOWTO (ALPHA_R_CODEADDR
, /* Type. */
5454 0, /* Rightshift. */
5455 4, /* Size (0 = byte, 1 = short, 2 = long). */
5457 FALSE
, /* PC relative. */
5459 complain_overflow_signed
,/* Complain_on_overflow. */
5460 reloc_nil
, /* Special_function. */
5461 "CODEADDR", /* Name. */
5462 FALSE
, /* Partial_inplace. */
5463 0xffffffff, /* Source mask. */
5464 0xffffffff, /* Dest mask. */
5465 FALSE
), /* PC rel offset. */
5467 HOWTO (ALPHA_R_NOP
, /* Type. */
5468 0, /* Rightshift. */
5469 3, /* Size (0 = byte, 1 = short, 2 = long). */
5471 /* The following value must match that of ALPHA_R_BSR/ALPHA_R_BOH
5472 because the calculations for the 3 relocations are the same.
5473 See B.4.5.2 of the OpenVMS Linker Utility Manual. */
5474 TRUE
, /* PC relative. */
5476 complain_overflow_dont
,/* Complain_on_overflow. */
5477 reloc_nil
, /* Special_function. */
5479 FALSE
, /* Partial_inplace. */
5480 0xffffffff, /* Source mask. */
5481 0xffffffff, /* Dest mask. */
5482 FALSE
), /* PC rel offset. */
5484 HOWTO (ALPHA_R_BSR
, /* Type. */
5485 0, /* Rightshift. */
5486 3, /* Size (0 = byte, 1 = short, 2 = long). */
5488 TRUE
, /* PC relative. */
5490 complain_overflow_dont
,/* Complain_on_overflow. */
5491 reloc_nil
, /* Special_function. */
5493 FALSE
, /* Partial_inplace. */
5494 0xffffffff, /* Source mask. */
5495 0xffffffff, /* Dest mask. */
5496 FALSE
), /* PC rel offset. */
5498 HOWTO (ALPHA_R_LDA
, /* Type. */
5499 0, /* Rightshift. */
5500 3, /* Size (0 = byte, 1 = short, 2 = long). */
5502 FALSE
, /* PC relative. */
5504 complain_overflow_dont
,/* Complain_on_overflow. */
5505 reloc_nil
, /* Special_function. */
5507 FALSE
, /* Partial_inplace. */
5508 0xffffffff, /* Source mask. */
5509 0xffffffff, /* Dest mask. */
5510 FALSE
), /* PC rel offset. */
5512 HOWTO (ALPHA_R_BOH
, /* Type. */
5513 0, /* Rightshift. */
5514 3, /* Size (0 = byte, 1 = short, 2 = long, 3 = nil). */
5516 TRUE
, /* PC relative. */
5518 complain_overflow_dont
,/* Complain_on_overflow. */
5519 reloc_nil
, /* Special_function. */
5521 FALSE
, /* Partial_inplace. */
5522 0xffffffff, /* Source mask. */
5523 0xffffffff, /* Dest mask. */
5524 FALSE
), /* PC rel offset. */
5527 /* Return a pointer to a howto structure which, when invoked, will perform
5528 the relocation code on data from the architecture noted. */
5530 static const struct reloc_howto_struct
*
5531 alpha_vms_bfd_reloc_type_lookup (bfd
* abfd ATTRIBUTE_UNUSED
,
5532 bfd_reloc_code_real_type code
)
5536 vms_debug2 ((1, "vms_bfd_reloc_type_lookup (%p, %d)\t", abfd
, code
));
5540 case BFD_RELOC_16
: alpha_type
= ALPHA_R_SREL16
; break;
5541 case BFD_RELOC_32
: alpha_type
= ALPHA_R_REFLONG
; break;
5542 case BFD_RELOC_64
: alpha_type
= ALPHA_R_REFQUAD
; break;
5543 case BFD_RELOC_CTOR
: alpha_type
= ALPHA_R_REFQUAD
; break;
5544 case BFD_RELOC_23_PCREL_S2
: alpha_type
= ALPHA_R_BRADDR
; break;
5545 case BFD_RELOC_ALPHA_HINT
: alpha_type
= ALPHA_R_HINT
; break;
5546 case BFD_RELOC_16_PCREL
: alpha_type
= ALPHA_R_SREL16
; break;
5547 case BFD_RELOC_32_PCREL
: alpha_type
= ALPHA_R_SREL32
; break;
5548 case BFD_RELOC_64_PCREL
: alpha_type
= ALPHA_R_SREL64
; break;
5549 case BFD_RELOC_ALPHA_LINKAGE
: alpha_type
= ALPHA_R_LINKAGE
; break;
5550 case BFD_RELOC_ALPHA_CODEADDR
: alpha_type
= ALPHA_R_CODEADDR
; break;
5551 case BFD_RELOC_ALPHA_NOP
: alpha_type
= ALPHA_R_NOP
; break;
5552 case BFD_RELOC_ALPHA_BSR
: alpha_type
= ALPHA_R_BSR
; break;
5553 case BFD_RELOC_ALPHA_LDA
: alpha_type
= ALPHA_R_LDA
; break;
5554 case BFD_RELOC_ALPHA_BOH
: alpha_type
= ALPHA_R_BOH
; break;
5556 (*_bfd_error_handler
) ("reloc (%d) is *UNKNOWN*", code
);
5559 vms_debug2 ((2, "reloc is %s\n", alpha_howto_table
[alpha_type
].name
));
5560 return & alpha_howto_table
[alpha_type
];
5563 static reloc_howto_type
*
5564 alpha_vms_bfd_reloc_name_lookup (bfd
*abfd ATTRIBUTE_UNUSED
,
5570 i
< sizeof (alpha_howto_table
) / sizeof (alpha_howto_table
[0]);
5572 if (alpha_howto_table
[i
].name
!= NULL
5573 && strcasecmp (alpha_howto_table
[i
].name
, r_name
) == 0)
5574 return &alpha_howto_table
[i
];
5580 alpha_vms_get_synthetic_symtab (bfd
*abfd
,
5581 long symcount ATTRIBUTE_UNUSED
,
5582 asymbol
**usyms ATTRIBUTE_UNUSED
,
5583 long dynsymcount ATTRIBUTE_UNUSED
,
5584 asymbol
**dynsyms ATTRIBUTE_UNUSED
,
5591 syms
= (asymbol
*) bfd_malloc (PRIV (norm_sym_count
) * sizeof (asymbol
));
5596 for (i
= 0; i
< PRIV (gsd_sym_count
); i
++)
5598 struct vms_symbol_entry
*e
= PRIV (syms
)[i
];
5609 flags
= BSF_LOCAL
| BSF_SYNTHETIC
;
5616 if ((e
->flags
& EGSY__V_DEF
) && (e
->flags
& EGSY__V_NORM
))
5618 value
= e
->code_value
;
5619 sec
= e
->code_section
;
5630 sname
= bfd_alloc (abfd
, l
+ 5);
5633 memcpy (sname
, name
, l
);
5634 memcpy (sname
+ l
, "..en", 5);
5641 sym
->udata
.p
= NULL
;
5650 vms_time_to_str (unsigned char *buf
)
5652 time_t t
= vms_rawtime_to_time_t (buf
);
5653 char *res
= ctime (&t
);
5656 res
= "*invalid time*";
5663 evax_bfd_print_emh (FILE *file
, unsigned char *rec
, unsigned int rec_len
)
5665 struct vms_emh_common
*emh
= (struct vms_emh_common
*)rec
;
5666 unsigned int subtype
;
5668 subtype
= (unsigned)bfd_getl16 (emh
->subtyp
);
5670 fprintf (file
, _(" EMH %u (len=%u): "), subtype
, rec_len
);
5676 struct vms_emh_mhd
*mhd
= (struct vms_emh_mhd
*)rec
;
5679 fprintf (file
, _("Module header\n"));
5680 fprintf (file
, _(" structure level: %u\n"), mhd
->strlvl
);
5681 fprintf (file
, _(" max record size: %u\n"),
5682 (unsigned)bfd_getl32 (mhd
->recsiz
));
5683 name
= (char *)(mhd
+ 1);
5684 fprintf (file
, _(" module name : %.*s\n"), name
[0], name
+ 1);
5685 name
+= name
[0] + 1;
5686 fprintf (file
, _(" module version : %.*s\n"), name
[0], name
+ 1);
5687 name
+= name
[0] + 1;
5688 fprintf (file
, _(" compile date : %.17s\n"), name
);
5693 fprintf (file
, _("Language Processor Name\n"));
5694 fprintf (file
, _(" language name: %.*s\n"),
5695 (int)(rec_len
- sizeof (struct vms_emh_common
)),
5696 (char *)rec
+ sizeof (struct vms_emh_common
));
5701 fprintf (file
, _("Source Files Header\n"));
5702 fprintf (file
, _(" file: %.*s\n"),
5703 (int)(rec_len
- sizeof (struct vms_emh_common
)),
5704 (char *)rec
+ sizeof (struct vms_emh_common
));
5709 fprintf (file
, _("Title Text Header\n"));
5710 fprintf (file
, _(" title: %.*s\n"),
5711 (int)(rec_len
- sizeof (struct vms_emh_common
)),
5712 (char *)rec
+ sizeof (struct vms_emh_common
));
5717 fprintf (file
, _("Copyright Header\n"));
5718 fprintf (file
, _(" copyright: %.*s\n"),
5719 (int)(rec_len
- sizeof (struct vms_emh_common
)),
5720 (char *)rec
+ sizeof (struct vms_emh_common
));
5724 fprintf (file
, _("unhandled emh subtype %u\n"), subtype
);
5730 evax_bfd_print_eeom (FILE *file
, unsigned char *rec
, unsigned int rec_len
)
5732 struct vms_eeom
*eeom
= (struct vms_eeom
*)rec
;
5734 fprintf (file
, _(" EEOM (len=%u):\n"), rec_len
);
5735 fprintf (file
, _(" number of cond linkage pairs: %u\n"),
5736 (unsigned)bfd_getl32 (eeom
->total_lps
));
5737 fprintf (file
, _(" completion code: %u\n"),
5738 (unsigned)bfd_getl16 (eeom
->comcod
));
5741 fprintf (file
, _(" transfer addr flags: 0x%02x\n"), eeom
->tfrflg
);
5742 fprintf (file
, _(" transfer addr psect: %u\n"),
5743 (unsigned)bfd_getl32 (eeom
->psindx
));
5744 fprintf (file
, _(" transfer address : 0x%08x\n"),
5745 (unsigned)bfd_getl32 (eeom
->tfradr
));
5750 exav_bfd_print_egsy_flags (unsigned int flags
, FILE *file
)
5752 if (flags
& EGSY__V_WEAK
)
5753 fputs (_(" WEAK"), file
);
5754 if (flags
& EGSY__V_DEF
)
5755 fputs (_(" DEF"), file
);
5756 if (flags
& EGSY__V_UNI
)
5757 fputs (_(" UNI"), file
);
5758 if (flags
& EGSY__V_REL
)
5759 fputs (_(" REL"), file
);
5760 if (flags
& EGSY__V_COMM
)
5761 fputs (_(" COMM"), file
);
5762 if (flags
& EGSY__V_VECEP
)
5763 fputs (_(" VECEP"), file
);
5764 if (flags
& EGSY__V_NORM
)
5765 fputs (_(" NORM"), file
);
5766 if (flags
& EGSY__V_QUAD_VAL
)
5767 fputs (_(" QVAL"), file
);
5771 evax_bfd_print_egsd_flags (FILE *file
, unsigned int flags
)
5773 if (flags
& EGPS__V_PIC
)
5774 fputs (_(" PIC"), file
);
5775 if (flags
& EGPS__V_LIB
)
5776 fputs (_(" LIB"), file
);
5777 if (flags
& EGPS__V_OVR
)
5778 fputs (_(" OVR"), file
);
5779 if (flags
& EGPS__V_REL
)
5780 fputs (_(" REL"), file
);
5781 if (flags
& EGPS__V_GBL
)
5782 fputs (_(" GBL"), file
);
5783 if (flags
& EGPS__V_SHR
)
5784 fputs (_(" SHR"), file
);
5785 if (flags
& EGPS__V_EXE
)
5786 fputs (_(" EXE"), file
);
5787 if (flags
& EGPS__V_RD
)
5788 fputs (_(" RD"), file
);
5789 if (flags
& EGPS__V_WRT
)
5790 fputs (_(" WRT"), file
);
5791 if (flags
& EGPS__V_VEC
)
5792 fputs (_(" VEC"), file
);
5793 if (flags
& EGPS__V_NOMOD
)
5794 fputs (_(" NOMOD"), file
);
5795 if (flags
& EGPS__V_COM
)
5796 fputs (_(" COM"), file
);
5797 if (flags
& EGPS__V_ALLOC_64BIT
)
5798 fputs (_(" 64B"), file
);
5802 evax_bfd_print_egsd (FILE *file
, unsigned char *rec
, unsigned int rec_len
)
5804 unsigned int off
= sizeof (struct vms_egsd
);
5807 fprintf (file
, _(" EGSD (len=%u):\n"), rec_len
);
5810 for (off
= sizeof (struct vms_egsd
); off
< rec_len
; )
5812 struct vms_egsd_entry
*e
= (struct vms_egsd_entry
*)(rec
+ off
);
5816 type
= (unsigned)bfd_getl16 (e
->gsdtyp
);
5817 len
= (unsigned)bfd_getl16 (e
->gsdsiz
);
5819 fprintf (file
, _(" EGSD entry %2u (type: %u, len: %u): "),
5827 struct vms_egps
*egps
= (struct vms_egps
*)e
;
5828 unsigned int flags
= bfd_getl16 (egps
->flags
);
5831 fprintf (file
, _("PSC - Program section definition\n"));
5832 fprintf (file
, _(" alignment : 2**%u\n"), egps
->align
);
5833 fprintf (file
, _(" flags : 0x%04x"), flags
);
5834 evax_bfd_print_egsd_flags (file
, flags
);
5836 l
= bfd_getl32 (egps
->alloc
);
5837 fprintf (file
, _(" alloc (len): %u (0x%08x)\n"), l
, l
);
5838 fprintf (file
, _(" name : %.*s\n"),
5839 egps
->namlng
, egps
->name
);
5844 struct vms_esgps
*esgps
= (struct vms_esgps
*)e
;
5845 unsigned int flags
= bfd_getl16 (esgps
->flags
);
5848 fprintf (file
, _("SPSC - Shared Image Program section def\n"));
5849 fprintf (file
, _(" alignment : 2**%u\n"), esgps
->align
);
5850 fprintf (file
, _(" flags : 0x%04x"), flags
);
5851 evax_bfd_print_egsd_flags (file
, flags
);
5853 l
= bfd_getl32 (esgps
->alloc
);
5854 fprintf (file
, _(" alloc (len) : %u (0x%08x)\n"), l
, l
);
5855 fprintf (file
, _(" image offset : 0x%08x\n"),
5856 (unsigned int)bfd_getl32 (esgps
->base
));
5857 fprintf (file
, _(" symvec offset : 0x%08x\n"),
5858 (unsigned int)bfd_getl32 (esgps
->value
));
5859 fprintf (file
, _(" name : %.*s\n"),
5860 esgps
->namlng
, esgps
->name
);
5865 struct vms_egsy
*egsy
= (struct vms_egsy
*)e
;
5866 unsigned int flags
= bfd_getl16 (egsy
->flags
);
5868 if (flags
& EGSY__V_DEF
)
5870 struct vms_esdf
*esdf
= (struct vms_esdf
*)e
;
5872 fprintf (file
, _("SYM - Global symbol definition\n"));
5873 fprintf (file
, _(" flags: 0x%04x"), flags
);
5874 exav_bfd_print_egsy_flags (flags
, file
);
5876 fprintf (file
, _(" psect offset: 0x%08x\n"),
5877 (unsigned)bfd_getl32 (esdf
->value
));
5878 if (flags
& EGSY__V_NORM
)
5880 fprintf (file
, _(" code address: 0x%08x\n"),
5881 (unsigned)bfd_getl32 (esdf
->code_address
));
5882 fprintf (file
, _(" psect index for entry point : %u\n"),
5883 (unsigned)bfd_getl32 (esdf
->ca_psindx
));
5885 fprintf (file
, _(" psect index : %u\n"),
5886 (unsigned)bfd_getl32 (esdf
->psindx
));
5887 fprintf (file
, _(" name : %.*s\n"),
5888 esdf
->namlng
, esdf
->name
);
5892 struct vms_esrf
*esrf
= (struct vms_esrf
*)e
;
5894 fprintf (file
, _("SYM - Global symbol reference\n"));
5895 fprintf (file
, _(" name : %.*s\n"),
5896 esrf
->namlng
, esrf
->name
);
5902 struct vms_eidc
*eidc
= (struct vms_eidc
*)e
;
5903 unsigned int flags
= bfd_getl32 (eidc
->flags
);
5906 fprintf (file
, _("IDC - Ident Consistency check\n"));
5907 fprintf (file
, _(" flags : 0x%08x"), flags
);
5908 if (flags
& EIDC__V_BINIDENT
)
5909 fputs (" BINDENT", file
);
5911 fprintf (file
, _(" id match : %x\n"),
5912 (flags
>> EIDC__V_IDMATCH_SH
) & EIDC__V_IDMATCH_MASK
);
5913 fprintf (file
, _(" error severity: %x\n"),
5914 (flags
>> EIDC__V_ERRSEV_SH
) & EIDC__V_ERRSEV_MASK
);
5916 fprintf (file
, _(" entity name : %.*s\n"), p
[0], p
+ 1);
5918 fprintf (file
, _(" object name : %.*s\n"), p
[0], p
+ 1);
5920 if (flags
& EIDC__V_BINIDENT
)
5921 fprintf (file
, _(" binary ident : 0x%08x\n"),
5922 (unsigned)bfd_getl32 (p
+ 1));
5924 fprintf (file
, _(" ascii ident : %.*s\n"), p
[0], p
+ 1);
5929 struct vms_egst
*egst
= (struct vms_egst
*)e
;
5930 unsigned int flags
= bfd_getl16 (egst
->header
.flags
);
5932 fprintf (file
, _("SYMG - Universal symbol definition\n"));
5933 fprintf (file
, _(" flags: 0x%04x"), flags
);
5934 exav_bfd_print_egsy_flags (flags
, file
);
5936 fprintf (file
, _(" symbol vector offset: 0x%08x\n"),
5937 (unsigned)bfd_getl32 (egst
->value
));
5938 fprintf (file
, _(" entry point: 0x%08x\n"),
5939 (unsigned)bfd_getl32 (egst
->lp_1
));
5940 fprintf (file
, _(" proc descr : 0x%08x\n"),
5941 (unsigned)bfd_getl32 (egst
->lp_2
));
5942 fprintf (file
, _(" psect index: %u\n"),
5943 (unsigned)bfd_getl32 (egst
->psindx
));
5944 fprintf (file
, _(" name : %.*s\n"),
5945 egst
->namlng
, egst
->name
);
5950 struct vms_esdfv
*esdfv
= (struct vms_esdfv
*)e
;
5951 unsigned int flags
= bfd_getl16 (esdfv
->flags
);
5953 fprintf (file
, _("SYMV - Vectored symbol definition\n"));
5954 fprintf (file
, _(" flags: 0x%04x"), flags
);
5955 exav_bfd_print_egsy_flags (flags
, file
);
5957 fprintf (file
, _(" vector : 0x%08x\n"),
5958 (unsigned)bfd_getl32 (esdfv
->vector
));
5959 fprintf (file
, _(" psect offset: %u\n"),
5960 (unsigned)bfd_getl32 (esdfv
->value
));
5961 fprintf (file
, _(" psect index : %u\n"),
5962 (unsigned)bfd_getl32 (esdfv
->psindx
));
5963 fprintf (file
, _(" name : %.*s\n"),
5964 esdfv
->namlng
, esdfv
->name
);
5969 struct vms_esdfm
*esdfm
= (struct vms_esdfm
*)e
;
5970 unsigned int flags
= bfd_getl16 (esdfm
->flags
);
5972 fprintf (file
, _("SYMM - Global symbol definition with version\n"));
5973 fprintf (file
, _(" flags: 0x%04x"), flags
);
5974 exav_bfd_print_egsy_flags (flags
, file
);
5976 fprintf (file
, _(" version mask: 0x%08x\n"),
5977 (unsigned)bfd_getl32 (esdfm
->version_mask
));
5978 fprintf (file
, _(" psect offset: %u\n"),
5979 (unsigned)bfd_getl32 (esdfm
->value
));
5980 fprintf (file
, _(" psect index : %u\n"),
5981 (unsigned)bfd_getl32 (esdfm
->psindx
));
5982 fprintf (file
, _(" name : %.*s\n"),
5983 esdfm
->namlng
, esdfm
->name
);
5987 fprintf (file
, _("unhandled egsd entry type %u\n"), type
);
5995 evax_bfd_print_hex (FILE *file
, const char *pfx
,
5996 const unsigned char *buf
, unsigned int len
)
6002 for (i
= 0; i
< len
; i
++)
6006 fprintf (file
, " %02x", buf
[i
]);
6019 evax_bfd_print_etir_stc_ir (FILE *file
, const unsigned char *buf
, int is_ps
)
6021 fprintf (file
, _(" linkage index: %u, replacement insn: 0x%08x\n"),
6022 (unsigned)bfd_getl32 (buf
),
6023 (unsigned)bfd_getl32 (buf
+ 16));
6024 fprintf (file
, _(" psect idx 1: %u, offset 1: 0x%08x %08x\n"),
6025 (unsigned)bfd_getl32 (buf
+ 4),
6026 (unsigned)bfd_getl32 (buf
+ 12),
6027 (unsigned)bfd_getl32 (buf
+ 8));
6028 fprintf (file
, _(" psect idx 2: %u, offset 2: 0x%08x %08x\n"),
6029 (unsigned)bfd_getl32 (buf
+ 20),
6030 (unsigned)bfd_getl32 (buf
+ 28),
6031 (unsigned)bfd_getl32 (buf
+ 24));
6033 fprintf (file
, _(" psect idx 3: %u, offset 3: 0x%08x %08x\n"),
6034 (unsigned)bfd_getl32 (buf
+ 32),
6035 (unsigned)bfd_getl32 (buf
+ 40),
6036 (unsigned)bfd_getl32 (buf
+ 36));
6038 fprintf (file
, _(" global name: %.*s\n"), buf
[32], buf
+ 33);
6042 evax_bfd_print_etir (FILE *file
, const char *name
,
6043 unsigned char *rec
, unsigned int rec_len
)
6045 unsigned int off
= sizeof (struct vms_egsd
);
6046 unsigned int sec_len
= 0;
6048 fprintf (file
, _(" %s (len=%u+%u):\n"), name
,
6049 (unsigned)(rec_len
- sizeof (struct vms_eobjrec
)),
6050 (unsigned)sizeof (struct vms_eobjrec
));
6052 for (off
= sizeof (struct vms_eobjrec
); off
< rec_len
; )
6054 struct vms_etir
*etir
= (struct vms_etir
*)(rec
+ off
);
6059 type
= bfd_getl16 (etir
->rectyp
);
6060 size
= bfd_getl16 (etir
->size
);
6061 buf
= rec
+ off
+ sizeof (struct vms_etir
);
6063 fprintf (file
, _(" (type: %3u, size: 4+%3u): "), type
, size
- 4);
6066 case ETIR__C_STA_GBL
:
6067 fprintf (file
, _("STA_GBL (stack global) %.*s\n"),
6070 case ETIR__C_STA_LW
:
6071 fprintf (file
, _("STA_LW (stack longword) 0x%08x\n"),
6072 (unsigned)bfd_getl32 (buf
));
6074 case ETIR__C_STA_QW
:
6075 fprintf (file
, _("STA_QW (stack quadword) 0x%08x %08x\n"),
6076 (unsigned)bfd_getl32 (buf
+ 4),
6077 (unsigned)bfd_getl32 (buf
+ 0));
6079 case ETIR__C_STA_PQ
:
6080 fprintf (file
, _("STA_PQ (stack psect base + offset)\n"));
6081 fprintf (file
, _(" psect: %u, offset: 0x%08x %08x\n"),
6082 (unsigned)bfd_getl32 (buf
+ 0),
6083 (unsigned)bfd_getl32 (buf
+ 8),
6084 (unsigned)bfd_getl32 (buf
+ 4));
6086 case ETIR__C_STA_LI
:
6087 fprintf (file
, _("STA_LI (stack literal)\n"));
6089 case ETIR__C_STA_MOD
:
6090 fprintf (file
, _("STA_MOD (stack module)\n"));
6092 case ETIR__C_STA_CKARG
:
6093 fprintf (file
, _("STA_CKARG (compare procedure argument)\n"));
6097 fprintf (file
, _("STO_B (store byte)\n"));
6100 fprintf (file
, _("STO_W (store word)\n"));
6102 case ETIR__C_STO_LW
:
6103 fprintf (file
, _("STO_LW (store longword)\n"));
6105 case ETIR__C_STO_QW
:
6106 fprintf (file
, _("STO_QW (store quadword)\n"));
6108 case ETIR__C_STO_IMMR
:
6110 unsigned int len
= bfd_getl32 (buf
);
6112 _("STO_IMMR (store immediate repeat) %u bytes\n"),
6114 evax_bfd_print_hex (file
, " ", buf
+ 4, len
);
6118 case ETIR__C_STO_GBL
:
6119 fprintf (file
, _("STO_GBL (store global) %.*s\n"),
6122 case ETIR__C_STO_CA
:
6123 fprintf (file
, _("STO_CA (store code address) %.*s\n"),
6126 case ETIR__C_STO_RB
:
6127 fprintf (file
, _("STO_RB (store relative branch)\n"));
6129 case ETIR__C_STO_AB
:
6130 fprintf (file
, _("STO_AB (store absolute branch)\n"));
6132 case ETIR__C_STO_OFF
:
6133 fprintf (file
, _("STO_OFF (store offset to psect)\n"));
6135 case ETIR__C_STO_IMM
:
6137 unsigned int len
= bfd_getl32 (buf
);
6139 _("STO_IMM (store immediate) %u bytes\n"),
6141 evax_bfd_print_hex (file
, " ", buf
+ 4, len
);
6145 case ETIR__C_STO_GBL_LW
:
6146 fprintf (file
, _("STO_GBL_LW (store global longword) %.*s\n"),
6149 case ETIR__C_STO_LP_PSB
:
6150 fprintf (file
, _("STO_OFF (store LP with procedure signature)\n"));
6152 case ETIR__C_STO_HINT_GBL
:
6153 fprintf (file
, _("STO_BR_GBL (store branch global) *todo*\n"));
6155 case ETIR__C_STO_HINT_PS
:
6156 fprintf (file
, _("STO_BR_PS (store branch psect + offset) *todo*\n"));
6159 case ETIR__C_OPR_NOP
:
6160 fprintf (file
, _("OPR_NOP (no-operation)\n"));
6162 case ETIR__C_OPR_ADD
:
6163 fprintf (file
, _("OPR_ADD (add)\n"));
6165 case ETIR__C_OPR_SUB
:
6166 fprintf (file
, _("OPR_SUB (substract)\n"));
6168 case ETIR__C_OPR_MUL
:
6169 fprintf (file
, _("OPR_MUL (multiply)\n"));
6171 case ETIR__C_OPR_DIV
:
6172 fprintf (file
, _("OPR_DIV (divide)\n"));
6174 case ETIR__C_OPR_AND
:
6175 fprintf (file
, _("OPR_AND (logical and)\n"));
6177 case ETIR__C_OPR_IOR
:
6178 fprintf (file
, _("OPR_IOR (logical inclusive or)\n"));
6180 case ETIR__C_OPR_EOR
:
6181 fprintf (file
, _("OPR_EOR (logical exclusive or)\n"));
6183 case ETIR__C_OPR_NEG
:
6184 fprintf (file
, _("OPR_NEG (negate)\n"));
6186 case ETIR__C_OPR_COM
:
6187 fprintf (file
, _("OPR_COM (complement)\n"));
6189 case ETIR__C_OPR_INSV
:
6190 fprintf (file
, _("OPR_INSV (insert field)\n"));
6192 case ETIR__C_OPR_ASH
:
6193 fprintf (file
, _("OPR_ASH (arithmetic shift)\n"));
6195 case ETIR__C_OPR_USH
:
6196 fprintf (file
, _("OPR_USH (unsigned shift)\n"));
6198 case ETIR__C_OPR_ROT
:
6199 fprintf (file
, _("OPR_ROT (rotate)\n"));
6201 case ETIR__C_OPR_SEL
:
6202 fprintf (file
, _("OPR_SEL (select)\n"));
6204 case ETIR__C_OPR_REDEF
:
6205 fprintf (file
, _("OPR_REDEF (redefine symbol to curr location)\n"));
6207 case ETIR__C_OPR_DFLIT
:
6208 fprintf (file
, _("OPR_REDEF (define a literal)\n"));
6211 case ETIR__C_STC_LP
:
6212 fprintf (file
, _("STC_LP (store cond linkage pair)\n"));
6214 case ETIR__C_STC_LP_PSB
:
6216 _("STC_LP_PSB (store cond linkage pair + signature)\n"));
6217 fprintf (file
, _(" linkage index: %u, procedure: %.*s\n"),
6218 (unsigned)bfd_getl32 (buf
), buf
[4], buf
+ 5);
6219 buf
+= 4 + 1 + buf
[4];
6220 fprintf (file
, _(" signature: %.*s\n"), buf
[0], buf
+ 1);
6222 case ETIR__C_STC_GBL
:
6223 fprintf (file
, _("STC_GBL (store cond global)\n"));
6224 fprintf (file
, _(" linkage index: %u, global: %.*s\n"),
6225 (unsigned)bfd_getl32 (buf
), buf
[4], buf
+ 5);
6227 case ETIR__C_STC_GCA
:
6228 fprintf (file
, _("STC_GCA (store cond code address)\n"));
6229 fprintf (file
, _(" linkage index: %u, procedure name: %.*s\n"),
6230 (unsigned)bfd_getl32 (buf
), buf
[4], buf
+ 5);
6232 case ETIR__C_STC_PS
:
6233 fprintf (file
, _("STC_PS (store cond psect + offset)\n"));
6235 _(" linkage index: %u, psect: %u, offset: 0x%08x %08x\n"),
6236 (unsigned)bfd_getl32 (buf
),
6237 (unsigned)bfd_getl32 (buf
+ 4),
6238 (unsigned)bfd_getl32 (buf
+ 12),
6239 (unsigned)bfd_getl32 (buf
+ 8));
6241 case ETIR__C_STC_NOP_GBL
:
6242 fprintf (file
, _("STC_NOP_GBL (store cond NOP at global addr)\n"));
6243 evax_bfd_print_etir_stc_ir (file
, buf
, 0);
6245 case ETIR__C_STC_NOP_PS
:
6246 fprintf (file
, _("STC_NOP_PS (store cond NOP at psect + offset)\n"));
6247 evax_bfd_print_etir_stc_ir (file
, buf
, 1);
6249 case ETIR__C_STC_BSR_GBL
:
6250 fprintf (file
, _("STC_BSR_GBL (store cond BSR at global addr)\n"));
6251 evax_bfd_print_etir_stc_ir (file
, buf
, 0);
6253 case ETIR__C_STC_BSR_PS
:
6254 fprintf (file
, _("STC_BSR_PS (store cond BSR at psect + offset)\n"));
6255 evax_bfd_print_etir_stc_ir (file
, buf
, 1);
6257 case ETIR__C_STC_LDA_GBL
:
6258 fprintf (file
, _("STC_LDA_GBL (store cond LDA at global addr)\n"));
6259 evax_bfd_print_etir_stc_ir (file
, buf
, 0);
6261 case ETIR__C_STC_LDA_PS
:
6262 fprintf (file
, _("STC_LDA_PS (store cond LDA at psect + offset)\n"));
6263 evax_bfd_print_etir_stc_ir (file
, buf
, 1);
6265 case ETIR__C_STC_BOH_GBL
:
6266 fprintf (file
, _("STC_BOH_GBL (store cond BOH at global addr)\n"));
6267 evax_bfd_print_etir_stc_ir (file
, buf
, 0);
6269 case ETIR__C_STC_BOH_PS
:
6270 fprintf (file
, _("STC_BOH_PS (store cond BOH at psect + offset)\n"));
6271 evax_bfd_print_etir_stc_ir (file
, buf
, 1);
6273 case ETIR__C_STC_NBH_GBL
:
6275 _("STC_NBH_GBL (store cond or hint at global addr)\n"));
6277 case ETIR__C_STC_NBH_PS
:
6279 _("STC_NBH_PS (store cond or hint at psect + offset)\n"));
6282 case ETIR__C_CTL_SETRB
:
6283 fprintf (file
, _("CTL_SETRB (set relocation base)\n"));
6286 case ETIR__C_CTL_AUGRB
:
6288 unsigned int val
= bfd_getl32 (buf
);
6289 fprintf (file
, _("CTL_AUGRB (augment relocation base) %u\n"), val
);
6292 case ETIR__C_CTL_DFLOC
:
6293 fprintf (file
, _("CTL_DFLOC (define location)\n"));
6295 case ETIR__C_CTL_STLOC
:
6296 fprintf (file
, _("CTL_STLOC (set location)\n"));
6298 case ETIR__C_CTL_STKDL
:
6299 fprintf (file
, _("CTL_STKDL (stack defined location)\n"));
6302 fprintf (file
, _("*unhandled*\n"));
6310 evax_bfd_print_eobj (struct bfd
*abfd
, FILE *file
)
6312 bfd_boolean is_first
= TRUE
;
6313 bfd_boolean has_records
= FALSE
;
6317 unsigned int rec_len
;
6318 unsigned int pad_len
;
6320 unsigned int hdr_size
;
6325 unsigned char buf
[6];
6330 if (bfd_bread (buf
, sizeof (buf
), abfd
) != sizeof (buf
))
6332 fprintf (file
, _("cannot read GST record length\n"));
6335 rec_len
= bfd_getl16 (buf
+ 0);
6336 if (rec_len
== bfd_getl16 (buf
+ 4)
6337 && bfd_getl16 (buf
+ 2) == EOBJ__C_EMH
)
6339 /* The format is raw: record-size, type, record-size. */
6341 pad_len
= (rec_len
+ 1) & ~1U;
6344 else if (rec_len
== EOBJ__C_EMH
)
6346 has_records
= FALSE
;
6347 pad_len
= bfd_getl16 (buf
+ 2);
6353 fprintf (file
, _("cannot find EMH in first GST record\n"));
6356 rec
= bfd_malloc (pad_len
);
6357 memcpy (rec
, buf
+ sizeof (buf
) - hdr_size
, hdr_size
);
6361 unsigned int rec_len2
= 0;
6362 unsigned char hdr
[4];
6366 unsigned char buf_len
[2];
6368 if (bfd_bread (buf_len
, sizeof (buf_len
), abfd
)
6369 != sizeof (buf_len
))
6371 fprintf (file
, _("cannot read GST record length\n"));
6374 rec_len2
= (unsigned)bfd_getl16 (buf_len
);
6377 if (bfd_bread (hdr
, sizeof (hdr
), abfd
) != sizeof (hdr
))
6379 fprintf (file
, _("cannot read GST record header\n"));
6382 rec_len
= (unsigned)bfd_getl16 (hdr
+ 2);
6384 pad_len
= (rec_len
+ 1) & ~1U;
6387 rec
= bfd_malloc (pad_len
);
6388 memcpy (rec
, hdr
, sizeof (hdr
));
6389 hdr_size
= sizeof (hdr
);
6390 if (has_records
&& rec_len2
!= rec_len
)
6392 fprintf (file
, _(" corrupted GST\n"));
6397 if (bfd_bread (rec
+ hdr_size
, pad_len
- hdr_size
, abfd
)
6398 != pad_len
- hdr_size
)
6400 fprintf (file
, _("cannot read GST record\n"));
6404 type
= (unsigned)bfd_getl16 (rec
);
6409 evax_bfd_print_emh (file
, rec
, rec_len
);
6412 evax_bfd_print_egsd (file
, rec
, rec_len
);
6415 evax_bfd_print_eeom (file
, rec
, rec_len
);
6420 evax_bfd_print_etir (file
, "ETIR", rec
, rec_len
);
6423 evax_bfd_print_etir (file
, "EDBG", rec
, rec_len
);
6426 evax_bfd_print_etir (file
, "ETBT", rec
, rec_len
);
6429 fprintf (file
, _(" unhandled EOBJ record type %u\n"), type
);
6437 evax_bfd_print_relocation_records (FILE *file
, const unsigned char *rel
,
6438 unsigned int stride
)
6446 count
= bfd_getl32 (rel
+ 0);
6450 base
= bfd_getl32 (rel
+ 4);
6452 fprintf (file
, _(" bitcount: %u, base addr: 0x%08x\n"),
6456 for (j
= 0; count
> 0; j
+= 4, count
-= 32)
6462 val
= bfd_getl32 (rel
);
6465 fprintf (file
, _(" bitmap: 0x%08x (count: %u):\n"), val
, count
);
6467 for (k
= 0; k
< 32; k
++)
6472 fprintf (file
, _(" %08x"), base
+ (j
* 8 + k
) * stride
);
6487 evax_bfd_print_address_fixups (FILE *file
, const unsigned char *rel
)
6494 count
= bfd_getl32 (rel
+ 0);
6497 fprintf (file
, _(" image %u (%u entries)\n"),
6498 (unsigned)bfd_getl32 (rel
+ 4), count
);
6500 for (j
= 0; j
< count
; j
++)
6502 fprintf (file
, _(" offset: 0x%08x, val: 0x%08x\n"),
6503 (unsigned)bfd_getl32 (rel
+ 0),
6504 (unsigned)bfd_getl32 (rel
+ 4));
6511 evax_bfd_print_reference_fixups (FILE *file
, const unsigned char *rel
)
6520 count
= bfd_getl32 (rel
+ 0);
6523 fprintf (file
, _(" image %u (%u entries), offsets:\n"),
6524 (unsigned)bfd_getl32 (rel
+ 4), count
);
6526 for (j
= 0; j
< count
; j
++)
6530 fprintf (file
, _(" 0x%08x"), (unsigned)bfd_getl32 (rel
));
6545 evax_bfd_print_indent (int indent
, FILE *file
)
6547 for (; indent
; indent
--)
6552 evax_bfd_get_dsc_name (unsigned int v
)
6556 case DSC__K_DTYPE_Z
:
6557 return "Z (Unspecified)";
6558 case DSC__K_DTYPE_V
:
6560 case DSC__K_DTYPE_BU
:
6561 return "BU (Byte logical)";
6562 case DSC__K_DTYPE_WU
:
6563 return "WU (Word logical)";
6564 case DSC__K_DTYPE_LU
:
6565 return "LU (Longword logical)";
6566 case DSC__K_DTYPE_QU
:
6567 return "QU (Quadword logical)";
6568 case DSC__K_DTYPE_B
:
6569 return "B (Byte integer)";
6570 case DSC__K_DTYPE_W
:
6571 return "W (Word integer)";
6572 case DSC__K_DTYPE_L
:
6573 return "L (Longword integer)";
6574 case DSC__K_DTYPE_Q
:
6575 return "Q (Quadword integer)";
6576 case DSC__K_DTYPE_F
:
6577 return "F (Single-precision floating)";
6578 case DSC__K_DTYPE_D
:
6579 return "D (Double-precision floating)";
6580 case DSC__K_DTYPE_FC
:
6581 return "FC (Complex)";
6582 case DSC__K_DTYPE_DC
:
6583 return "DC (Double-precision Complex)";
6584 case DSC__K_DTYPE_T
:
6585 return "T (ASCII text string)";
6586 case DSC__K_DTYPE_NU
:
6587 return "NU (Numeric string, unsigned)";
6588 case DSC__K_DTYPE_NL
:
6589 return "NL (Numeric string, left separate sign)";
6590 case DSC__K_DTYPE_NLO
:
6591 return "NLO (Numeric string, left overpunched sign)";
6592 case DSC__K_DTYPE_NR
:
6593 return "NR (Numeric string, right separate sign)";
6594 case DSC__K_DTYPE_NRO
:
6595 return "NRO (Numeric string, right overpunched sig)";
6596 case DSC__K_DTYPE_NZ
:
6597 return "NZ (Numeric string, zoned sign)";
6598 case DSC__K_DTYPE_P
:
6599 return "P (Packed decimal string)";
6600 case DSC__K_DTYPE_ZI
:
6601 return "ZI (Sequence of instructions)";
6602 case DSC__K_DTYPE_ZEM
:
6603 return "ZEM (Procedure entry mask)";
6604 case DSC__K_DTYPE_DSC
:
6605 return "DSC (Descriptor, used for arrays of dyn strings)";
6606 case DSC__K_DTYPE_OU
:
6607 return "OU (Octaword logical)";
6608 case DSC__K_DTYPE_O
:
6609 return "O (Octaword integer)";
6610 case DSC__K_DTYPE_G
:
6611 return "G (Double precision G floating, 64 bit)";
6612 case DSC__K_DTYPE_H
:
6613 return "H (Quadruple precision floating, 128 bit)";
6614 case DSC__K_DTYPE_GC
:
6615 return "GC (Double precision complex, G floating)";
6616 case DSC__K_DTYPE_HC
:
6617 return "HC (Quadruple precision complex, H floating)";
6618 case DSC__K_DTYPE_CIT
:
6619 return "CIT (COBOL intermediate temporary)";
6620 case DSC__K_DTYPE_BPV
:
6621 return "BPV (Bound Procedure Value)";
6622 case DSC__K_DTYPE_BLV
:
6623 return "BLV (Bound Label Value)";
6624 case DSC__K_DTYPE_VU
:
6625 return "VU (Bit Unaligned)";
6626 case DSC__K_DTYPE_ADT
:
6627 return "ADT (Absolute Date-Time)";
6628 case DSC__K_DTYPE_VT
:
6629 return "VT (Varying Text)";
6630 case DSC__K_DTYPE_T2
:
6631 return "T2 (16-bit char)";
6632 case DSC__K_DTYPE_VT2
:
6633 return "VT2 (16-bit varying char)";
6635 return "?? (unknown)";
6640 evax_bfd_print_desc (const unsigned char *buf
, int indent
, FILE *file
)
6642 unsigned char bclass
= buf
[3];
6643 unsigned char dtype
= buf
[2];
6644 unsigned int len
= (unsigned)bfd_getl16 (buf
);
6645 unsigned int pointer
= (unsigned)bfd_getl32 (buf
+ 4);
6647 evax_bfd_print_indent (indent
, file
);
6649 if (len
== 1 && pointer
== 0xffffffffUL
)
6652 fprintf (file
, _("64 bits *unhandled*\n"));
6656 fprintf (file
, _("class: %u, dtype: %u, length: %u, pointer: 0x%08x\n"),
6657 bclass
, dtype
, len
, pointer
);
6660 case DSC__K_CLASS_NCA
:
6662 const struct vms_dsc_nca
*dsc
= (const void *)buf
;
6664 const unsigned char *b
;
6666 evax_bfd_print_indent (indent
, file
);
6667 fprintf (file
, _("non-contiguous array of %s\n"),
6668 evax_bfd_get_dsc_name (dsc
->dtype
));
6669 evax_bfd_print_indent (indent
+ 1, file
);
6671 _("dimct: %u, aflags: 0x%02x, digits: %u, scale: %u\n"),
6672 dsc
->dimct
, dsc
->aflags
, dsc
->digits
, dsc
->scale
);
6673 evax_bfd_print_indent (indent
+ 1, file
);
6675 _("arsize: %u, a0: 0x%08x\n"),
6676 (unsigned)bfd_getl32 (dsc
->arsize
),
6677 (unsigned)bfd_getl32 (dsc
->a0
));
6678 evax_bfd_print_indent (indent
+ 1, file
);
6679 fprintf (file
, _("Strides:\n"));
6680 b
= buf
+ sizeof (*dsc
);
6681 for (i
= 0; i
< dsc
->dimct
; i
++)
6683 evax_bfd_print_indent (indent
+ 2, file
);
6684 fprintf (file
, _("[%u]: %u\n"), i
+ 1,
6685 (unsigned)bfd_getl32 (b
));
6688 evax_bfd_print_indent (indent
+ 1, file
);
6689 fprintf (file
, _("Bounds:\n"));
6690 b
= buf
+ sizeof (*dsc
);
6691 for (i
= 0; i
< dsc
->dimct
; i
++)
6693 evax_bfd_print_indent (indent
+ 2, file
);
6694 fprintf (file
, _("[%u]: Lower: %u, upper: %u\n"), i
+ 1,
6695 (unsigned)bfd_getl32 (b
+ 0),
6696 (unsigned)bfd_getl32 (b
+ 4));
6701 case DSC__K_CLASS_UBS
:
6703 const struct vms_dsc_ubs
*ubs
= (const void *)buf
;
6705 evax_bfd_print_indent (indent
, file
);
6706 fprintf (file
, _("unaligned bit-string of %s\n"),
6707 evax_bfd_get_dsc_name (ubs
->dtype
));
6708 evax_bfd_print_indent (indent
+ 1, file
);
6710 _("base: %u, pos: %u\n"),
6711 (unsigned)bfd_getl32 (ubs
->base
),
6712 (unsigned)bfd_getl32 (ubs
->pos
));
6716 fprintf (file
, _("*unhandled*\n"));
6723 evax_bfd_print_valspec (const unsigned char *buf
, int indent
, FILE *file
)
6725 unsigned int vflags
= buf
[0];
6726 unsigned int value
= (unsigned)bfd_getl32 (buf
+ 1);
6727 unsigned int len
= 5;
6729 evax_bfd_print_indent (indent
, file
);
6730 fprintf (file
, _("vflags: 0x%02x, value: 0x%08x "), vflags
, value
);
6735 case DST__K_VFLAGS_NOVAL
:
6736 fprintf (file
, _("(no value)\n"));
6738 case DST__K_VFLAGS_NOTACTIVE
:
6739 fprintf (file
, _("(not active)\n"));
6741 case DST__K_VFLAGS_UNALLOC
:
6742 fprintf (file
, _("(not allocated)\n"));
6744 case DST__K_VFLAGS_DSC
:
6745 fprintf (file
, _("(descriptor)\n"));
6746 evax_bfd_print_desc (buf
+ value
, indent
+ 1, file
);
6748 case DST__K_VFLAGS_TVS
:
6749 fprintf (file
, _("(trailing value)\n"));
6751 case DST__K_VS_FOLLOWS
:
6752 fprintf (file
, _("(value spec follows)\n"));
6754 case DST__K_VFLAGS_BITOFFS
:
6755 fprintf (file
, _("(at bit offset %u)\n"), value
);
6758 fprintf (file
, _("(reg: %u, disp: %u, indir: %u, kind: "),
6759 (vflags
& DST__K_REGNUM_MASK
) >> DST__K_REGNUM_SHIFT
,
6760 vflags
& DST__K_DISP
? 1 : 0,
6761 vflags
& DST__K_INDIR
? 1 : 0);
6762 switch (vflags
& DST__K_VALKIND_MASK
)
6764 case DST__K_VALKIND_LITERAL
:
6765 fputs (_("literal"), file
);
6767 case DST__K_VALKIND_ADDR
:
6768 fputs (_("address"), file
);
6770 case DST__K_VALKIND_DESC
:
6771 fputs (_("desc"), file
);
6773 case DST__K_VALKIND_REG
:
6774 fputs (_("reg"), file
);
6777 fputs (")\n", file
);
6784 evax_bfd_print_typspec (const unsigned char *buf
, int indent
, FILE *file
)
6786 unsigned char kind
= buf
[2];
6787 unsigned int len
= (unsigned)bfd_getl16 (buf
);
6789 evax_bfd_print_indent (indent
, file
);
6790 fprintf (file
, ("len: %2u, kind: %2u "), len
, kind
);
6794 case DST__K_TS_ATOM
:
6795 fprintf (file
, ("atomic, type=0x%02x %s\n"),
6796 buf
[0], evax_bfd_get_dsc_name (buf
[0]));
6799 fprintf (file
, ("indirect, defined at 0x%08x\n"),
6800 (unsigned)bfd_getl32 (buf
));
6802 case DST__K_TS_TPTR
:
6803 fprintf (file
, ("typed pointer\n"));
6804 evax_bfd_print_typspec (buf
, indent
+ 1, file
);
6807 fprintf (file
, ("pointer\n"));
6809 case DST__K_TS_ARRAY
:
6811 const unsigned char *vs
;
6812 unsigned int vec_len
;
6815 fprintf (file
, ("array, dim: %u, bitmap: "), buf
[0]);
6816 vec_len
= (buf
[0] + 1 + 7) / 8;
6817 for (i
= 0; i
< vec_len
; i
++)
6818 fprintf (file
, " %02x", buf
[i
+ 1]);
6820 vs
= buf
+ 1 + vec_len
;
6821 evax_bfd_print_indent (indent
, file
);
6822 fprintf (file
, ("array descriptor:\n"));
6823 vs
+= evax_bfd_print_valspec (vs
, indent
+ 1, file
);
6824 for (i
= 0; i
< buf
[0] + 1U; i
++)
6825 if (buf
[1 + i
/ 8] & (1 << (i
% 8)))
6827 evax_bfd_print_indent (indent
, file
);
6829 fprintf (file
, ("type spec for element:\n"));
6831 fprintf (file
, ("type spec for subscript %u:\n"), i
);
6832 evax_bfd_print_typspec (vs
, indent
+ 1, file
);
6833 vs
+= bfd_getl16 (vs
);
6838 fprintf (file
, ("*unhandled*\n"));
6843 evax_bfd_print_dst (struct bfd
*abfd
, unsigned int dst_size
, FILE *file
)
6845 unsigned int off
= 0;
6846 unsigned int pc
= 0;
6847 unsigned int line
= 0;
6849 fprintf (file
, _("Debug symbol table:\n"));
6851 while (dst_size
> 0)
6853 struct vms_dst_header dsth
;
6858 if (bfd_bread (&dsth
, sizeof (dsth
), abfd
) != sizeof (dsth
))
6860 fprintf (file
, _("cannot read DST header\n"));
6863 len
= bfd_getl16 (dsth
.length
);
6864 type
= bfd_getl16 (dsth
.type
);
6865 fprintf (file
, _(" type: %3u, len: %3u (at 0x%08x): "),
6875 len
-= sizeof (dsth
);
6876 buf
= bfd_malloc (len
);
6877 if (bfd_bread (buf
, len
, abfd
) != len
)
6879 fprintf (file
, _("cannot read DST symbol\n"));
6884 case DSC__K_DTYPE_V
:
6885 case DSC__K_DTYPE_BU
:
6886 case DSC__K_DTYPE_WU
:
6887 case DSC__K_DTYPE_LU
:
6888 case DSC__K_DTYPE_QU
:
6889 case DSC__K_DTYPE_B
:
6890 case DSC__K_DTYPE_W
:
6891 case DSC__K_DTYPE_L
:
6892 case DSC__K_DTYPE_Q
:
6893 case DSC__K_DTYPE_F
:
6894 case DSC__K_DTYPE_D
:
6895 case DSC__K_DTYPE_FC
:
6896 case DSC__K_DTYPE_DC
:
6897 case DSC__K_DTYPE_T
:
6898 case DSC__K_DTYPE_NU
:
6899 case DSC__K_DTYPE_NL
:
6900 case DSC__K_DTYPE_NLO
:
6901 case DSC__K_DTYPE_NR
:
6902 case DSC__K_DTYPE_NRO
:
6903 case DSC__K_DTYPE_NZ
:
6904 case DSC__K_DTYPE_P
:
6905 case DSC__K_DTYPE_ZI
:
6906 case DSC__K_DTYPE_ZEM
:
6907 case DSC__K_DTYPE_DSC
:
6908 case DSC__K_DTYPE_OU
:
6909 case DSC__K_DTYPE_O
:
6910 case DSC__K_DTYPE_G
:
6911 case DSC__K_DTYPE_H
:
6912 case DSC__K_DTYPE_GC
:
6913 case DSC__K_DTYPE_HC
:
6914 case DSC__K_DTYPE_CIT
:
6915 case DSC__K_DTYPE_BPV
:
6916 case DSC__K_DTYPE_BLV
:
6917 case DSC__K_DTYPE_VU
:
6918 case DSC__K_DTYPE_ADT
:
6919 case DSC__K_DTYPE_VT
:
6920 case DSC__K_DTYPE_T2
:
6921 case DSC__K_DTYPE_VT2
:
6922 fprintf (file
, _("standard data: %s\n"),
6923 evax_bfd_get_dsc_name (type
));
6924 evax_bfd_print_valspec (buf
, 4, file
);
6925 fprintf (file
, _(" name: %.*s\n"), buf
[5], buf
+ 6);
6929 struct vms_dst_modbeg
*dst
= (void *)buf
;
6930 const char *name
= (const char *)buf
+ sizeof (*dst
);
6932 fprintf (file
, _("modbeg\n"));
6933 fprintf (file
, _(" flags: %d, language: %u, "
6934 "major: %u, minor: %u\n"),
6936 (unsigned)bfd_getl32 (dst
->language
),
6937 (unsigned)bfd_getl16 (dst
->major
),
6938 (unsigned)bfd_getl16 (dst
->minor
));
6939 fprintf (file
, _(" module name: %.*s\n"),
6941 name
+= name
[0] + 1;
6942 fprintf (file
, _(" compiler : %.*s\n"),
6947 fprintf (file
, _("modend\n"));
6951 struct vms_dst_rtnbeg
*dst
= (void *)buf
;
6952 const char *name
= (const char *)buf
+ sizeof (*dst
);
6954 fputs (_("rtnbeg\n"), file
);
6955 fprintf (file
, _(" flags: %u, address: 0x%08x, "
6956 "pd-address: 0x%08x\n"),
6958 (unsigned)bfd_getl32 (dst
->address
),
6959 (unsigned)bfd_getl32 (dst
->pd_address
));
6960 fprintf (file
, _(" routine name: %.*s\n"),
6966 struct vms_dst_rtnend
*dst
= (void *)buf
;
6968 fprintf (file
, _("rtnend: size 0x%08x\n"),
6969 (unsigned)bfd_getl32 (dst
->size
));
6974 struct vms_dst_prolog
*dst
= (void *)buf
;
6976 fprintf (file
, _("prolog: bkpt address 0x%08x\n"),
6977 (unsigned)bfd_getl32 (dst
->bkpt_addr
));
6982 struct vms_dst_epilog
*dst
= (void *)buf
;
6984 fprintf (file
, _("epilog: flags: %u, count: %u\n"),
6985 dst
->flags
, (unsigned)bfd_getl32 (dst
->count
));
6990 struct vms_dst_blkbeg
*dst
= (void *)buf
;
6991 const char *name
= (const char *)buf
+ sizeof (*dst
);
6993 fprintf (file
, _("blkbeg: address: 0x%08x, name: %.*s\n"),
6994 (unsigned)bfd_getl32 (dst
->address
),
7000 struct vms_dst_blkend
*dst
= (void *)buf
;
7002 fprintf (file
, _("blkend: size: 0x%08x\n"),
7003 (unsigned)bfd_getl32 (dst
->size
));
7006 case DST__K_TYPSPEC
:
7008 fprintf (file
, _("typspec (len: %u)\n"), len
);
7009 fprintf (file
, _(" name: %.*s\n"), buf
[0], buf
+ 1);
7010 evax_bfd_print_typspec (buf
+ 1 + buf
[0], 5, file
);
7015 fprintf (file
, _("septyp, name: %.*s\n"), buf
[5], buf
+ 6);
7016 evax_bfd_print_valspec (buf
, 4, file
);
7021 struct vms_dst_recbeg
*recbeg
= (void *)buf
;
7022 const char *name
= (const char *)buf
+ sizeof (*recbeg
);
7024 fprintf (file
, _("recbeg: name: %.*s\n"), name
[0], name
+ 1);
7025 evax_bfd_print_valspec (buf
, 4, file
);
7026 fprintf (file
, (" len: %u bits\n"),
7027 (unsigned)bfd_getl32 (name
+ 1 + name
[0]));
7031 fprintf (file
, _("recend\n"));
7033 case DST__K_ENUMBEG
:
7034 fprintf (file
, _("enumbeg, len: %u, name: %.*s\n"),
7035 buf
[0], buf
[1], buf
+ 2);
7037 case DST__K_ENUMELT
:
7038 fprintf (file
, _("enumelt, name: %.*s\n"), buf
[5], buf
+ 6);
7039 evax_bfd_print_valspec (buf
, 4, file
);
7041 case DST__K_ENUMEND
:
7042 fprintf (file
, _("enumend\n"));
7046 struct vms_dst_label
*lab
= (void *)buf
;
7047 fprintf (file
, ("label, name: %.*s\n"),
7048 lab
->name
[0], lab
->name
+ 1);
7049 fprintf (file
, (" address: 0x%08x\n"),
7050 (unsigned)bfd_getl32 (lab
->value
));
7053 case DST__K_DIS_RANGE
:
7055 unsigned int cnt
= bfd_getl32 (buf
);
7056 unsigned char *rng
= buf
+ 4;
7059 fprintf (file
, _("discontiguous range (nbr: %u)\n"), cnt
);
7060 for (i
= 0; i
< cnt
; i
++, rng
+= 8)
7061 fprintf (file
, _(" address: 0x%08x, size: %u\n"),
7062 (unsigned)bfd_getl32 (rng
),
7063 (unsigned)bfd_getl32 (rng
+ 4));
7067 case DST__K_LINE_NUM
:
7069 unsigned char *buf_orig
= buf
;
7071 fprintf (file
, _("line num (len: %u)\n"), len
);
7076 unsigned char cmdlen
;
7086 case DST__K_DELTA_PC_W
:
7087 val
= bfd_getl16 (buf
+ 1);
7088 fprintf (file
, _("delta_pc_w %u\n"), val
);
7093 case DST__K_INCR_LINUM
:
7095 fprintf (file
, _("incr_linum(b): +%u\n"), val
);
7099 case DST__K_INCR_LINUM_W
:
7100 val
= bfd_getl16 (buf
+ 1);
7101 fprintf (file
, _("incr_linum_w: +%u\n"), val
);
7105 case DST__K_INCR_LINUM_L
:
7106 val
= bfd_getl32 (buf
+ 1);
7107 fprintf (file
, _("incr_linum_l: +%u\n"), val
);
7111 case DST__K_SET_LINUM
:
7112 line
= bfd_getl16 (buf
+ 1);
7113 fprintf (file
, _("set_line_num(w) %u\n"), line
);
7116 case DST__K_SET_LINUM_B
:
7118 fprintf (file
, _("set_line_num_b %u\n"), line
);
7121 case DST__K_SET_LINUM_L
:
7122 line
= bfd_getl32 (buf
+ 1);
7123 fprintf (file
, _("set_line_num_l %u\n"), line
);
7126 case DST__K_SET_ABS_PC
:
7127 pc
= bfd_getl32 (buf
+ 1);
7128 fprintf (file
, _("set_abs_pc: 0x%08x\n"), pc
);
7131 case DST__K_DELTA_PC_L
:
7132 fprintf (file
, _("delta_pc_l: +0x%08x\n"),
7133 (unsigned)bfd_getl32 (buf
+ 1));
7137 fprintf (file
, _("term(b): 0x%02x"), buf
[1]);
7139 fprintf (file
, _(" pc: 0x%08x\n"), pc
);
7143 val
= bfd_getl16 (buf
+ 1);
7144 fprintf (file
, _("term_w: 0x%04x"), val
);
7146 fprintf (file
, _(" pc: 0x%08x\n"), pc
);
7152 fprintf (file
, _("delta pc +%-4d"), -cmd
);
7153 line
++; /* FIXME: curr increment. */
7155 fprintf (file
, _(" pc: 0x%08x line: %5u\n"),
7160 fprintf (file
, _(" *unhandled* cmd %u\n"), cmd
);
7173 unsigned char *buf_orig
= buf
;
7175 fprintf (file
, _("source (len: %u)\n"), len
);
7179 signed char cmd
= buf
[0];
7180 unsigned char cmdlen
= 0;
7184 case DST__K_SRC_DECLFILE
:
7186 struct vms_dst_src_decl_src
*src
= (void *)(buf
+ 1);
7189 fprintf (file
, _(" declfile: len: %u, flags: %u, "
7191 src
->length
, src
->flags
,
7192 (unsigned)bfd_getl16 (src
->fileid
));
7193 fprintf (file
, _(" rms: cdt: 0x%08x %08x, "
7194 "ebk: 0x%08x, ffb: 0x%04x, "
7196 (unsigned)bfd_getl32 (src
->rms_cdt
+ 4),
7197 (unsigned)bfd_getl32 (src
->rms_cdt
+ 0),
7198 (unsigned)bfd_getl32 (src
->rms_ebk
),
7199 (unsigned)bfd_getl16 (src
->rms_ffb
),
7201 name
= (const char *)buf
+ 1 + sizeof (*src
);
7202 fprintf (file
, _(" filename : %.*s\n"),
7204 name
+= name
[0] + 1;
7205 fprintf (file
, _(" module name: %.*s\n"),
7207 cmdlen
= 2 + src
->length
;
7210 case DST__K_SRC_SETFILE
:
7211 fprintf (file
, _(" setfile %u\n"),
7212 (unsigned)bfd_getl16 (buf
+ 1));
7215 case DST__K_SRC_SETREC_W
:
7216 fprintf (file
, _(" setrec %u\n"),
7217 (unsigned)bfd_getl16 (buf
+ 1));
7220 case DST__K_SRC_SETREC_L
:
7221 fprintf (file
, _(" setrec %u\n"),
7222 (unsigned)bfd_getl32 (buf
+ 1));
7225 case DST__K_SRC_SETLNUM_W
:
7226 fprintf (file
, _(" setlnum %u\n"),
7227 (unsigned)bfd_getl16 (buf
+ 1));
7230 case DST__K_SRC_SETLNUM_L
:
7231 fprintf (file
, _(" setlnum %u\n"),
7232 (unsigned)bfd_getl32 (buf
+ 1));
7235 case DST__K_SRC_DEFLINES_W
:
7236 fprintf (file
, _(" deflines %u\n"),
7237 (unsigned)bfd_getl16 (buf
+ 1));
7240 case DST__K_SRC_DEFLINES_B
:
7241 fprintf (file
, _(" deflines %u\n"), buf
[1]);
7244 case DST__K_SRC_FORMFEED
:
7245 fprintf (file
, _(" formfeed\n"));
7249 fprintf (file
, _(" *unhandled* cmd %u\n"), cmd
);
7261 fprintf (file
, _("*unhandled* dst type %u\n"), type
);
7269 evax_bfd_print_image (bfd
*abfd
, FILE *file
)
7271 struct vms_eihd eihd
;
7274 unsigned int eiha_off
;
7275 unsigned int eihi_off
;
7276 unsigned int eihs_off
;
7277 unsigned int eisd_off
;
7278 unsigned int eihef_off
= 0;
7279 unsigned int eihnp_off
= 0;
7280 unsigned int dmt_vbn
= 0;
7281 unsigned int dmt_size
= 0;
7282 unsigned int dst_vbn
= 0;
7283 unsigned int dst_size
= 0;
7284 unsigned int gst_vbn
= 0;
7285 unsigned int gst_size
= 0;
7286 unsigned int eiaf_vbn
= 0;
7287 unsigned int eiaf_size
= 0;
7288 unsigned int eihvn_off
;
7290 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
)
7291 || bfd_bread (&eihd
, sizeof (eihd
), abfd
) != sizeof (eihd
))
7293 fprintf (file
, _("cannot read EIHD\n"));
7296 fprintf (file
, _("EIHD: (size: %u, nbr blocks: %u)\n"),
7297 (unsigned)bfd_getl32 (eihd
.size
),
7298 (unsigned)bfd_getl32 (eihd
.hdrblkcnt
));
7299 fprintf (file
, _(" majorid: %u, minorid: %u\n"),
7300 (unsigned)bfd_getl32 (eihd
.majorid
),
7301 (unsigned)bfd_getl32 (eihd
.minorid
));
7303 val
= (unsigned)bfd_getl32 (eihd
.imgtype
);
7307 name
= _("executable");
7310 name
= _("linkable image");
7313 name
= _("unknown");
7316 fprintf (file
, _(" image type: %u (%s)"), val
, name
);
7318 val
= (unsigned)bfd_getl32 (eihd
.subtype
);
7321 case EIHD__C_NATIVE
:
7328 name
= _("unknown");
7331 fprintf (file
, _(", subtype: %u (%s)\n"), val
, name
);
7333 eisd_off
= bfd_getl32 (eihd
.isdoff
);
7334 eiha_off
= bfd_getl32 (eihd
.activoff
);
7335 eihi_off
= bfd_getl32 (eihd
.imgidoff
);
7336 eihs_off
= bfd_getl32 (eihd
.symdbgoff
);
7337 fprintf (file
, _(" offsets: isd: %u, activ: %u, symdbg: %u, "
7338 "imgid: %u, patch: %u\n"),
7339 eisd_off
, eiha_off
, eihs_off
, eihi_off
,
7340 (unsigned)bfd_getl32 (eihd
.patchoff
));
7341 fprintf (file
, _(" fixup info rva: "));
7342 bfd_fprintf_vma (abfd
, file
, bfd_getl64 (eihd
.iafva
));
7343 fprintf (file
, _(", symbol vector rva: "));
7344 bfd_fprintf_vma (abfd
, file
, bfd_getl64 (eihd
.symvva
));
7345 eihvn_off
= bfd_getl32 (eihd
.version_array_off
);
7346 fprintf (file
, _("\n"
7347 " version array off: %u\n"),
7350 _(" img I/O count: %u, nbr channels: %u, req pri: %08x%08x\n"),
7351 (unsigned)bfd_getl32 (eihd
.imgiocnt
),
7352 (unsigned)bfd_getl32 (eihd
.iochancnt
),
7353 (unsigned)bfd_getl32 (eihd
.privreqs
+ 4),
7354 (unsigned)bfd_getl32 (eihd
.privreqs
+ 0));
7355 val
= (unsigned)bfd_getl32 (eihd
.lnkflags
);
7356 fprintf (file
, _(" linker flags: %08x:"), val
);
7357 if (val
& EIHD__M_LNKDEBUG
)
7358 fprintf (file
, " LNKDEBUG");
7359 if (val
& EIHD__M_LNKNOTFR
)
7360 fprintf (file
, " LNKNOTFR");
7361 if (val
& EIHD__M_NOP0BUFS
)
7362 fprintf (file
, " NOP0BUFS");
7363 if (val
& EIHD__M_PICIMG
)
7364 fprintf (file
, " PICIMG");
7365 if (val
& EIHD__M_P0IMAGE
)
7366 fprintf (file
, " P0IMAGE");
7367 if (val
& EIHD__M_DBGDMT
)
7368 fprintf (file
, " DBGDMT");
7369 if (val
& EIHD__M_INISHR
)
7370 fprintf (file
, " INISHR");
7371 if (val
& EIHD__M_XLATED
)
7372 fprintf (file
, " XLATED");
7373 if (val
& EIHD__M_BIND_CODE_SEC
)
7374 fprintf (file
, " BIND_CODE_SEC");
7375 if (val
& EIHD__M_BIND_DATA_SEC
)
7376 fprintf (file
, " BIND_DATA_SEC");
7377 if (val
& EIHD__M_MKTHREADS
)
7378 fprintf (file
, " MKTHREADS");
7379 if (val
& EIHD__M_UPCALLS
)
7380 fprintf (file
, " UPCALLS");
7381 if (val
& EIHD__M_OMV_READY
)
7382 fprintf (file
, " OMV_READY");
7383 if (val
& EIHD__M_EXT_BIND_SECT
)
7384 fprintf (file
, " EXT_BIND_SECT");
7385 fprintf (file
, "\n");
7386 fprintf (file
, _(" ident: 0x%08x, sysver: 0x%08x, "
7387 "match ctrl: %u, symvect_size: %u\n"),
7388 (unsigned)bfd_getl32 (eihd
.ident
),
7389 (unsigned)bfd_getl32 (eihd
.sysver
),
7391 (unsigned)bfd_getl32 (eihd
.symvect_size
));
7392 fprintf (file
, _(" BPAGE: %u"),
7393 (unsigned)bfd_getl32 (eihd
.virt_mem_block_size
));
7394 if (val
& (EIHD__M_OMV_READY
| EIHD__M_EXT_BIND_SECT
))
7396 eihef_off
= bfd_getl32 (eihd
.ext_fixup_off
);
7397 eihnp_off
= bfd_getl32 (eihd
.noopt_psect_off
);
7398 fprintf (file
, _(", ext fixup offset: %u, no_opt psect off: %u"),
7399 eihef_off
, eihnp_off
);
7401 fprintf (file
, _(", alias: %u\n"), (unsigned)bfd_getl16 (eihd
.alias
));
7405 struct vms_eihvn eihvn
;
7409 fprintf (file
, _("system version array information:\n"));
7410 if (bfd_seek (abfd
, (file_ptr
) eihvn_off
, SEEK_SET
)
7411 || bfd_bread (&eihvn
, sizeof (eihvn
), abfd
) != sizeof (eihvn
))
7413 fprintf (file
, _("cannot read EIHVN header\n"));
7416 mask
= bfd_getl32 (eihvn
.subsystem_mask
);
7417 for (j
= 0; j
< 32; j
++)
7418 if (mask
& (1 << j
))
7420 struct vms_eihvn_subversion ver
;
7421 if (bfd_bread (&ver
, sizeof (ver
), abfd
) != sizeof (ver
))
7423 fprintf (file
, _("cannot read EIHVN version\n"));
7426 fprintf (file
, _(" %02u "), j
);
7429 case EIHVN__BASE_IMAGE_BIT
:
7430 fputs (_("BASE_IMAGE "), file
);
7432 case EIHVN__MEMORY_MANAGEMENT_BIT
:
7433 fputs (_("MEMORY_MANAGEMENT"), file
);
7436 fputs (_("IO "), file
);
7438 case EIHVN__FILES_VOLUMES_BIT
:
7439 fputs (_("FILES_VOLUMES "), file
);
7441 case EIHVN__PROCESS_SCHED_BIT
:
7442 fputs (_("PROCESS_SCHED "), file
);
7444 case EIHVN__SYSGEN_BIT
:
7445 fputs (_("SYSGEN "), file
);
7447 case EIHVN__CLUSTERS_LOCKMGR_BIT
:
7448 fputs (_("CLUSTERS_LOCKMGR "), file
);
7450 case EIHVN__LOGICAL_NAMES_BIT
:
7451 fputs (_("LOGICAL_NAMES "), file
);
7453 case EIHVN__SECURITY_BIT
:
7454 fputs (_("SECURITY "), file
);
7456 case EIHVN__IMAGE_ACTIVATOR_BIT
:
7457 fputs (_("IMAGE_ACTIVATOR "), file
);
7459 case EIHVN__NETWORKS_BIT
:
7460 fputs (_("NETWORKS "), file
);
7462 case EIHVN__COUNTERS_BIT
:
7463 fputs (_("COUNTERS "), file
);
7465 case EIHVN__STABLE_BIT
:
7466 fputs (_("STABLE "), file
);
7468 case EIHVN__MISC_BIT
:
7469 fputs (_("MISC "), file
);
7471 case EIHVN__CPU_BIT
:
7472 fputs (_("CPU "), file
);
7474 case EIHVN__VOLATILE_BIT
:
7475 fputs (_("VOLATILE "), file
);
7477 case EIHVN__SHELL_BIT
:
7478 fputs (_("SHELL "), file
);
7480 case EIHVN__POSIX_BIT
:
7481 fputs (_("POSIX "), file
);
7483 case EIHVN__MULTI_PROCESSING_BIT
:
7484 fputs (_("MULTI_PROCESSING "), file
);
7486 case EIHVN__GALAXY_BIT
:
7487 fputs (_("GALAXY "), file
);
7490 fputs (_("*unknown* "), file
);
7493 fprintf (file
, _(": %u.%u\n"),
7494 (unsigned)bfd_getl16 (ver
.major
),
7495 (unsigned)bfd_getl16 (ver
.minor
));
7501 struct vms_eiha eiha
;
7503 if (bfd_seek (abfd
, (file_ptr
) eiha_off
, SEEK_SET
)
7504 || bfd_bread (&eiha
, sizeof (eiha
), abfd
) != sizeof (eiha
))
7506 fprintf (file
, _("cannot read EIHA\n"));
7509 fprintf (file
, _("Image activation: (size=%u)\n"),
7510 (unsigned)bfd_getl32 (eiha
.size
));
7511 fprintf (file
, _(" First address : 0x%08x 0x%08x\n"),
7512 (unsigned)bfd_getl32 (eiha
.tfradr1_h
),
7513 (unsigned)bfd_getl32 (eiha
.tfradr1
));
7514 fprintf (file
, _(" Second address: 0x%08x 0x%08x\n"),
7515 (unsigned)bfd_getl32 (eiha
.tfradr2_h
),
7516 (unsigned)bfd_getl32 (eiha
.tfradr2
));
7517 fprintf (file
, _(" Third address : 0x%08x 0x%08x\n"),
7518 (unsigned)bfd_getl32 (eiha
.tfradr3_h
),
7519 (unsigned)bfd_getl32 (eiha
.tfradr3
));
7520 fprintf (file
, _(" Fourth address: 0x%08x 0x%08x\n"),
7521 (unsigned)bfd_getl32 (eiha
.tfradr4_h
),
7522 (unsigned)bfd_getl32 (eiha
.tfradr4
));
7523 fprintf (file
, _(" Shared image : 0x%08x 0x%08x\n"),
7524 (unsigned)bfd_getl32 (eiha
.inishr_h
),
7525 (unsigned)bfd_getl32 (eiha
.inishr
));
7529 struct vms_eihi eihi
;
7531 if (bfd_seek (abfd
, (file_ptr
) eihi_off
, SEEK_SET
)
7532 || bfd_bread (&eihi
, sizeof (eihi
), abfd
) != sizeof (eihi
))
7534 fprintf (file
, _("cannot read EIHI\n"));
7537 fprintf (file
, _("Image identification: (major: %u, minor: %u)\n"),
7538 (unsigned)bfd_getl32 (eihi
.majorid
),
7539 (unsigned)bfd_getl32 (eihi
.minorid
));
7540 fprintf (file
, _(" image name : %.*s\n"),
7541 eihi
.imgnam
[0], eihi
.imgnam
+ 1);
7542 fprintf (file
, _(" link time : %s\n"),
7543 vms_time_to_str (eihi
.linktime
));
7544 fprintf (file
, _(" image ident : %.*s\n"),
7545 eihi
.imgid
[0], eihi
.imgid
+ 1);
7546 fprintf (file
, _(" linker ident : %.*s\n"),
7547 eihi
.linkid
[0], eihi
.linkid
+ 1);
7548 fprintf (file
, _(" image build ident: %.*s\n"),
7549 eihi
.imgbid
[0], eihi
.imgbid
+ 1);
7553 struct vms_eihs eihs
;
7555 if (bfd_seek (abfd
, (file_ptr
) eihs_off
, SEEK_SET
)
7556 || bfd_bread (&eihs
, sizeof (eihs
), abfd
) != sizeof (eihs
))
7558 fprintf (file
, _("cannot read EIHS\n"));
7561 fprintf (file
, _("Image symbol & debug table: (major: %u, minor: %u)\n"),
7562 (unsigned)bfd_getl32 (eihs
.majorid
),
7563 (unsigned)bfd_getl32 (eihs
.minorid
));
7564 dst_vbn
= bfd_getl32 (eihs
.dstvbn
);
7565 dst_size
= bfd_getl32 (eihs
.dstsize
);
7566 fprintf (file
, _(" debug symbol table : vbn: %u, size: %u (0x%x)\n"),
7567 dst_vbn
, dst_size
, dst_size
);
7568 gst_vbn
= bfd_getl32 (eihs
.gstvbn
);
7569 gst_size
= bfd_getl32 (eihs
.gstsize
);
7570 fprintf (file
, _(" global symbol table: vbn: %u, records: %u\n"),
7572 dmt_vbn
= bfd_getl32 (eihs
.dmtvbn
);
7573 dmt_size
= bfd_getl32 (eihs
.dmtsize
);
7574 fprintf (file
, _(" debug module table : vbn: %u, size: %u\n"),
7577 while (eisd_off
!= 0)
7579 struct vms_eisd eisd
;
7584 if (bfd_seek (abfd
, (file_ptr
) eisd_off
, SEEK_SET
)
7585 || bfd_bread (&eisd
, sizeof (eisd
), abfd
) != sizeof (eisd
))
7587 fprintf (file
, _("cannot read EISD\n"));
7590 len
= (unsigned)bfd_getl32 (eisd
.eisdsize
);
7591 if (len
!= (unsigned)-1)
7595 eisd_off
= (eisd_off
+ VMS_BLOCK_SIZE
) & ~(VMS_BLOCK_SIZE
- 1);
7597 fprintf (file
, _("Image section descriptor: (major: %u, minor: %u, "
7598 "size: %u, offset: %u)\n"),
7599 (unsigned)bfd_getl32 (eisd
.majorid
),
7600 (unsigned)bfd_getl32 (eisd
.minorid
),
7604 fprintf (file
, _(" section: base: 0x%08x%08x size: 0x%08x\n"),
7605 (unsigned)bfd_getl32 (eisd
.virt_addr
+ 4),
7606 (unsigned)bfd_getl32 (eisd
.virt_addr
+ 0),
7607 (unsigned)bfd_getl32 (eisd
.secsize
));
7608 val
= (unsigned)bfd_getl32 (eisd
.flags
);
7609 fprintf (file
, _(" flags: 0x%04x"), val
);
7610 if (val
& EISD__M_GBL
)
7611 fprintf (file
, " GBL");
7612 if (val
& EISD__M_CRF
)
7613 fprintf (file
, " CRF");
7614 if (val
& EISD__M_DZRO
)
7615 fprintf (file
, " DZRO");
7616 if (val
& EISD__M_WRT
)
7617 fprintf (file
, " WRT");
7618 if (val
& EISD__M_INITALCODE
)
7619 fprintf (file
, " INITALCODE");
7620 if (val
& EISD__M_BASED
)
7621 fprintf (file
, " BASED");
7622 if (val
& EISD__M_FIXUPVEC
)
7623 fprintf (file
, " FIXUPVEC");
7624 if (val
& EISD__M_RESIDENT
)
7625 fprintf (file
, " RESIDENT");
7626 if (val
& EISD__M_VECTOR
)
7627 fprintf (file
, " VECTOR");
7628 if (val
& EISD__M_PROTECT
)
7629 fprintf (file
, " PROTECT");
7630 if (val
& EISD__M_LASTCLU
)
7631 fprintf (file
, " LASTCLU");
7632 if (val
& EISD__M_EXE
)
7633 fprintf (file
, " EXE");
7634 if (val
& EISD__M_NONSHRADR
)
7635 fprintf (file
, " NONSHRADR");
7636 if (val
& EISD__M_QUAD_LENGTH
)
7637 fprintf (file
, " QUAD_LENGTH");
7638 if (val
& EISD__M_ALLOC_64BIT
)
7639 fprintf (file
, " ALLOC_64BIT");
7640 fprintf (file
, "\n");
7641 if (val
& EISD__M_FIXUPVEC
)
7643 eiaf_vbn
= bfd_getl32 (eisd
.vbn
);
7644 eiaf_size
= bfd_getl32 (eisd
.secsize
);
7646 fprintf (file
, _(" vbn: %u, pfc: %u, matchctl: %u type: %u ("),
7647 (unsigned)bfd_getl32 (eisd
.vbn
),
7648 eisd
.pfc
, eisd
.matchctl
, eisd
.type
);
7651 case EISD__K_NORMAL
:
7652 fputs (_("NORMAL"), file
);
7654 case EISD__K_SHRFXD
:
7655 fputs (_("SHRFXD"), file
);
7657 case EISD__K_PRVFXD
:
7658 fputs (_("PRVFXD"), file
);
7660 case EISD__K_SHRPIC
:
7661 fputs (_("SHRPIC"), file
);
7663 case EISD__K_PRVPIC
:
7664 fputs (_("PRVPIC"), file
);
7666 case EISD__K_USRSTACK
:
7667 fputs (_("USRSTACK"), file
);
7670 fputs (_("*unknown*"), file
);
7673 fputs (_(")\n"), file
);
7674 if (val
& EISD__M_GBL
)
7675 fprintf (file
, _(" ident: 0x%08x, name: %.*s\n"),
7676 (unsigned)bfd_getl32 (eisd
.ident
),
7677 eisd
.gblnam
[0], eisd
.gblnam
+ 1);
7683 if (bfd_seek (abfd
, (file_ptr
) (dmt_vbn
- 1) * VMS_BLOCK_SIZE
, SEEK_SET
))
7685 fprintf (file
, _("cannot read DMT\n"));
7689 fprintf (file
, _("Debug module table:\n"));
7691 while (dmt_size
> 0)
7693 struct vms_dmt_header dmth
;
7696 if (bfd_bread (&dmth
, sizeof (dmth
), abfd
) != sizeof (dmth
))
7698 fprintf (file
, _("cannot read DMT header\n"));
7701 count
= bfd_getl16 (dmth
.psect_count
);
7703 _(" module offset: 0x%08x, size: 0x%08x, (%u psects)\n"),
7704 (unsigned)bfd_getl32 (dmth
.modbeg
),
7705 (unsigned)bfd_getl32 (dmth
.size
), count
);
7706 dmt_size
-= sizeof (dmth
);
7709 struct vms_dmt_psect dmtp
;
7711 if (bfd_bread (&dmtp
, sizeof (dmtp
), abfd
) != sizeof (dmtp
))
7713 fprintf (file
, _("cannot read DMT psect\n"));
7716 fprintf (file
, _(" psect start: 0x%08x, length: %u\n"),
7717 (unsigned)bfd_getl32 (dmtp
.start
),
7718 (unsigned)bfd_getl32 (dmtp
.length
));
7720 dmt_size
-= sizeof (dmtp
);
7727 if (bfd_seek (abfd
, (file_ptr
) (dst_vbn
- 1) * VMS_BLOCK_SIZE
, SEEK_SET
))
7729 fprintf (file
, _("cannot read DST\n"));
7733 evax_bfd_print_dst (abfd
, dst_size
, file
);
7737 if (bfd_seek (abfd
, (file_ptr
) (gst_vbn
- 1) * VMS_BLOCK_SIZE
, SEEK_SET
))
7739 fprintf (file
, _("cannot read GST\n"));
7743 fprintf (file
, _("Global symbol table:\n"));
7744 evax_bfd_print_eobj (abfd
, file
);
7749 struct vms_eiaf
*eiaf
;
7750 unsigned int qrelfixoff
;
7751 unsigned int lrelfixoff
;
7752 unsigned int qdotadroff
;
7753 unsigned int ldotadroff
;
7754 unsigned int shrimgcnt
;
7755 unsigned int shlstoff
;
7756 unsigned int codeadroff
;
7757 unsigned int lpfixoff
;
7758 unsigned int chgprtoff
;
7760 buf
= bfd_malloc (eiaf_size
);
7762 if (bfd_seek (abfd
, (file_ptr
) (eiaf_vbn
- 1) * VMS_BLOCK_SIZE
, SEEK_SET
)
7763 || bfd_bread (buf
, eiaf_size
, abfd
) != eiaf_size
)
7765 fprintf (file
, _("cannot read EIHA\n"));
7769 eiaf
= (struct vms_eiaf
*)buf
;
7771 _("Image activator fixup: (major: %u, minor: %u)\n"),
7772 (unsigned)bfd_getl32 (eiaf
->majorid
),
7773 (unsigned)bfd_getl32 (eiaf
->minorid
));
7774 fprintf (file
, _(" iaflink : 0x%08x %08x\n"),
7775 (unsigned)bfd_getl32 (eiaf
->iaflink
+ 0),
7776 (unsigned)bfd_getl32 (eiaf
->iaflink
+ 4));
7777 fprintf (file
, _(" fixuplnk: 0x%08x %08x\n"),
7778 (unsigned)bfd_getl32 (eiaf
->fixuplnk
+ 0),
7779 (unsigned)bfd_getl32 (eiaf
->fixuplnk
+ 4));
7780 fprintf (file
, _(" size : %u\n"),
7781 (unsigned)bfd_getl32 (eiaf
->size
));
7782 fprintf (file
, _(" flags: 0x%08x\n"),
7783 (unsigned)bfd_getl32 (eiaf
->flags
));
7784 qrelfixoff
= bfd_getl32 (eiaf
->qrelfixoff
);
7785 lrelfixoff
= bfd_getl32 (eiaf
->lrelfixoff
);
7786 fprintf (file
, _(" qrelfixoff: %5u, lrelfixoff: %5u\n"),
7787 qrelfixoff
, lrelfixoff
);
7788 qdotadroff
= bfd_getl32 (eiaf
->qdotadroff
);
7789 ldotadroff
= bfd_getl32 (eiaf
->ldotadroff
);
7790 fprintf (file
, _(" qdotadroff: %5u, ldotadroff: %5u\n"),
7791 qdotadroff
, ldotadroff
);
7792 codeadroff
= bfd_getl32 (eiaf
->codeadroff
);
7793 lpfixoff
= bfd_getl32 (eiaf
->lpfixoff
);
7794 fprintf (file
, _(" codeadroff: %5u, lpfixoff : %5u\n"),
7795 codeadroff
, lpfixoff
);
7796 chgprtoff
= bfd_getl32 (eiaf
->chgprtoff
);
7797 fprintf (file
, _(" chgprtoff : %5u\n"), chgprtoff
);
7798 shrimgcnt
= bfd_getl32 (eiaf
->shrimgcnt
);
7799 shlstoff
= bfd_getl32 (eiaf
->shlstoff
);
7800 fprintf (file
, _(" shlstoff : %5u, shrimgcnt : %5u\n"),
7801 shlstoff
, shrimgcnt
);
7802 fprintf (file
, _(" shlextra : %5u, permctx : %5u\n"),
7803 (unsigned)bfd_getl32 (eiaf
->shlextra
),
7804 (unsigned)bfd_getl32 (eiaf
->permctx
));
7805 fprintf (file
, _(" base_va : 0x%08x\n"),
7806 (unsigned)bfd_getl32 (eiaf
->base_va
));
7807 fprintf (file
, _(" lppsbfixoff: %5u\n"),
7808 (unsigned)bfd_getl32 (eiaf
->lppsbfixoff
));
7812 struct vms_shl
*shl
= (struct vms_shl
*)(buf
+ shlstoff
);
7815 fprintf (file
, _(" Shareable images:\n"));
7816 for (j
= 0; j
< shrimgcnt
; j
++, shl
++)
7819 _(" %u: size: %u, flags: 0x%02x, name: %.*s\n"),
7820 j
, shl
->size
, shl
->flags
,
7821 shl
->imgnam
[0], shl
->imgnam
+ 1);
7824 if (qrelfixoff
!= 0)
7826 fprintf (file
, _(" quad-word relocation fixups:\n"));
7827 evax_bfd_print_relocation_records (file
, buf
+ qrelfixoff
, 8);
7829 if (lrelfixoff
!= 0)
7831 fprintf (file
, _(" long-word relocation fixups:\n"));
7832 evax_bfd_print_relocation_records (file
, buf
+ lrelfixoff
, 4);
7834 if (qdotadroff
!= 0)
7836 fprintf (file
, _(" quad-word .address reference fixups:\n"));
7837 evax_bfd_print_address_fixups (file
, buf
+ qdotadroff
);
7839 if (ldotadroff
!= 0)
7841 fprintf (file
, _(" long-word .address reference fixups:\n"));
7842 evax_bfd_print_address_fixups (file
, buf
+ ldotadroff
);
7844 if (codeadroff
!= 0)
7846 fprintf (file
, _(" Code Address Reference Fixups:\n"));
7847 evax_bfd_print_reference_fixups (file
, buf
+ codeadroff
);
7851 fprintf (file
, _(" Linkage Pairs Reference Fixups:\n"));
7852 evax_bfd_print_reference_fixups (file
, buf
+ lpfixoff
);
7856 unsigned int count
= (unsigned)bfd_getl32 (buf
+ chgprtoff
);
7857 struct vms_eicp
*eicp
= (struct vms_eicp
*)(buf
+ chgprtoff
+ 4);
7860 fprintf (file
, _(" Change Protection (%u entries):\n"), count
);
7861 for (j
= 0; j
< count
; j
++, eicp
++)
7863 unsigned int prot
= bfd_getl32 (eicp
->newprt
);
7865 _(" base: 0x%08x %08x, size: 0x%08x, prot: 0x%08x "),
7866 (unsigned)bfd_getl32 (eicp
->baseva
+ 4),
7867 (unsigned)bfd_getl32 (eicp
->baseva
+ 0),
7868 (unsigned)bfd_getl32 (eicp
->size
),
7869 (unsigned)bfd_getl32 (eicp
->newprt
));
7873 fprintf (file
, "NA");
7875 case PRT__C_RESERVED
:
7876 fprintf (file
, "RES");
7879 fprintf (file
, "KW");
7882 fprintf (file
, "KR");
7885 fprintf (file
, "UW");
7888 fprintf (file
, "EW");
7891 fprintf (file
, "ERKW");
7894 fprintf (file
, "ER");
7897 fprintf (file
, "SW");
7900 fprintf (file
, "SREW");
7903 fprintf (file
, "SRKW");
7906 fprintf (file
, "SR");
7909 fprintf (file
, "URSW");
7912 fprintf (file
, "UREW");
7915 fprintf (file
, "URKW");
7918 fprintf (file
, "UR");
7932 vms_bfd_print_private_bfd_data (bfd
*abfd
, void *ptr
)
7934 FILE *file
= (FILE *)ptr
;
7936 if (bfd_get_file_flags (abfd
) & (EXEC_P
| DYNAMIC
))
7937 evax_bfd_print_image (abfd
, file
);
7940 if (bfd_seek (abfd
, 0, SEEK_SET
))
7942 evax_bfd_print_eobj (abfd
, file
);
7949 /* Slurp ETIR/EDBG/ETBT VMS object records. */
7952 alpha_vms_read_sections_content (bfd
*abfd
, struct bfd_link_info
*info
)
7954 asection
*cur_section
;
7955 file_ptr cur_offset
;
7956 asection
*dst_section
;
7957 file_ptr dst_offset
;
7959 if (bfd_seek (abfd
, 0, SEEK_SET
) != 0)
7965 dst_section
= PRIV (dst_section
);
7969 if (info
->strip
== strip_all
|| info
->strip
== strip_debugger
)
7971 /* Discard the DST section. */
7975 else if (dst_section
)
7977 dst_offset
= dst_section
->output_offset
;
7978 dst_section
= dst_section
->output_section
;
7987 type
= _bfd_vms_get_object_record (abfd
);
7990 vms_debug2 ((2, "next_record failed\n"));
7996 PRIV (image_section
) = cur_section
;
7997 PRIV (image_offset
) = cur_offset
;
7998 res
= _bfd_vms_slurp_etir (abfd
, info
);
7999 cur_section
= PRIV (image_section
);
8000 cur_offset
= PRIV (image_offset
);
8004 if (dst_section
== NULL
)
8006 PRIV (image_section
) = dst_section
;
8007 PRIV (image_offset
) = dst_offset
;
8008 res
= _bfd_vms_slurp_etir (abfd
, info
);
8009 dst_offset
= PRIV (image_offset
);
8018 vms_debug2 ((2, "slurp eobj type %d failed\n", type
));
8025 alpha_vms_sizeof_headers (bfd
*abfd ATTRIBUTE_UNUSED
,
8026 struct bfd_link_info
*info ATTRIBUTE_UNUSED
)
8031 /* Add a linkage pair fixup at address SECT + OFFSET to SHLIB. */
8034 alpha_vms_add_fixup_lp (struct bfd_link_info
*info
, bfd
*src
, bfd
*shlib
)
8036 struct alpha_vms_shlib_el
*sl
;
8037 asection
*sect
= PRIV2 (src
, image_section
);
8038 file_ptr offset
= PRIV2 (src
, image_offset
);
8040 sl
= &VEC_EL (alpha_vms_link_hash (info
)->shrlibs
,
8041 struct alpha_vms_shlib_el
, PRIV2 (shlib
, shr_index
));
8042 sl
->has_fixups
= TRUE
;
8043 VEC_APPEND_EL (sl
->lp
, bfd_vma
,
8044 sect
->output_section
->vma
+ sect
->output_offset
+ offset
);
8045 sect
->output_section
->flags
|= SEC_RELOC
;
8048 /* Add a code address fixup at address SECT + OFFSET to SHLIB. */
8051 alpha_vms_add_fixup_ca (struct bfd_link_info
*info
, bfd
*src
, bfd
*shlib
)
8053 struct alpha_vms_shlib_el
*sl
;
8054 asection
*sect
= PRIV2 (src
, image_section
);
8055 file_ptr offset
= PRIV2 (src
, image_offset
);
8057 sl
= &VEC_EL (alpha_vms_link_hash (info
)->shrlibs
,
8058 struct alpha_vms_shlib_el
, PRIV2 (shlib
, shr_index
));
8059 sl
->has_fixups
= TRUE
;
8060 VEC_APPEND_EL (sl
->ca
, bfd_vma
,
8061 sect
->output_section
->vma
+ sect
->output_offset
+ offset
);
8062 sect
->output_section
->flags
|= SEC_RELOC
;
8065 /* Add a quad word relocation fixup at address SECT + OFFSET to SHLIB. */
8068 alpha_vms_add_fixup_qr (struct bfd_link_info
*info
, bfd
*src
,
8069 bfd
*shlib
, bfd_vma vec
)
8071 struct alpha_vms_shlib_el
*sl
;
8072 struct alpha_vms_vma_ref
*r
;
8073 asection
*sect
= PRIV2 (src
, image_section
);
8074 file_ptr offset
= PRIV2 (src
, image_offset
);
8076 sl
= &VEC_EL (alpha_vms_link_hash (info
)->shrlibs
,
8077 struct alpha_vms_shlib_el
, PRIV2 (shlib
, shr_index
));
8078 sl
->has_fixups
= TRUE
;
8079 r
= VEC_APPEND (sl
->qr
, struct alpha_vms_vma_ref
);
8080 r
->vma
= sect
->output_section
->vma
+ sect
->output_offset
+ offset
;
8082 sect
->output_section
->flags
|= SEC_RELOC
;
8086 alpha_vms_add_fixup_lr (struct bfd_link_info
*info ATTRIBUTE_UNUSED
,
8087 unsigned int shr ATTRIBUTE_UNUSED
,
8088 bfd_vma vec ATTRIBUTE_UNUSED
)
8090 /* Not yet supported. */
8094 /* Add relocation. FIXME: Not yet emitted. */
8097 alpha_vms_add_lw_reloc (struct bfd_link_info
*info ATTRIBUTE_UNUSED
)
8102 alpha_vms_add_qw_reloc (struct bfd_link_info
*info ATTRIBUTE_UNUSED
)
8106 static struct bfd_hash_entry
*
8107 alpha_vms_link_hash_newfunc (struct bfd_hash_entry
*entry
,
8108 struct bfd_hash_table
*table
,
8111 struct alpha_vms_link_hash_entry
*ret
=
8112 (struct alpha_vms_link_hash_entry
*) entry
;
8114 /* Allocate the structure if it has not already been allocated by a
8117 ret
= ((struct alpha_vms_link_hash_entry
*)
8118 bfd_hash_allocate (table
,
8119 sizeof (struct alpha_vms_link_hash_entry
)));
8123 /* Call the allocation method of the superclass. */
8124 ret
= ((struct alpha_vms_link_hash_entry
*)
8125 _bfd_link_hash_newfunc ((struct bfd_hash_entry
*) ret
,
8130 return (struct bfd_hash_entry
*) ret
;
8133 /* Create an Alpha/VMS link hash table. */
8135 static struct bfd_link_hash_table
*
8136 alpha_vms_bfd_link_hash_table_create (bfd
*abfd
)
8138 struct alpha_vms_link_hash_table
*ret
;
8139 bfd_size_type amt
= sizeof (struct alpha_vms_link_hash_table
);
8141 ret
= (struct alpha_vms_link_hash_table
*) bfd_malloc (amt
);
8144 if (!_bfd_link_hash_table_init (&ret
->root
, abfd
,
8145 alpha_vms_link_hash_newfunc
,
8146 sizeof (struct alpha_vms_link_hash_entry
)))
8152 VEC_INIT (ret
->shrlibs
);
8159 alpha_vms_link_add_object_symbols (bfd
*abfd
, struct bfd_link_info
*info
)
8163 for (i
= 0; i
< PRIV (gsd_sym_count
); i
++)
8165 struct vms_symbol_entry
*e
= PRIV (syms
)[i
];
8166 struct alpha_vms_link_hash_entry
*h
;
8167 struct bfd_link_hash_entry
*h_root
;
8170 if (!alpha_vms_convert_symbol (abfd
, e
, &sym
))
8173 if ((e
->flags
& EGSY__V_DEF
) && abfd
->selective_search
)
8175 /* In selective_search mode, only add definition that are
8177 h
= (struct alpha_vms_link_hash_entry
*)bfd_link_hash_lookup
8178 (info
->hash
, sym
.name
, FALSE
, FALSE
, FALSE
);
8179 if (h
== NULL
|| h
->root
.type
!= bfd_link_hash_undefined
)
8185 h_root
= (struct bfd_link_hash_entry
*) h
;
8186 if (_bfd_generic_link_add_one_symbol
8187 (info
, abfd
, sym
.name
, sym
.flags
, sym
.section
, sym
.value
,
8188 NULL
, FALSE
, FALSE
, &h_root
) == FALSE
)
8190 h
= (struct alpha_vms_link_hash_entry
*) h_root
;
8192 if ((e
->flags
& EGSY__V_DEF
)
8194 && abfd
->xvec
== info
->output_bfd
->xvec
)
8198 if (abfd
->flags
& DYNAMIC
)
8200 struct alpha_vms_shlib_el
*shlib
;
8202 /* We do not want to include any of the sections in a dynamic
8203 object in the output file. See comment in elflink.c. */
8204 bfd_section_list_clear (abfd
);
8206 shlib
= VEC_APPEND (alpha_vms_link_hash (info
)->shrlibs
,
8207 struct alpha_vms_shlib_el
);
8209 VEC_INIT (shlib
->ca
);
8210 VEC_INIT (shlib
->lp
);
8211 VEC_INIT (shlib
->qr
);
8212 PRIV (shr_index
) = VEC_COUNT (alpha_vms_link_hash (info
)->shrlibs
) - 1;
8219 alpha_vms_link_add_archive_symbols (bfd
*abfd
, struct bfd_link_info
*info
)
8222 struct bfd_link_hash_entry
**pundef
;
8223 struct bfd_link_hash_entry
**next_pundef
;
8225 /* We only accept VMS libraries. */
8226 if (info
->output_bfd
->xvec
!= abfd
->xvec
)
8228 bfd_set_error (bfd_error_wrong_format
);
8232 /* The archive_pass field in the archive itself is used to
8233 initialize PASS, since we may search the same archive multiple
8235 pass
= ++abfd
->archive_pass
;
8237 /* Look through the list of undefined symbols. */
8238 for (pundef
= &info
->hash
->undefs
; *pundef
!= NULL
; pundef
= next_pundef
)
8240 struct bfd_link_hash_entry
*h
;
8246 next_pundef
= &(*pundef
)->u
.undef
.next
;
8248 /* When a symbol is defined, it is not necessarily removed from
8250 if (h
->type
!= bfd_link_hash_undefined
8251 && h
->type
!= bfd_link_hash_common
)
8253 /* Remove this entry from the list, for general cleanliness
8254 and because we are going to look through the list again
8255 if we search any more libraries. We can't remove the
8256 entry if it is the tail, because that would lose any
8257 entries we add to the list later on. */
8258 if (*pundef
!= info
->hash
->undefs_tail
)
8260 *pundef
= *next_pundef
;
8261 next_pundef
= pundef
;
8266 /* Look for this symbol in the archive hash table. */
8267 symidx
= _bfd_vms_lib_find_symbol (abfd
, h
->root
.string
);
8268 if (symidx
== BFD_NO_MORE_SYMBOLS
)
8270 /* Nothing in this slot. */
8274 element
= bfd_get_elt_at_index (abfd
, symidx
);
8275 if (element
== NULL
)
8278 if (element
->archive_pass
== -1 || element
->archive_pass
== pass
)
8280 /* Next symbol if this archive is wrong or already handled. */
8284 if (! bfd_check_format (element
, bfd_object
))
8286 element
->archive_pass
= -1;
8290 orig_element
= element
;
8291 if (bfd_is_thin_archive (abfd
))
8293 element
= _bfd_vms_lib_get_imagelib_file (element
);
8294 if (element
== NULL
|| !bfd_check_format (element
, bfd_object
))
8296 orig_element
->archive_pass
= -1;
8301 /* Unlike the generic linker, we know that this element provides
8302 a definition for an undefined symbol and we know that we want
8303 to include it. We don't need to check anything. */
8304 if (!(*info
->callbacks
8305 ->add_archive_element
) (info
, element
, h
->root
.string
, &element
))
8307 if (!alpha_vms_link_add_object_symbols (element
, info
))
8310 orig_element
->archive_pass
= pass
;
8317 alpha_vms_bfd_link_add_symbols (bfd
*abfd
, struct bfd_link_info
*info
)
8319 switch (bfd_get_format (abfd
))
8322 vms_debug2 ((2, "vms_link_add_symbols for object %s\n",
8324 return alpha_vms_link_add_object_symbols (abfd
, info
);
8327 vms_debug2 ((2, "vms_link_add_symbols for archive %s\n",
8329 return alpha_vms_link_add_archive_symbols (abfd
, info
);
8332 bfd_set_error (bfd_error_wrong_format
);
8338 alpha_vms_build_fixups (struct bfd_link_info
*info
)
8340 struct alpha_vms_link_hash_table
*t
= alpha_vms_link_hash (info
);
8341 unsigned char *content
;
8343 unsigned int sz
= 0;
8344 unsigned int lp_sz
= 0;
8345 unsigned int ca_sz
= 0;
8346 unsigned int qr_sz
= 0;
8347 unsigned int shrimg_cnt
= 0;
8348 unsigned int chgprt_num
= 0;
8349 unsigned int chgprt_sz
= 0;
8350 struct vms_eiaf
*eiaf
;
8354 /* Shared libraries. */
8355 for (i
= 0; i
< VEC_COUNT (t
->shrlibs
); i
++)
8357 struct alpha_vms_shlib_el
*shlib
;
8359 shlib
= &VEC_EL (t
->shrlibs
, struct alpha_vms_shlib_el
, i
);
8361 if (!shlib
->has_fixups
)
8366 if (VEC_COUNT (shlib
->ca
) > 0)
8368 /* Header + entries. */
8370 ca_sz
+= VEC_COUNT (shlib
->ca
) * 4;
8372 if (VEC_COUNT (shlib
->lp
) > 0)
8374 /* Header + entries. */
8376 lp_sz
+= VEC_COUNT (shlib
->lp
) * 4;
8378 if (VEC_COUNT (shlib
->qr
) > 0)
8380 /* Header + entries. */
8382 qr_sz
+= VEC_COUNT (shlib
->qr
) * 8;
8393 /* Finish now if there is no content. */
8394 if (ca_sz
+ lp_sz
+ qr_sz
== 0)
8397 /* Add an eicp entry for the fixup itself. */
8399 for (sec
= info
->output_bfd
->sections
; sec
!= NULL
; sec
= sec
->next
)
8401 /* This isect could be made RO or EXE after relocations are applied. */
8402 if ((sec
->flags
& SEC_RELOC
) != 0
8403 && (sec
->flags
& (SEC_CODE
| SEC_READONLY
)) != 0)
8406 chgprt_sz
= 4 + chgprt_num
* sizeof (struct vms_eicp
);
8408 /* Allocate section content (round-up size) */
8409 sz
= sizeof (struct vms_eiaf
) + shrimg_cnt
* sizeof (struct vms_shl
)
8410 + ca_sz
+ lp_sz
+ qr_sz
+ chgprt_sz
;
8411 sz
= (sz
+ VMS_BLOCK_SIZE
- 1) & ~(VMS_BLOCK_SIZE
- 1);
8412 content
= bfd_zalloc (info
->output_bfd
, sz
);
8413 if (content
== NULL
)
8416 sec
= alpha_vms_link_hash (info
)->fixup
;
8417 sec
->contents
= content
;
8420 eiaf
= (struct vms_eiaf
*)content
;
8421 off
= sizeof (struct vms_eiaf
);
8422 bfd_putl32 (0, eiaf
->majorid
);
8423 bfd_putl32 (0, eiaf
->minorid
);
8424 bfd_putl32 (0, eiaf
->iaflink
);
8425 bfd_putl32 (0, eiaf
->fixuplnk
);
8426 bfd_putl32 (sizeof (struct vms_eiaf
), eiaf
->size
);
8427 bfd_putl32 (0, eiaf
->flags
);
8428 bfd_putl32 (0, eiaf
->qrelfixoff
);
8429 bfd_putl32 (0, eiaf
->lrelfixoff
);
8430 bfd_putl32 (0, eiaf
->qdotadroff
);
8431 bfd_putl32 (0, eiaf
->ldotadroff
);
8432 bfd_putl32 (0, eiaf
->codeadroff
);
8433 bfd_putl32 (0, eiaf
->lpfixoff
);
8434 bfd_putl32 (0, eiaf
->chgprtoff
);
8435 bfd_putl32 (shrimg_cnt
? off
: 0, eiaf
->shlstoff
);
8436 bfd_putl32 (shrimg_cnt
, eiaf
->shrimgcnt
);
8437 bfd_putl32 (0, eiaf
->shlextra
);
8438 bfd_putl32 (0, eiaf
->permctx
);
8439 bfd_putl32 (0, eiaf
->base_va
);
8440 bfd_putl32 (0, eiaf
->lppsbfixoff
);
8447 for (i
= 0; i
< VEC_COUNT (t
->shrlibs
); i
++)
8449 struct alpha_vms_shlib_el
*shlib
;
8450 struct vms_shl
*shl
;
8452 shlib
= &VEC_EL (t
->shrlibs
, struct alpha_vms_shlib_el
, i
);
8454 if (!shlib
->has_fixups
)
8457 /* Renumber shared images. */
8458 PRIV2 (shlib
->abfd
, shr_index
) = shrimg_cnt
++;
8460 shl
= (struct vms_shl
*)(content
+ off
);
8461 bfd_putl32 (0, shl
->baseva
);
8462 bfd_putl32 (0, shl
->shlptr
);
8463 bfd_putl32 (0, shl
->ident
);
8464 bfd_putl32 (0, shl
->permctx
);
8465 shl
->size
= sizeof (struct vms_shl
);
8466 bfd_putl16 (0, shl
->fill_1
);
8468 bfd_putl32 (0, shl
->icb
);
8469 shl
->imgnam
[0] = strlen (PRIV2 (shlib
->abfd
, hdr_data
.hdr_t_name
));
8470 memcpy (shl
->imgnam
+ 1, PRIV2 (shlib
->abfd
, hdr_data
.hdr_t_name
),
8473 off
+= sizeof (struct vms_shl
);
8479 bfd_putl32 (off
, eiaf
->codeadroff
);
8481 for (i
= 0; i
< VEC_COUNT (t
->shrlibs
); i
++)
8483 struct alpha_vms_shlib_el
*shlib
;
8486 shlib
= &VEC_EL (t
->shrlibs
, struct alpha_vms_shlib_el
, i
);
8488 if (VEC_COUNT (shlib
->ca
) == 0)
8491 bfd_putl32 (VEC_COUNT (shlib
->ca
), content
+ off
);
8492 bfd_putl32 (PRIV2 (shlib
->abfd
, shr_index
), content
+ off
+ 4);
8495 for (j
= 0; j
< VEC_COUNT (shlib
->ca
); j
++)
8497 bfd_putl32 (VEC_EL (shlib
->ca
, bfd_vma
, j
) - t
->base_addr
,
8503 bfd_putl32 (0, content
+ off
);
8504 bfd_putl32 (0, content
+ off
+ 4);
8511 bfd_putl32 (off
, eiaf
->lpfixoff
);
8513 for (i
= 0; i
< VEC_COUNT (t
->shrlibs
); i
++)
8515 struct alpha_vms_shlib_el
*shlib
;
8518 shlib
= &VEC_EL (t
->shrlibs
, struct alpha_vms_shlib_el
, i
);
8520 if (VEC_COUNT (shlib
->lp
) == 0)
8523 bfd_putl32 (VEC_COUNT (shlib
->lp
), content
+ off
);
8524 bfd_putl32 (PRIV2 (shlib
->abfd
, shr_index
), content
+ off
+ 4);
8527 for (j
= 0; j
< VEC_COUNT (shlib
->lp
); j
++)
8529 bfd_putl32 (VEC_EL (shlib
->lp
, bfd_vma
, j
) - t
->base_addr
,
8535 bfd_putl32 (0, content
+ off
);
8536 bfd_putl32 (0, content
+ off
+ 4);
8543 bfd_putl32 (off
, eiaf
->qdotadroff
);
8545 for (i
= 0; i
< VEC_COUNT (t
->shrlibs
); i
++)
8547 struct alpha_vms_shlib_el
*shlib
;
8550 shlib
= &VEC_EL (t
->shrlibs
, struct alpha_vms_shlib_el
, i
);
8552 if (VEC_COUNT (shlib
->qr
) == 0)
8555 bfd_putl32 (VEC_COUNT (shlib
->qr
), content
+ off
);
8556 bfd_putl32 (PRIV2 (shlib
->abfd
, shr_index
), content
+ off
+ 4);
8559 for (j
= 0; j
< VEC_COUNT (shlib
->qr
); j
++)
8561 struct alpha_vms_vma_ref
*r
;
8562 r
= &VEC_EL (shlib
->qr
, struct alpha_vms_vma_ref
, j
);
8563 bfd_putl32 (r
->vma
- t
->base_addr
, content
+ off
);
8564 bfd_putl32 (r
->ref
, content
+ off
+ 4);
8569 bfd_putl32 (0, content
+ off
);
8570 bfd_putl32 (0, content
+ off
+ 4);
8575 /* Write the change protection table. */
8576 bfd_putl32 (off
, eiaf
->chgprtoff
);
8577 bfd_putl32 (chgprt_num
, content
+ off
);
8580 for (sec
= info
->output_bfd
->sections
; sec
!= NULL
; sec
= sec
->next
)
8582 struct vms_eicp
*eicp
;
8585 if ((sec
->flags
& SEC_LINKER_CREATED
) != 0 &&
8586 strcmp (sec
->name
, "$FIXUP$") == 0)
8588 else if ((sec
->flags
& SEC_RELOC
) != 0
8589 && (sec
->flags
& (SEC_CODE
| SEC_READONLY
)) != 0)
8594 eicp
= (struct vms_eicp
*)(content
+ off
);
8595 bfd_putl64 (sec
->vma
- t
->base_addr
, eicp
->baseva
);
8596 bfd_putl32 ((sec
->size
+ VMS_BLOCK_SIZE
- 1) & ~(VMS_BLOCK_SIZE
- 1),
8598 bfd_putl32 (prot
, eicp
->newprt
);
8599 off
+= sizeof (struct vms_eicp
);
8605 /* Called by bfd_hash_traverse to fill the symbol table.
8606 Return FALSE in case of failure. */
8609 alpha_vms_link_output_symbol (struct bfd_hash_entry
*bh
, void *infov
)
8611 struct bfd_link_hash_entry
*hc
= (struct bfd_link_hash_entry
*) bh
;
8612 struct bfd_link_info
*info
= (struct bfd_link_info
*)infov
;
8613 struct alpha_vms_link_hash_entry
*h
;
8614 struct vms_symbol_entry
*sym
;
8616 if (hc
->type
== bfd_link_hash_warning
)
8619 if (hc
->type
== bfd_link_hash_new
)
8622 h
= (struct alpha_vms_link_hash_entry
*) hc
;
8624 switch (h
->root
.type
)
8626 case bfd_link_hash_undefined
:
8628 case bfd_link_hash_new
:
8629 case bfd_link_hash_warning
:
8631 case bfd_link_hash_undefweak
:
8633 case bfd_link_hash_defined
:
8634 case bfd_link_hash_defweak
:
8636 asection
*sec
= h
->root
.u
.def
.section
;
8638 /* FIXME: this is certainly a symbol from a dynamic library. */
8639 if (bfd_is_abs_section (sec
))
8642 if (sec
->owner
->flags
& DYNAMIC
)
8646 case bfd_link_hash_common
:
8648 case bfd_link_hash_indirect
:
8652 /* Do not write not kept symbols. */
8653 if (info
->strip
== strip_some
8654 && bfd_hash_lookup (info
->keep_hash
, h
->root
.root
.string
,
8655 FALSE
, FALSE
) != NULL
)
8660 /* This symbol doesn't come from a VMS object. So we suppose it is
8662 int len
= strlen (h
->root
.root
.string
);
8664 sym
= (struct vms_symbol_entry
*)bfd_zalloc (info
->output_bfd
,
8665 sizeof (*sym
) + len
);
8669 memcpy (sym
->name
, h
->root
.root
.string
, len
);
8671 sym
->owner
= info
->output_bfd
;
8673 sym
->typ
= EGSD__C_SYMG
;
8675 sym
->flags
= EGSY__V_DEF
| EGSY__V_REL
;
8676 sym
->symbol_vector
= h
->root
.u
.def
.value
;
8677 sym
->section
= h
->root
.u
.def
.section
;
8678 sym
->value
= h
->root
.u
.def
.value
;
8683 if (!add_symbol_entry (info
->output_bfd
, sym
))
8690 alpha_vms_bfd_final_link (bfd
*abfd
, struct bfd_link_info
*info
)
8693 struct bfd_link_order
*p
;
8701 if (info
->relocatable
)
8703 /* FIXME: we do not yet support relocatable link. It is not obvious
8704 how to do it for debug infos. */
8705 (*info
->callbacks
->einfo
)(_("%P: relocatable link is not supported\n"));
8709 bfd_get_outsymbols (abfd
) = NULL
;
8710 bfd_get_symcount (abfd
) = 0;
8712 /* Mark all sections which will be included in the output file. */
8713 for (o
= abfd
->sections
; o
!= NULL
; o
= o
->next
)
8714 for (p
= o
->map_head
.link_order
; p
!= NULL
; p
= p
->next
)
8715 if (p
->type
== bfd_indirect_link_order
)
8716 p
->u
.indirect
.section
->linker_mark
= TRUE
;
8719 /* Handle all the link order information for the sections. */
8720 for (o
= abfd
->sections
; o
!= NULL
; o
= o
->next
)
8722 printf ("For section %s (at 0x%08x, flags=0x%08x):\n",
8723 o
->name
, (unsigned)o
->vma
, (unsigned)o
->flags
);
8725 for (p
= o
->map_head
.link_order
; p
!= NULL
; p
= p
->next
)
8727 printf (" at 0x%08x - 0x%08x: ",
8728 (unsigned)p
->offset
, (unsigned)(p
->offset
+ p
->size
- 1));
8731 case bfd_section_reloc_link_order
:
8732 case bfd_symbol_reloc_link_order
:
8733 printf (" section/symbol reloc\n");
8735 case bfd_indirect_link_order
:
8736 printf (" section %s of %s\n",
8737 p
->u
.indirect
.section
->name
,
8738 p
->u
.indirect
.section
->owner
->filename
);
8740 case bfd_data_link_order
:
8741 printf (" explicit data\n");
8744 printf (" *unknown* type %u\n", p
->type
);
8751 /* Generate the symbol table. */
8752 BFD_ASSERT (PRIV (syms
) == NULL
);
8753 if (info
->strip
!= strip_all
)
8754 bfd_hash_traverse (&info
->hash
->table
, alpha_vms_link_output_symbol
, info
);
8756 /* Find the entry point. */
8757 if (bfd_get_start_address (abfd
) == 0)
8759 bfd
*startbfd
= NULL
;
8761 for (sub
= info
->input_bfds
; sub
!= NULL
; sub
= sub
->link_next
)
8763 /* Consider only VMS object files. */
8764 if (sub
->xvec
!= abfd
->xvec
)
8767 if (!PRIV2 (sub
, eom_data
).eom_has_transfer
)
8769 if ((PRIV2 (sub
, eom_data
).eom_b_tfrflg
& EEOM__M_WKTFR
) && startbfd
)
8771 if (startbfd
!= NULL
8772 && !(PRIV2 (sub
, eom_data
).eom_b_tfrflg
& EEOM__M_WKTFR
))
8774 (*info
->callbacks
->einfo
)
8775 (_("%P: multiple entry points: in modules %B and %B\n"),
8784 unsigned int ps_idx
= PRIV2 (startbfd
, eom_data
).eom_l_psindx
;
8785 bfd_vma tfradr
= PRIV2 (startbfd
, eom_data
).eom_l_tfradr
;
8788 sec
= PRIV2 (startbfd
, sections
)[ps_idx
];
8790 bfd_set_start_address
8791 (abfd
, sec
->output_section
->vma
+ sec
->output_offset
+ tfradr
);
8795 /* Set transfer addresses. */
8798 struct bfd_link_hash_entry
*h
;
8801 PRIV (transfer_address
[i
++]) = 0xffffffff00000340ULL
; /* SYS$IMGACT */
8802 h
= bfd_link_hash_lookup (info
->hash
, "LIB$INITIALIZE", FALSE
, FALSE
, TRUE
);
8803 if (h
!= NULL
&& h
->type
== bfd_link_hash_defined
)
8804 PRIV (transfer_address
[i
++]) =
8805 alpha_vms_get_sym_value (h
->u
.def
.section
, h
->u
.def
.value
);
8806 PRIV (transfer_address
[i
++]) = bfd_get_start_address (abfd
);
8808 PRIV (transfer_address
[i
++]) = 0;
8811 /* Allocate contents.
8812 Also compute the virtual base address. */
8813 base_addr
= (bfd_vma
)-1;
8815 for (o
= abfd
->sections
; o
!= NULL
; o
= o
->next
)
8817 if (o
->flags
& SEC_HAS_CONTENTS
)
8819 o
->contents
= bfd_alloc (abfd
, o
->size
);
8820 if (o
->contents
== NULL
)
8823 if (o
->flags
& SEC_LOAD
)
8825 if (o
->vma
< base_addr
)
8827 if (o
->vma
+ o
->size
> last_addr
)
8828 last_addr
= o
->vma
+ o
->size
;
8830 /* Clear the RELOC flags. Currently we don't support incremental
8831 linking. We use the RELOC flag for computing the eicp entries. */
8832 o
->flags
&= ~SEC_RELOC
;
8835 /* Create the fixup section. */
8836 fixupsec
= bfd_make_section_anyway_with_flags
8837 (info
->output_bfd
, "$FIXUP$",
8838 SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_LINKER_CREATED
);
8839 if (fixupsec
== NULL
)
8841 last_addr
= (last_addr
+ 0xffff) & ~0xffff;
8842 fixupsec
->vma
= last_addr
;
8844 alpha_vms_link_hash (info
)->fixup
= fixupsec
;
8845 alpha_vms_link_hash (info
)->base_addr
= base_addr
;
8847 /* Create the DMT section, if necessary. */
8848 BFD_ASSERT (PRIV (dst_section
) == NULL
);
8849 dst
= bfd_get_section_by_name (abfd
, "$DST$");
8850 if (dst
!= NULL
&& dst
->size
== 0)
8854 PRIV (dst_section
) = dst
;
8855 dmt
= bfd_make_section_anyway_with_flags
8856 (info
->output_bfd
, "$DMT$",
8857 SEC_DEBUGGING
| SEC_HAS_CONTENTS
| SEC_LINKER_CREATED
);
8864 /* Read all sections from the inputs. */
8865 for (sub
= info
->input_bfds
; sub
!= NULL
; sub
= sub
->link_next
)
8867 if (sub
->flags
& DYNAMIC
)
8869 alpha_vms_create_eisd_for_shared (abfd
, sub
);
8873 if (!alpha_vms_read_sections_content (sub
, info
))
8877 /* Handle all the link order information for the sections.
8878 Note: past this point, it is not possible to create new sections. */
8879 for (o
= abfd
->sections
; o
!= NULL
; o
= o
->next
)
8881 for (p
= o
->map_head
.link_order
; p
!= NULL
; p
= p
->next
)
8885 case bfd_section_reloc_link_order
:
8886 case bfd_symbol_reloc_link_order
:
8889 case bfd_indirect_link_order
:
8893 if (! _bfd_default_link_order (abfd
, info
, o
, p
))
8900 /* Compute fixups. */
8901 if (!alpha_vms_build_fixups (info
))
8904 /* Compute the DMT. */
8908 unsigned char *contents
= NULL
;
8910 /* In pass 1, compute the size. In pass 2, write the DMT contents. */
8911 for (pass
= 0; pass
< 2; pass
++)
8913 unsigned int off
= 0;
8915 /* For each object file (ie for each module). */
8916 for (sub
= info
->input_bfds
; sub
!= NULL
; sub
= sub
->link_next
)
8919 struct vms_dmt_header
*dmth
= NULL
;
8920 unsigned int psect_count
;
8922 /* Skip this module if it has no DST. */
8923 sub_dst
= PRIV2 (sub
, dst_section
);
8924 if (sub_dst
== NULL
|| sub_dst
->size
== 0)
8929 /* Write the header. */
8930 dmth
= (struct vms_dmt_header
*)(contents
+ off
);
8931 bfd_putl32 (sub_dst
->output_offset
, dmth
->modbeg
);
8932 bfd_putl32 (sub_dst
->size
, dmth
->size
);
8935 off
+= sizeof (struct vms_dmt_header
);
8938 /* For each section (ie for each psect). */
8939 for (o
= sub
->sections
; o
!= NULL
; o
= o
->next
)
8941 /* Only consider interesting sections. */
8942 if (!(o
->flags
& SEC_ALLOC
))
8944 if (o
->flags
& SEC_LINKER_CREATED
)
8949 /* Write an entry. */
8950 struct vms_dmt_psect
*dmtp
;
8952 dmtp
= (struct vms_dmt_psect
*)(contents
+ off
);
8953 bfd_putl32 (o
->output_offset
+ o
->output_section
->vma
,
8955 bfd_putl32 (o
->size
, dmtp
->length
);
8958 off
+= sizeof (struct vms_dmt_psect
);
8961 bfd_putl32 (psect_count
, dmth
->psect_count
);
8966 contents
= bfd_zalloc (info
->output_bfd
, off
);
8967 if (contents
== NULL
)
8969 dmt
->contents
= contents
;
8974 BFD_ASSERT (off
== dmt
->size
);
8982 /* Read the contents of a section.
8983 buf points to a buffer of buf_size bytes to be filled with
8984 section data (starting at offset into section) */
8987 alpha_vms_get_section_contents (bfd
*abfd
, asection
*section
,
8988 void *buf
, file_ptr offset
,
8989 bfd_size_type count
)
8993 /* Image are easy. */
8994 if (bfd_get_file_flags (abfd
) & (EXEC_P
| DYNAMIC
))
8995 return _bfd_generic_get_section_contents (abfd
, section
,
8996 buf
, offset
, count
);
8999 if (offset
+ count
< count
9000 || offset
+ count
> section
->size
)
9002 bfd_set_error (bfd_error_invalid_operation
);
9006 /* If the section is already in memory, just copy it. */
9007 if (section
->flags
& SEC_IN_MEMORY
)
9009 BFD_ASSERT (section
->contents
!= NULL
);
9010 memcpy (buf
, section
->contents
+ offset
, count
);
9013 if (section
->size
== 0)
9016 /* Alloc in memory and read ETIRs. */
9017 for (sec
= abfd
->sections
; sec
; sec
= sec
->next
)
9019 BFD_ASSERT (sec
->contents
== NULL
);
9021 if (sec
->size
!= 0 && (sec
->flags
& SEC_HAS_CONTENTS
))
9023 sec
->contents
= bfd_alloc (abfd
, sec
->size
);
9024 if (sec
->contents
== NULL
)
9028 if (!alpha_vms_read_sections_content (abfd
, NULL
))
9030 for (sec
= abfd
->sections
; sec
; sec
= sec
->next
)
9032 sec
->flags
|= SEC_IN_MEMORY
;
9033 memcpy (buf
, section
->contents
+ offset
, count
);
9038 /* Set the format of a file being written. */
9041 alpha_vms_mkobject (bfd
* abfd
)
9043 const bfd_arch_info_type
*arch
;
9045 vms_debug2 ((1, "alpha_vms_mkobject (%p)\n", abfd
));
9047 if (!vms_initialize (abfd
))
9050 PRIV (recwr
.buf
) = bfd_alloc (abfd
, MAX_OUTREC_SIZE
);
9051 if (PRIV (recwr
.buf
) == NULL
)
9054 arch
= bfd_scan_arch ("alpha");
9058 bfd_set_error (bfd_error_wrong_format
);
9062 abfd
->arch_info
= arch
;
9069 /* Called when the BFD is being closed to do any necessary cleanup. */
9072 vms_close_and_cleanup (bfd
* abfd
)
9074 vms_debug2 ((1, "vms_close_and_cleanup (%p)\n", abfd
));
9076 if (abfd
== NULL
|| abfd
->tdata
.any
== NULL
)
9079 if (abfd
->format
== bfd_archive
)
9081 bfd_release (abfd
, abfd
->tdata
.any
);
9082 abfd
->tdata
.any
= NULL
;
9086 if (PRIV (recrd
.buf
) != NULL
)
9087 free (PRIV (recrd
.buf
));
9089 if (PRIV (sections
) != NULL
)
9090 free (PRIV (sections
));
9092 bfd_release (abfd
, abfd
->tdata
.any
);
9093 abfd
->tdata
.any
= NULL
;
9096 if (abfd
->direction
== write_direction
)
9098 /* Last step on VMS is to convert the file to variable record length
9100 if (bfd_cache_close (abfd
) != TRUE
)
9102 if (_bfd_vms_convert_to_var_unix_filename (abfd
->filename
) != TRUE
)
9110 /* Called when a new section is created. */
9113 vms_new_section_hook (bfd
* abfd
, asection
*section
)
9117 vms_debug2 ((1, "vms_new_section_hook (%p, [%d]%s)\n",
9118 abfd
, section
->index
, section
->name
));
9120 if (! bfd_set_section_alignment (abfd
, section
, 0))
9123 vms_debug2 ((7, "%d: %s\n", section
->index
, section
->name
));
9125 amt
= sizeof (struct vms_section_data_struct
);
9126 section
->used_by_bfd
= bfd_zalloc (abfd
, amt
);
9127 if (section
->used_by_bfd
== NULL
)
9130 /* Create the section symbol. */
9131 return _bfd_generic_new_section_hook (abfd
, section
);
9134 /* Part 4.5, symbols. */
9136 /* Print symbol to file according to how. how is one of
9137 bfd_print_symbol_name just print the name
9138 bfd_print_symbol_more print more (???)
9139 bfd_print_symbol_all print all we know, which is not much right now :-). */
9142 vms_print_symbol (bfd
* abfd
,
9145 bfd_print_symbol_type how
)
9147 vms_debug2 ((1, "vms_print_symbol (%p, %p, %p, %d)\n",
9148 abfd
, file
, symbol
, how
));
9152 case bfd_print_symbol_name
:
9153 case bfd_print_symbol_more
:
9154 fprintf ((FILE *)file
," %s", symbol
->name
);
9157 case bfd_print_symbol_all
:
9159 const char *section_name
= symbol
->section
->name
;
9161 bfd_print_symbol_vandf (abfd
, file
, symbol
);
9163 fprintf ((FILE *) file
," %-8s %s", section_name
, symbol
->name
);
9169 /* Return information about symbol in ret.
9171 fill type, value and name
9174 B bss segment symbol
9176 D data segment symbol
9178 t a static function symbol
9179 T text segment symbol
9184 vms_get_symbol_info (bfd
* abfd ATTRIBUTE_UNUSED
,
9190 vms_debug2 ((1, "vms_get_symbol_info (%p, %p, %p)\n", abfd
, symbol
, ret
));
9192 sec
= symbol
->section
;
9199 else if (bfd_is_com_section (sec
))
9201 else if (bfd_is_abs_section (sec
))
9203 else if (bfd_is_und_section (sec
))
9205 else if (bfd_is_ind_section (sec
))
9207 else if ((symbol
->flags
& BSF_FUNCTION
)
9208 || (bfd_get_section_flags (abfd
, sec
) & SEC_CODE
))
9210 else if (bfd_get_section_flags (abfd
, sec
) & SEC_DATA
)
9212 else if (bfd_get_section_flags (abfd
, sec
) & SEC_ALLOC
)
9217 if (ret
->type
!= 'U')
9218 ret
->value
= symbol
->value
+ symbol
->section
->vma
;
9221 ret
->name
= symbol
->name
;
9224 /* Return TRUE if the given symbol sym in the BFD abfd is
9225 a compiler generated local label, else return FALSE. */
9228 vms_bfd_is_local_label_name (bfd
* abfd ATTRIBUTE_UNUSED
,
9231 vms_debug2 ((1, "vms_bfd_is_local_label_name (%p, %s)\n", abfd
, name
));
9232 return name
[0] == '$';
9235 /* Part 4.7, writing an object file. */
9237 /* Sets the contents of the section section in BFD abfd to the data starting
9238 in memory at LOCATION. The data is written to the output section starting
9239 at offset offset for count bytes.
9241 Normally TRUE is returned, else FALSE. Possible error returns are:
9242 o bfd_error_no_contents - The output section does not have the
9243 SEC_HAS_CONTENTS attribute, so nothing can be written to it.
9244 o and some more too */
9247 _bfd_vms_set_section_contents (bfd
* abfd
,
9249 const void * location
,
9251 bfd_size_type count
)
9253 if (section
->contents
== NULL
)
9255 section
->contents
= bfd_alloc (abfd
, section
->size
);
9256 if (section
->contents
== NULL
)
9259 memcpy (section
->contents
+ offset
, location
, (size_t) count
);
9265 /* Set the architecture and machine type in BFD abfd to arch and mach.
9266 Find the correct pointer to a structure and insert it into the arch_info
9270 alpha_vms_set_arch_mach (bfd
*abfd
,
9271 enum bfd_architecture arch
, unsigned long mach
)
9273 if (arch
!= bfd_arch_alpha
9274 && arch
!= bfd_arch_unknown
)
9277 return bfd_default_set_arch_mach (abfd
, arch
, mach
);
9280 /* Set section VMS flags. Clear NO_FLAGS and set FLAGS. */
9283 bfd_vms_set_section_flags (bfd
*abfd ATTRIBUTE_UNUSED
,
9284 asection
*sec
, flagword no_flags
, flagword flags
)
9286 vms_section_data (sec
)->no_flags
= no_flags
;
9287 vms_section_data (sec
)->flags
= flags
;
9290 struct vms_private_data_struct
*
9291 bfd_vms_get_data (bfd
*abfd
)
9293 return (struct vms_private_data_struct
*)abfd
->tdata
.any
;
9296 #define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
9297 #define vms_bfd_link_just_syms _bfd_generic_link_just_syms
9298 #define vms_bfd_copy_link_hash_symbol_type \
9299 _bfd_generic_copy_link_hash_symbol_type
9300 #define vms_bfd_is_group_section bfd_generic_is_group_section
9301 #define vms_bfd_discard_group bfd_generic_discard_group
9302 #define vms_section_already_linked _bfd_generic_section_already_linked
9303 #define vms_bfd_define_common_symbol bfd_generic_define_common_symbol
9304 #define vms_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
9306 #define vms_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
9307 #define vms_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
9308 #define vms_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
9309 #define vms_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
9310 #define vms_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
9311 #define vms_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
9313 /* Symbols table. */
9314 #define alpha_vms_make_empty_symbol _bfd_generic_make_empty_symbol
9315 #define alpha_vms_bfd_is_target_special_symbol \
9316 ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
9317 #define alpha_vms_print_symbol vms_print_symbol
9318 #define alpha_vms_get_symbol_info vms_get_symbol_info
9319 #define alpha_vms_read_minisymbols _bfd_generic_read_minisymbols
9320 #define alpha_vms_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
9321 #define alpha_vms_get_lineno _bfd_nosymbols_get_lineno
9322 #define alpha_vms_find_inliner_info _bfd_nosymbols_find_inliner_info
9323 #define alpha_vms_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
9324 #define alpha_vms_find_nearest_line _bfd_vms_find_nearest_dst_line
9325 #define alpha_vms_bfd_is_local_label_name vms_bfd_is_local_label_name
9327 /* Generic table. */
9328 #define alpha_vms_close_and_cleanup vms_close_and_cleanup
9329 #define alpha_vms_bfd_free_cached_info vms_bfd_free_cached_info
9330 #define alpha_vms_new_section_hook vms_new_section_hook
9331 #define alpha_vms_set_section_contents _bfd_vms_set_section_contents
9332 #define alpha_vms_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
9334 #define alpha_vms_bfd_get_relocated_section_contents \
9335 bfd_generic_get_relocated_section_contents
9337 #define alpha_vms_bfd_relax_section bfd_generic_relax_section
9338 #define alpha_vms_bfd_gc_sections bfd_generic_gc_sections
9339 #define alpha_vms_bfd_lookup_section_flags bfd_generic_lookup_section_flags
9340 #define alpha_vms_bfd_merge_sections bfd_generic_merge_sections
9341 #define alpha_vms_bfd_is_group_section bfd_generic_is_group_section
9342 #define alpha_vms_bfd_discard_group bfd_generic_discard_group
9343 #define alpha_vms_section_already_linked \
9344 _bfd_generic_section_already_linked
9346 #define alpha_vms_bfd_define_common_symbol bfd_generic_define_common_symbol
9347 #define alpha_vms_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
9348 #define alpha_vms_bfd_link_just_syms _bfd_generic_link_just_syms
9349 #define alpha_vms_bfd_copy_link_hash_symbol_type \
9350 _bfd_generic_copy_link_hash_symbol_type
9352 #define alpha_vms_bfd_link_split_section _bfd_generic_link_split_section
9354 #define alpha_vms_get_dynamic_symtab_upper_bound \
9355 _bfd_nodynamic_get_dynamic_symtab_upper_bound
9356 #define alpha_vms_canonicalize_dynamic_symtab \
9357 _bfd_nodynamic_canonicalize_dynamic_symtab
9358 #define alpha_vms_get_dynamic_reloc_upper_bound \
9359 _bfd_nodynamic_get_dynamic_reloc_upper_bound
9360 #define alpha_vms_canonicalize_dynamic_reloc \
9361 _bfd_nodynamic_canonicalize_dynamic_reloc
9363 const bfd_target vms_alpha_vec
=
9365 "vms-alpha", /* Name. */
9366 bfd_target_evax_flavour
,
9367 BFD_ENDIAN_LITTLE
, /* Data byte order is little. */
9368 BFD_ENDIAN_LITTLE
, /* Header byte order is little. */
9370 (HAS_RELOC
| EXEC_P
| HAS_LINENO
| HAS_DEBUG
| HAS_SYMS
| HAS_LOCALS
9371 | WP_TEXT
| D_PAGED
), /* Object flags. */
9372 (SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
9373 | SEC_READONLY
| SEC_CODE
| SEC_DATA
9374 | SEC_HAS_CONTENTS
| SEC_IN_MEMORY
), /* Sect flags. */
9375 0, /* symbol_leading_char. */
9376 ' ', /* ar_pad_char. */
9377 15, /* ar_max_namelen. */
9378 0, /* match priority. */
9379 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
9380 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
9381 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
,
9382 bfd_getl64
, bfd_getl_signed_64
, bfd_putl64
,
9383 bfd_getl32
, bfd_getl_signed_32
, bfd_putl32
,
9384 bfd_getl16
, bfd_getl_signed_16
, bfd_putl16
,
9386 {_bfd_dummy_target
, alpha_vms_object_p
, /* bfd_check_format. */
9387 _bfd_vms_lib_alpha_archive_p
, _bfd_dummy_target
},
9388 {bfd_false
, alpha_vms_mkobject
, /* bfd_set_format. */
9389 _bfd_vms_lib_alpha_mkarchive
, bfd_false
},
9390 {bfd_false
, alpha_vms_write_object_contents
, /* bfd_write_contents. */
9391 _bfd_vms_lib_write_archive_contents
, bfd_false
},
9393 BFD_JUMP_TABLE_GENERIC (alpha_vms
),
9394 BFD_JUMP_TABLE_COPY (vms
),
9395 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
9396 BFD_JUMP_TABLE_ARCHIVE (_bfd_vms_lib
),
9397 BFD_JUMP_TABLE_SYMBOLS (alpha_vms
),
9398 BFD_JUMP_TABLE_RELOCS (alpha_vms
),
9399 BFD_JUMP_TABLE_WRITE (alpha_vms
),
9400 BFD_JUMP_TABLE_LINK (alpha_vms
),
9401 BFD_JUMP_TABLE_DYNAMIC (alpha_vms
),