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