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