00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "bfd.h"
00027 #include "sysdep.h"
00028 #include "bfdlink.h"
00029 #include "libbfd.h"
00030
00031 #include "vms.h"
00032
00033 static bfd_boolean vms_initialize
00034 PARAMS ((bfd *));
00035 static unsigned int priv_section_count;
00036 static bfd_boolean fill_section_ptr
00037 PARAMS ((struct bfd_hash_entry *, PTR));
00038 static bfd_boolean vms_fixup_sections
00039 PARAMS ((bfd *));
00040 static bfd_boolean copy_symbols
00041 PARAMS ((struct bfd_hash_entry *, PTR));
00042 static bfd_reloc_status_type reloc_nil
00043 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
00044 static const struct bfd_target *vms_object_p
00045 PARAMS ((bfd *abfd));
00046 static const struct bfd_target *vms_archive_p
00047 PARAMS ((bfd *abfd));
00048 static bfd_boolean vms_mkobject
00049 PARAMS ((bfd *abfd));
00050 static bfd_boolean vms_write_object_contents
00051 PARAMS ((bfd *abfd));
00052 static bfd_boolean vms_close_and_cleanup
00053 PARAMS ((bfd *abfd));
00054 static bfd_boolean vms_bfd_free_cached_info
00055 PARAMS ((bfd *abfd));
00056 static bfd_boolean vms_new_section_hook
00057 PARAMS ((bfd *abfd, asection *section));
00058 static bfd_boolean vms_get_section_contents
00059 PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2,
00060 bfd_size_type x3));
00061 static bfd_boolean vms_get_section_contents_in_window
00062 PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset,
00063 bfd_size_type count));
00064 static bfd_boolean vms_bfd_copy_private_bfd_data
00065 PARAMS ((bfd *src, bfd *dest));
00066 static bfd_boolean vms_bfd_copy_private_section_data
00067 PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec));
00068 static bfd_boolean vms_bfd_copy_private_symbol_data
00069 PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
00070 static bfd_boolean vms_bfd_print_private_bfd_data
00071 PARAMS ((bfd *abfd, void *file));
00072 static char *vms_core_file_failing_command
00073 PARAMS ((bfd *abfd));
00074 static int vms_core_file_failing_signal
00075 PARAMS ((bfd *abfd));
00076 static bfd_boolean vms_core_file_matches_executable_p
00077 PARAMS ((bfd *abfd, bfd *bbfd));
00078 static bfd_boolean vms_slurp_armap
00079 PARAMS ((bfd *abfd));
00080 static bfd_boolean vms_slurp_extended_name_table
00081 PARAMS ((bfd *abfd));
00082 static bfd_boolean vms_construct_extended_name_table
00083 PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen,
00084 const char **name));
00085 static void vms_truncate_arname
00086 PARAMS ((bfd *abfd, const char *pathname, char *arhdr));
00087 static bfd_boolean vms_write_armap
00088 PARAMS ((bfd *arch, unsigned int elength, struct orl *map,
00089 unsigned int orl_count, int stridx));
00090 static PTR vms_read_ar_hdr
00091 PARAMS ((bfd *abfd));
00092 static bfd *vms_get_elt_at_index
00093 PARAMS ((bfd *abfd, symindex index));
00094 static bfd *vms_openr_next_archived_file
00095 PARAMS ((bfd *arch, bfd *prev));
00096 static bfd_boolean vms_update_armap_timestamp
00097 PARAMS ((bfd *abfd));
00098 static int vms_generic_stat_arch_elt
00099 PARAMS ((bfd *, struct stat *));
00100 static long vms_get_symtab_upper_bound
00101 PARAMS ((bfd *abfd));
00102 static long vms_canonicalize_symtab
00103 PARAMS ((bfd *abfd, asymbol **symbols));
00104 static void vms_print_symbol
00105 PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how));
00106 static void vms_get_symbol_info
00107 PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret));
00108 static bfd_boolean vms_bfd_is_local_label_name
00109 PARAMS ((bfd *abfd, const char *));
00110 static alent *vms_get_lineno
00111 PARAMS ((bfd *abfd, asymbol *symbol));
00112 static bfd_boolean vms_find_nearest_line
00113 PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset,
00114 const char **file, const char **func, unsigned int *line));
00115 static asymbol *vms_bfd_make_debug_symbol
00116 PARAMS ((bfd *abfd, void *ptr, unsigned long size));
00117 static long vms_read_minisymbols
00118 PARAMS ((bfd *abfd, bfd_boolean dynamic, PTR *minisymsp,
00119 unsigned int *sizep));
00120 static asymbol *vms_minisymbol_to_symbol
00121 PARAMS ((bfd *abfd, bfd_boolean dynamic, const PTR minisym, asymbol *sym));
00122 static long vms_get_reloc_upper_bound
00123 PARAMS ((bfd *abfd, asection *sect));
00124 static long vms_canonicalize_reloc
00125 PARAMS ((bfd *abfd, asection *srcsec, arelent **location,
00126 asymbol **symbols));
00127 static const struct reloc_howto_struct *vms_bfd_reloc_type_lookup
00128 PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
00129 static bfd_boolean vms_set_arch_mach
00130 PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach));
00131 static bfd_boolean vms_set_section_contents
00132 PARAMS ((bfd *abfd, asection *section, const PTR location, file_ptr offset,
00133 bfd_size_type count));
00134 static int vms_sizeof_headers
00135 PARAMS ((bfd *abfd, bfd_boolean reloc));
00136 static bfd_byte *vms_bfd_get_relocated_section_contents
00137 PARAMS ((bfd *abfd, struct bfd_link_info *link_info,
00138 struct bfd_link_order *link_order, bfd_byte *data,
00139 bfd_boolean relocatable, asymbol **symbols));
00140 static bfd_boolean vms_bfd_relax_section
00141 PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info,
00142 bfd_boolean *again));
00143 static bfd_boolean vms_bfd_gc_sections
00144 PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
00145 static bfd_boolean vms_bfd_merge_sections
00146 PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
00147 static struct bfd_link_hash_table *vms_bfd_link_hash_table_create
00148 PARAMS ((bfd *abfd));
00149 static void vms_bfd_link_hash_table_free
00150 PARAMS ((struct bfd_link_hash_table *hash));
00151 static bfd_boolean vms_bfd_link_add_symbols
00152 PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
00153 static bfd_boolean vms_bfd_final_link
00154 PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
00155 static bfd_boolean vms_bfd_link_split_section
00156 PARAMS ((bfd *abfd, asection *section));
00157 static long vms_get_dynamic_symtab_upper_bound
00158 PARAMS ((bfd *abfd));
00159 static long vms_canonicalize_dynamic_symtab
00160 PARAMS ((bfd *abfd, asymbol **symbols));
00161 #define vms_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab
00162 static long vms_get_dynamic_reloc_upper_bound
00163 PARAMS ((bfd *abfd));
00164 static long vms_canonicalize_dynamic_reloc
00165 PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols));
00166 static bfd_boolean vms_bfd_merge_private_bfd_data
00167 PARAMS ((bfd *ibfd, bfd *obfd));
00168 static bfd_boolean vms_bfd_set_private_flags
00169 PARAMS ((bfd *abfd, flagword flags));
00170
00171 #define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
00172 #define vms_make_empty_symbol _bfd_generic_make_empty_symbol
00173 #define vms_bfd_link_just_syms _bfd_generic_link_just_syms
00174 #define vms_bfd_is_group_section bfd_generic_is_group_section
00175 #define vms_bfd_discard_group bfd_generic_discard_group
00176 #define vms_section_already_linked \
00177 _bfd_generic_section_already_linked
00178 #define vms_bfd_copy_private_header_data \
00179 _bfd_generic_bfd_copy_private_header_data
00180
00181
00182
00183 const bfd_target vms_alpha_vec =
00184 {
00185 "vms-alpha",
00186 bfd_target_evax_flavour,
00187 BFD_ENDIAN_LITTLE,
00188 BFD_ENDIAN_LITTLE,
00189
00190 (HAS_RELOC | HAS_SYMS
00191 | WP_TEXT | D_PAGED),
00192 (SEC_ALLOC | SEC_LOAD | SEC_RELOC
00193 | SEC_READONLY | SEC_CODE | SEC_DATA
00194 | SEC_HAS_CONTENTS | SEC_IN_MEMORY),
00195 0,
00196 ' ',
00197 15,
00198 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00199 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00200 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
00201 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00202 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00203 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
00204
00205 {_bfd_dummy_target, vms_object_p,
00206 vms_archive_p, _bfd_dummy_target},
00207 {bfd_false, vms_mkobject,
00208 _bfd_generic_mkarchive, bfd_false},
00209 {bfd_false, vms_write_object_contents,
00210 _bfd_write_archive_contents, bfd_false},
00211
00212 BFD_JUMP_TABLE_GENERIC (vms),
00213 BFD_JUMP_TABLE_COPY (vms),
00214 BFD_JUMP_TABLE_CORE (vms),
00215 BFD_JUMP_TABLE_ARCHIVE (vms),
00216 BFD_JUMP_TABLE_SYMBOLS (vms),
00217 BFD_JUMP_TABLE_RELOCS (vms),
00218 BFD_JUMP_TABLE_WRITE (vms),
00219 BFD_JUMP_TABLE_LINK (vms),
00220 BFD_JUMP_TABLE_DYNAMIC (vms),
00221
00222 NULL,
00223
00224 (PTR) 0
00225 };
00226
00227 const bfd_target vms_vax_vec =
00228 {
00229 "vms-vax",
00230 bfd_target_ovax_flavour,
00231 BFD_ENDIAN_LITTLE,
00232 BFD_ENDIAN_LITTLE,
00233
00234 (HAS_RELOC | HAS_SYMS
00235 | WP_TEXT | D_PAGED
00236 | HAS_LINENO | HAS_DEBUG | HAS_LOCALS),
00237
00238 (SEC_ALLOC | SEC_LOAD | SEC_RELOC
00239 | SEC_READONLY | SEC_CODE | SEC_DATA
00240 | SEC_HAS_CONTENTS | SEC_IN_MEMORY),
00241 0,
00242 ' ',
00243 15,
00244 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00245 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00246 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
00247 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00248 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00249 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
00250
00251 {_bfd_dummy_target, vms_object_p,
00252 vms_archive_p, _bfd_dummy_target},
00253 {bfd_false, vms_mkobject,
00254 _bfd_generic_mkarchive, bfd_false},
00255 {bfd_false, vms_write_object_contents,
00256 _bfd_write_archive_contents, bfd_false},
00257
00258 BFD_JUMP_TABLE_GENERIC (vms),
00259 BFD_JUMP_TABLE_COPY (vms),
00260 BFD_JUMP_TABLE_CORE (vms),
00261 BFD_JUMP_TABLE_ARCHIVE (vms),
00262 BFD_JUMP_TABLE_SYMBOLS (vms),
00263 BFD_JUMP_TABLE_RELOCS (vms),
00264 BFD_JUMP_TABLE_WRITE (vms),
00265 BFD_JUMP_TABLE_LINK (vms),
00266 BFD_JUMP_TABLE_DYNAMIC (vms),
00267
00268 NULL,
00269
00270 (PTR) 0
00271 };
00272
00273
00274
00275
00276
00277 static bfd_boolean
00278 vms_initialize (abfd)
00279 bfd *abfd;
00280 {
00281 int i;
00282 bfd_size_type amt;
00283
00284 bfd_set_start_address (abfd, (bfd_vma) -1);
00285
00286 amt = sizeof (struct vms_private_data_struct);
00287 abfd->tdata.any = (struct vms_private_data_struct*) bfd_alloc (abfd, amt);
00288 if (abfd->tdata.any == 0)
00289 return FALSE;
00290
00291 #ifdef __ALPHA
00292 PRIV (is_vax) = 0;
00293 #else
00294 PRIV (is_vax) = 1;
00295 #endif
00296 PRIV (vms_buf) = 0;
00297 PRIV (buf_size) = 0;
00298 PRIV (rec_length) = 0;
00299 PRIV (file_format) = FF_UNKNOWN;
00300 PRIV (fixup_done) = FALSE;
00301 PRIV (sections) = NULL;
00302
00303 amt = sizeof (struct stack_struct) * STACKSIZE;
00304 PRIV (stack) = (struct stack_struct *) bfd_alloc (abfd, amt);
00305 if (PRIV (stack) == 0)
00306 goto error_ret1;
00307 PRIV (stackptr) = 0;
00308
00309 amt = sizeof (struct bfd_hash_table);
00310 PRIV (vms_symbol_table) = (struct bfd_hash_table *) bfd_alloc (abfd, amt);
00311 if (PRIV (vms_symbol_table) == 0)
00312 goto error_ret1;
00313
00314 if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc))
00315 goto error_ret1;
00316
00317 amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE;
00318 PRIV (location_stack) = (struct location_struct *) bfd_alloc (abfd, amt);
00319 if (PRIV (location_stack) == 0)
00320 goto error_ret2;
00321
00322 for (i = 0; i < VMS_SECTION_COUNT; i++)
00323 PRIV (vms_section_table)[i] = NULL;
00324
00325 amt = MAX_OUTREC_SIZE;
00326 PRIV (output_buf) = (unsigned char *) bfd_alloc (abfd, amt);
00327 if (PRIV (output_buf) == 0)
00328 goto error_ret2;
00329
00330 PRIV (push_level) = 0;
00331 PRIV (pushed_size) = 0;
00332 PRIV (length_pos) = 2;
00333 PRIV (output_size) = 0;
00334 PRIV (output_alignment) = 1;
00335
00336 return TRUE;
00337
00338 error_ret2:
00339 bfd_hash_table_free (PRIV (vms_symbol_table));
00340 error_ret1:
00341 bfd_release (abfd, abfd->tdata.any);
00342 abfd->tdata.any = 0;
00343 return FALSE;
00344 }
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355 static bfd_boolean
00356 fill_section_ptr (entry, sections)
00357 struct bfd_hash_entry *entry;
00358 PTR sections;
00359 {
00360 asection *sec;
00361 asymbol *sym;
00362
00363 sym = ((vms_symbol_entry *)entry)->symbol;
00364 sec = sym->section;
00365
00366 #if VMS_DEBUG
00367 vms_debug (6, "fill_section_ptr: sym %p, sec %p\n", sym, sec);
00368 #endif
00369
00370
00371
00372 if ((unsigned int) (size_t) sec < priv_section_count)
00373 {
00374 sec = ((vms_symbol_entry *) entry)->symbol->section =
00375 ((asection **) sections)[(unsigned int) (size_t) sec];
00376 }
00377
00378 if (strcmp (sym->name, sec->name) == 0)
00379 sym->flags |= BSF_SECTION_SYM;
00380
00381 return TRUE;
00382 }
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393 static bfd_boolean
00394 vms_fixup_sections (abfd)
00395 bfd *abfd;
00396 {
00397 if (PRIV (fixup_done))
00398 return TRUE;
00399
00400
00401
00402
00403
00404
00405 priv_section_count = PRIV (section_count);
00406 bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr,
00407 (PTR) (PRIV (sections)));
00408
00409 PRIV (fixup_done) = TRUE;
00410
00411 return TRUE;
00412 }
00413
00414
00415
00416
00417
00418
00419 static const struct bfd_target *
00420 vms_object_p (abfd)
00421 bfd *abfd;
00422 {
00423 int err = 0;
00424 int prev_type;
00425 const struct bfd_target *target_vector = 0;
00426 const bfd_arch_info_type *arch = 0;
00427 PTR tdata_save = abfd->tdata.any;
00428 bfd_vma saddr_save = bfd_get_start_address (abfd);
00429
00430 #if VMS_DEBUG
00431 vms_debug (1, "vms_object_p(%p)\n", abfd);
00432 #endif
00433
00434 if (!vms_initialize (abfd))
00435 goto error_ret;
00436
00437 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET))
00438 goto err_wrong_format;
00439
00440 prev_type = -1;
00441
00442 do
00443 {
00444 #if VMS_DEBUG
00445 vms_debug (7, "reading at %08lx\n", bfd_tell(abfd));
00446 #endif
00447 if (_bfd_vms_next_record (abfd) < 0)
00448 {
00449 #if VMS_DEBUG
00450 vms_debug (2, "next_record failed\n");
00451 #endif
00452 goto err_wrong_format;
00453 }
00454
00455 if ((prev_type == EOBJ_S_C_EGSD)
00456 && (PRIV (rec_type) != EOBJ_S_C_EGSD))
00457 {
00458 if (! vms_fixup_sections (abfd))
00459 {
00460 #if VMS_DEBUG
00461 vms_debug (2, "vms_fixup_sections failed\n");
00462 #endif
00463 goto err_wrong_format;
00464 }
00465 }
00466
00467 prev_type = PRIV (rec_type);
00468
00469 if (target_vector == 0)
00470 {
00471 if (prev_type <= OBJ_S_C_MAXRECTYP)
00472 target_vector = &vms_vax_vec;
00473 else
00474 target_vector = &vms_alpha_vec;
00475 }
00476
00477 switch (prev_type)
00478 {
00479 case OBJ_S_C_HDR:
00480 case EOBJ_S_C_EMH:
00481 err = _bfd_vms_slurp_hdr (abfd, prev_type);
00482 break;
00483 case OBJ_S_C_EOM:
00484 case OBJ_S_C_EOMW:
00485 case EOBJ_S_C_EEOM:
00486 err = _bfd_vms_slurp_eom (abfd, prev_type);
00487 break;
00488 case OBJ_S_C_GSD:
00489 case EOBJ_S_C_EGSD:
00490 err = _bfd_vms_slurp_gsd (abfd, prev_type);
00491 break;
00492 case OBJ_S_C_TIR:
00493 case EOBJ_S_C_ETIR:
00494 err = _bfd_vms_slurp_tir (abfd, prev_type);
00495 break;
00496 case OBJ_S_C_DBG:
00497 case EOBJ_S_C_EDBG:
00498 err = _bfd_vms_slurp_dbg (abfd, prev_type);
00499 break;
00500 case OBJ_S_C_TBT:
00501 case EOBJ_S_C_ETBT:
00502 err = _bfd_vms_slurp_tbt (abfd, prev_type);
00503 break;
00504 case OBJ_S_C_LNK:
00505 err = _bfd_vms_slurp_lnk (abfd, prev_type);
00506 break;
00507 default:
00508 err = -1;
00509 }
00510 if (err != 0)
00511 {
00512 #if VMS_DEBUG
00513 vms_debug (2, "slurp type %d failed with %d\n", prev_type, err);
00514 #endif
00515 goto err_wrong_format;
00516 }
00517 }
00518 while ((prev_type != EOBJ_S_C_EEOM) && (prev_type != OBJ_S_C_EOM) && (prev_type != OBJ_S_C_EOMW));
00519
00520 if (target_vector == &vms_vax_vec)
00521 {
00522 if (! vms_fixup_sections (abfd))
00523 {
00524 #if VMS_DEBUG
00525 vms_debug (2, "vms_fixup_sections failed\n");
00526 #endif
00527 goto err_wrong_format;
00528 }
00529
00530
00531
00532 arch = bfd_scan_arch ("vax");
00533 PRIV (is_vax) = 1;
00534 #if VMS_DEBUG
00535 vms_debug (2, "arch is vax\n");
00536 #endif
00537 }
00538 else if (target_vector == &vms_alpha_vec)
00539 {
00540
00541
00542 arch = bfd_scan_arch ("alpha");
00543 PRIV (is_vax) = 0;
00544 #if VMS_DEBUG
00545 vms_debug (2, "arch is alpha\n");
00546 #endif
00547 }
00548
00549 if (arch == 0)
00550 {
00551 #if VMS_DEBUG
00552 vms_debug (2, "arch not found\n");
00553 #endif
00554 goto err_wrong_format;
00555 }
00556 abfd->arch_info = arch;
00557
00558 return target_vector;
00559
00560 err_wrong_format:
00561 bfd_set_error (bfd_error_wrong_format);
00562 error_ret:
00563 if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
00564 bfd_release (abfd, abfd->tdata.any);
00565 abfd->tdata.any = tdata_save;
00566 bfd_set_start_address (abfd, saddr_save);
00567 return NULL;
00568 }
00569
00570
00571
00572
00573 static const struct bfd_target *
00574 vms_archive_p (abfd)
00575 bfd *abfd ATTRIBUTE_UNUSED;
00576 {
00577 #if VMS_DEBUG
00578 vms_debug (1, "vms_archive_p(%p)\n", abfd);
00579 #endif
00580
00581 return 0;
00582 }
00583
00584
00585
00586 static bfd_boolean
00587 vms_mkobject (abfd)
00588 bfd *abfd;
00589 {
00590 #if VMS_DEBUG
00591 vms_debug (1, "vms_mkobject(%p)\n", abfd);
00592 #endif
00593
00594 if (!vms_initialize (abfd))
00595 return 0;
00596
00597 {
00598 #ifdef __VAX
00599 const bfd_arch_info_type *arch = bfd_scan_arch ("vax");
00600 #else
00601 const bfd_arch_info_type *arch = bfd_scan_arch ("alpha");
00602 #endif
00603 if (arch == 0)
00604 {
00605 bfd_set_error(bfd_error_wrong_format);
00606 return 0;
00607 }
00608 abfd->arch_info = arch;
00609 }
00610
00611 return TRUE;
00612 }
00613
00614
00615
00616 static bfd_boolean
00617 vms_write_object_contents (abfd)
00618 bfd *abfd;
00619 {
00620 #if VMS_DEBUG
00621 vms_debug (1, "vms_write_object_contents(%p)\n", abfd);
00622 #endif
00623
00624 if (abfd->section_count > 0)
00625 {
00626 if (PRIV (is_vax))
00627 {
00628 if (_bfd_vms_write_hdr (abfd, OBJ_S_C_HDR) != 0)
00629 return FALSE;
00630 if (_bfd_vms_write_gsd (abfd, OBJ_S_C_GSD) != 0)
00631 return FALSE;
00632 if (_bfd_vms_write_tir (abfd, OBJ_S_C_TIR) != 0)
00633 return FALSE;
00634 if (_bfd_vms_write_tbt (abfd, OBJ_S_C_TBT) != 0)
00635 return FALSE;
00636 if (_bfd_vms_write_dbg (abfd, OBJ_S_C_DBG) != 0)
00637 return FALSE;
00638 if (abfd->section_count > 255)
00639 {
00640 if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOMW) != 0)
00641 return FALSE;
00642 }
00643 else
00644 {
00645 if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOM) != 0)
00646 return FALSE;
00647 }
00648 }
00649 else
00650 {
00651 if (_bfd_vms_write_hdr (abfd, EOBJ_S_C_EMH) != 0)
00652 return FALSE;
00653 if (_bfd_vms_write_gsd (abfd, EOBJ_S_C_EGSD) != 0)
00654 return FALSE;
00655 if (_bfd_vms_write_tir (abfd, EOBJ_S_C_ETIR) != 0)
00656 return FALSE;
00657 if (_bfd_vms_write_tbt (abfd, EOBJ_S_C_ETBT) != 0)
00658 return FALSE;
00659 if (_bfd_vms_write_dbg (abfd, EOBJ_S_C_EDBG) != 0)
00660 return FALSE;
00661 if (_bfd_vms_write_eom (abfd, EOBJ_S_C_EEOM) != 0)
00662 return FALSE;
00663 }
00664 }
00665 return TRUE;
00666 }
00667
00668
00669
00670
00671
00672 static bfd_boolean
00673 vms_close_and_cleanup (abfd)
00674 bfd *abfd;
00675 {
00676 #if VMS_DEBUG
00677 vms_debug (1, "vms_close_and_cleanup(%p)\n", abfd);
00678 #endif
00679 if (abfd == 0)
00680 return TRUE;
00681
00682 if (PRIV (vms_buf) != NULL)
00683 free (PRIV (vms_buf));
00684
00685 if (PRIV (sections) != NULL)
00686 free (PRIV (sections));
00687
00688 if (PRIV (vms_symbol_table))
00689 bfd_hash_table_free (PRIV (vms_symbol_table));
00690
00691 bfd_release (abfd, abfd->tdata.any);
00692 abfd->tdata.any = NULL;
00693
00694 return TRUE;
00695 }
00696
00697
00698 static bfd_boolean
00699 vms_bfd_free_cached_info (abfd)
00700 bfd *abfd ATTRIBUTE_UNUSED;
00701 {
00702 #if VMS_DEBUG
00703 vms_debug (1, "vms_bfd_free_cached_info(%p)\n", abfd);
00704 #endif
00705 return TRUE;
00706 }
00707
00708
00709
00710 static bfd_boolean
00711 vms_new_section_hook (abfd, section)
00712 bfd *abfd;
00713 asection *section;
00714 {
00715
00716 unsigned int section_count = abfd->section_count + 1;
00717
00718 #if VMS_DEBUG
00719 vms_debug (1, "vms_new_section_hook (%p, [%d]%s), count %d\n",
00720 abfd, section->index, section->name, section_count);
00721 #endif
00722 bfd_set_section_alignment (abfd, section, 4);
00723
00724 if (section_count > PRIV (section_count))
00725 {
00726 bfd_size_type amt = section_count;
00727 amt *= sizeof (asection *);
00728 PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt);
00729 if (PRIV (sections) == 0)
00730 return FALSE;
00731 PRIV (section_count) = section_count;
00732 }
00733 #if VMS_DEBUG
00734 vms_debug (6, "section_count: %d\n", PRIV (section_count));
00735 #endif
00736 PRIV (sections)[section->index] = section;
00737 #if VMS_DEBUG
00738 vms_debug (7, "%d: %s\n", section->index, section->name);
00739 #endif
00740
00741 return TRUE;
00742 }
00743
00744
00745
00746
00747
00748 static bfd_boolean
00749 vms_get_section_contents (abfd, section, buf, offset, buf_size)
00750 bfd *abfd ATTRIBUTE_UNUSED;
00751 asection *section ATTRIBUTE_UNUSED;
00752 PTR buf ATTRIBUTE_UNUSED;
00753 file_ptr offset ATTRIBUTE_UNUSED;
00754 bfd_size_type buf_size ATTRIBUTE_UNUSED;
00755 {
00756 #if VMS_DEBUG
00757 vms_debug (1, "vms_get_section_contents(%p, %s, %p, off %ld, size %d)\n",
00758 abfd, section->name, buf, offset, (int)buf_size);
00759 #endif
00760
00761
00762
00763 return FALSE;
00764 }
00765
00766
00767
00768
00769
00770 static bfd_boolean
00771 vms_get_section_contents_in_window (abfd, section, w, offset, count)
00772 bfd *abfd ATTRIBUTE_UNUSED;
00773 asection *section ATTRIBUTE_UNUSED;
00774 bfd_window *w ATTRIBUTE_UNUSED;
00775 file_ptr offset ATTRIBUTE_UNUSED;
00776 bfd_size_type count ATTRIBUTE_UNUSED;
00777 {
00778 #if VMS_DEBUG
00779 vms_debug (1, "vms_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n",
00780 abfd, section->name, w, offset, (int)count);
00781 #endif
00782
00783
00784
00785 return FALSE;
00786 }
00787
00788
00789
00790
00791
00792
00793 static bfd_boolean
00794 vms_bfd_copy_private_bfd_data (src, dest)
00795 bfd *src ATTRIBUTE_UNUSED;
00796 bfd *dest ATTRIBUTE_UNUSED;
00797 {
00798 #if VMS_DEBUG
00799 vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest);
00800 #endif
00801 return TRUE;
00802 }
00803
00804
00805
00806
00807
00808
00809
00810
00811 static bfd_boolean
00812 vms_bfd_merge_private_bfd_data (ibfd, obfd)
00813 bfd *ibfd ATTRIBUTE_UNUSED;
00814 bfd *obfd ATTRIBUTE_UNUSED;
00815 {
00816 #if VMS_DEBUG
00817 vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd);
00818 #endif
00819 return TRUE;
00820 }
00821
00822
00823
00824
00825
00826
00827
00828
00829 static bfd_boolean
00830 vms_bfd_set_private_flags (abfd, flags)
00831 bfd *abfd ATTRIBUTE_UNUSED;
00832 flagword flags ATTRIBUTE_UNUSED;
00833 {
00834 #if VMS_DEBUG
00835 vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags);
00836 #endif
00837 return TRUE;
00838 }
00839
00840
00841
00842
00843 static bfd_boolean
00844 vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec)
00845 bfd *srcbfd ATTRIBUTE_UNUSED;
00846 asection *srcsec ATTRIBUTE_UNUSED;
00847 bfd *dstbfd ATTRIBUTE_UNUSED;
00848 asection *dstsec ATTRIBUTE_UNUSED;
00849 {
00850 #if VMS_DEBUG
00851 vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n",
00852 srcbfd, srcsec->name, dstbfd, dstsec->name);
00853 #endif
00854 return TRUE;
00855 }
00856
00857
00858
00859
00860 static bfd_boolean
00861 vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym)
00862 bfd *ibfd ATTRIBUTE_UNUSED;
00863 asymbol *isym ATTRIBUTE_UNUSED;
00864 bfd *obfd ATTRIBUTE_UNUSED;
00865 asymbol *osym ATTRIBUTE_UNUSED;
00866 {
00867 #if VMS_DEBUG
00868 vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n",
00869 ibfd, isym->name, obfd, osym->name);
00870 #endif
00871 return TRUE;
00872 }
00873
00874
00875
00876
00877
00878
00879 static char *
00880 vms_core_file_failing_command (abfd)
00881 bfd *abfd ATTRIBUTE_UNUSED;
00882 {
00883 #if VMS_DEBUG
00884 vms_debug (1, "vms_core_file_failing_command(%p)\n", abfd);
00885 #endif
00886 return 0;
00887 }
00888
00889
00890
00891
00892 static int
00893 vms_core_file_failing_signal (abfd)
00894 bfd *abfd ATTRIBUTE_UNUSED;
00895 {
00896 #if VMS_DEBUG
00897 vms_debug (1, "vms_core_file_failing_signal(%p)\n", abfd);
00898 #endif
00899 return 0;
00900 }
00901
00902
00903
00904
00905 static bfd_boolean
00906 vms_core_file_matches_executable_p (abfd, bbfd)
00907 bfd *abfd ATTRIBUTE_UNUSED;
00908 bfd *bbfd ATTRIBUTE_UNUSED;
00909 {
00910 #if VMS_DEBUG
00911 vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd);
00912 #endif
00913 return FALSE;
00914 }
00915
00916
00917
00918
00919
00920
00921 static bfd_boolean
00922 vms_slurp_armap (abfd)
00923 bfd *abfd ATTRIBUTE_UNUSED;
00924 {
00925 #if VMS_DEBUG
00926 vms_debug (1, "vms_slurp_armap(%p)\n", abfd);
00927 #endif
00928 return FALSE;
00929 }
00930
00931
00932
00933
00934 static bfd_boolean
00935 vms_slurp_extended_name_table (abfd)
00936 bfd *abfd ATTRIBUTE_UNUSED;
00937 {
00938 #if VMS_DEBUG
00939 vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd);
00940 #endif
00941 return FALSE;
00942 }
00943
00944
00945
00946
00947 static bfd_boolean
00948 vms_construct_extended_name_table (abfd, tabloc, tablen, name)
00949 bfd *abfd ATTRIBUTE_UNUSED;
00950 char **tabloc ATTRIBUTE_UNUSED;
00951 bfd_size_type *tablen ATTRIBUTE_UNUSED;
00952 const char **name ATTRIBUTE_UNUSED;
00953 {
00954 #if VMS_DEBUG
00955 vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd);
00956 #endif
00957 return FALSE;
00958 }
00959
00960
00961
00962 static void
00963 vms_truncate_arname (abfd, pathname, arhdr)
00964 bfd *abfd ATTRIBUTE_UNUSED;
00965 const char *pathname ATTRIBUTE_UNUSED;
00966 char *arhdr ATTRIBUTE_UNUSED;
00967 {
00968 #if VMS_DEBUG
00969 vms_debug (1, "vms_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr);
00970 #endif
00971 return;
00972 }
00973
00974
00975
00976 static bfd_boolean
00977 vms_write_armap (arch, elength, map, orl_count, stridx)
00978 bfd *arch ATTRIBUTE_UNUSED;
00979 unsigned int elength ATTRIBUTE_UNUSED;
00980 struct orl *map ATTRIBUTE_UNUSED;
00981 unsigned int orl_count ATTRIBUTE_UNUSED;
00982 int stridx ATTRIBUTE_UNUSED;
00983 {
00984 #if VMS_DEBUG
00985 vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n",
00986 arch, elength, map, orl_count, stridx);
00987 #endif
00988 return TRUE;
00989 }
00990
00991
00992
00993 static PTR
00994 vms_read_ar_hdr (abfd)
00995 bfd * abfd ATTRIBUTE_UNUSED;
00996 {
00997 #if VMS_DEBUG
00998 vms_debug (1, "vms_read_ar_hdr(%p)\n", abfd);
00999 #endif
01000 return (PTR)0;
01001 }
01002
01003
01004
01005
01006
01007
01008
01009 static bfd *
01010 vms_openr_next_archived_file (arch, prev)
01011 bfd *arch ATTRIBUTE_UNUSED;
01012 bfd *prev ATTRIBUTE_UNUSED;
01013 {
01014 #if VMS_DEBUG
01015 vms_debug (1, "vms_openr_next_archived_file(%p, %p)\n", arch, prev);
01016 #endif
01017 return NULL;
01018 }
01019
01020
01021
01022
01023 static bfd *
01024 vms_get_elt_at_index (abfd, index)
01025 bfd *abfd;
01026 symindex index;
01027 {
01028 #if VMS_DEBUG
01029 vms_debug (1, "vms_get_elt_at_index(%p, %p)\n", abfd, index);
01030 #endif
01031 return _bfd_generic_get_elt_at_index(abfd, index);
01032 }
01033
01034
01035
01036
01037 static int
01038 vms_generic_stat_arch_elt (abfd, st)
01039 bfd *abfd;
01040 struct stat *st;
01041 {
01042 #if VMS_DEBUG
01043 vms_debug (1, "vms_generic_stat_arch_elt(%p, %p)\n", abfd, st);
01044 #endif
01045 return bfd_generic_stat_arch_elt (abfd, st);
01046 }
01047
01048
01049
01050 static bfd_boolean
01051 vms_update_armap_timestamp (abfd)
01052 bfd *abfd ATTRIBUTE_UNUSED;
01053 {
01054 #if VMS_DEBUG
01055 vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd);
01056 #endif
01057 return TRUE;
01058 }
01059
01060
01061
01062
01063
01064
01065
01066
01067 static long
01068 vms_get_symtab_upper_bound (abfd)
01069 bfd *abfd;
01070 {
01071 #if VMS_DEBUG
01072 vms_debug (1, "vms_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV (gsd_sym_count));
01073 #endif
01074 return (PRIV (gsd_sym_count)+1) * sizeof (asymbol *);
01075 }
01076
01077
01078
01079
01080
01081
01082 static bfd_boolean
01083 copy_symbols (entry, arg)
01084 struct bfd_hash_entry *entry;
01085 PTR arg;
01086 {
01087 bfd *abfd = (bfd *) arg;
01088
01089 if (entry == NULL)
01090 PRIV (symnum) = 0;
01091 else
01092 PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol;
01093
01094 return TRUE;
01095 }
01096
01097
01098
01099
01100
01101
01102 static long
01103 vms_canonicalize_symtab (abfd, symbols)
01104 bfd *abfd;
01105 asymbol **symbols;
01106 {
01107 #if VMS_DEBUG
01108 vms_debug (1, "vms_canonicalize_symtab(%p, <ret>)\n", abfd);
01109 #endif
01110
01111
01112 (void)copy_symbols((struct bfd_hash_entry *)0, abfd);
01113
01114
01115
01116 PRIV (symcache) = symbols;
01117 bfd_hash_traverse(PRIV (vms_symbol_table), copy_symbols, (PTR)abfd);
01118
01119 symbols[PRIV (gsd_sym_count)] = NULL;
01120
01121 return PRIV (gsd_sym_count);
01122 }
01123
01124
01125
01126
01127
01128
01129 static void
01130 vms_print_symbol (abfd, file, symbol, how)
01131 bfd *abfd;
01132 PTR file;
01133 asymbol *symbol;
01134 bfd_print_symbol_type how;
01135 {
01136 #if VMS_DEBUG
01137 vms_debug (1, "vms_print_symbol(%p, %p, %p, %d)\n", abfd, file, symbol, how);
01138 #endif
01139
01140 switch (how)
01141 {
01142 case bfd_print_symbol_name:
01143 case bfd_print_symbol_more:
01144 fprintf ((FILE *)file," %s", symbol->name);
01145 break;
01146
01147 case bfd_print_symbol_all:
01148 {
01149 const char *section_name = symbol->section->name;
01150
01151 bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
01152
01153 fprintf ((FILE *)file," %-8s %s", section_name, symbol->name);
01154 }
01155 break;
01156 }
01157 return;
01158 }
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174 static void
01175 vms_get_symbol_info (abfd, symbol, ret)
01176 bfd *abfd ATTRIBUTE_UNUSED;
01177 asymbol *symbol;
01178 symbol_info *ret;
01179 {
01180 asection *sec;
01181
01182 #if VMS_DEBUG
01183 vms_debug (1, "vms_get_symbol_info(%p, %p, %p)\n", abfd, symbol, ret);
01184 #endif
01185
01186 sec = symbol->section;
01187
01188 if (ret == 0)
01189 return;
01190
01191 if (bfd_is_com_section (sec))
01192 ret->type = 'C';
01193 else if (bfd_is_abs_section (sec))
01194 ret->type = 'A';
01195 else if (bfd_is_und_section (sec))
01196 ret->type = 'U';
01197 else if (bfd_is_ind_section (sec))
01198 ret->type = 'I';
01199 else if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
01200 ret->type = 'T';
01201 else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
01202 ret->type = 'D';
01203 else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
01204 ret->type = 'B';
01205 else
01206 ret->type = '-';
01207
01208 if (ret->type != 'U')
01209 ret->value = symbol->value + symbol->section->vma;
01210 else
01211 ret->value = 0;
01212 ret->name = symbol->name;
01213
01214 return;
01215 }
01216
01217
01218
01219
01220 static bfd_boolean
01221 vms_bfd_is_local_label_name (abfd, name)
01222 bfd *abfd ATTRIBUTE_UNUSED;
01223 const char *name;
01224 {
01225 #if VMS_DEBUG
01226 vms_debug (1, "vms_bfd_is_local_label_name(%p, %s)\n", abfd, name);
01227 #endif
01228 return name[0] == '$';
01229 }
01230
01231
01232
01233 static alent *
01234 vms_get_lineno (abfd, symbol)
01235 bfd *abfd ATTRIBUTE_UNUSED;
01236 asymbol *symbol ATTRIBUTE_UNUSED;
01237 {
01238 #if VMS_DEBUG
01239 vms_debug (1, "vms_get_lineno(%p, %p)\n", abfd, symbol);
01240 #endif
01241 return 0;
01242 }
01243
01244
01245
01246
01247
01248 static bfd_boolean
01249 vms_find_nearest_line (abfd, section, symbols, offset, file, func, line)
01250 bfd *abfd ATTRIBUTE_UNUSED;
01251 asection *section ATTRIBUTE_UNUSED;
01252 asymbol **symbols ATTRIBUTE_UNUSED;
01253 bfd_vma offset ATTRIBUTE_UNUSED;
01254 const char **file ATTRIBUTE_UNUSED;
01255 const char **func ATTRIBUTE_UNUSED;
01256 unsigned int *line ATTRIBUTE_UNUSED;
01257 {
01258 #if VMS_DEBUG
01259 vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n",
01260 abfd, section->name, symbols, (long int)offset);
01261 #endif
01262 return FALSE;
01263 }
01264
01265
01266
01267
01268
01269 static asymbol *
01270 vms_bfd_make_debug_symbol (abfd, ptr, size)
01271 bfd *abfd ATTRIBUTE_UNUSED;
01272 void *ptr ATTRIBUTE_UNUSED;
01273 unsigned long size ATTRIBUTE_UNUSED;
01274 {
01275 #if VMS_DEBUG
01276 vms_debug (1, "vms_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size);
01277 #endif
01278 return 0;
01279 }
01280
01281
01282
01283
01284
01285 static long
01286 vms_read_minisymbols (abfd, dynamic, minisymsp, sizep)
01287 bfd *abfd;
01288 bfd_boolean dynamic;
01289 PTR *minisymsp;
01290 unsigned int *sizep;
01291 {
01292 #if VMS_DEBUG
01293 vms_debug (1, "vms_read_minisymbols(%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep);
01294 #endif
01295 return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep);
01296 }
01297
01298
01299
01300
01301
01302 static asymbol *
01303 vms_minisymbol_to_symbol (abfd, dynamic, minisym, sym)
01304 bfd *abfd;
01305 bfd_boolean dynamic;
01306 const PTR minisym;
01307 asymbol *sym;
01308 {
01309 #if VMS_DEBUG
01310 vms_debug (1, "vms_minisymbol_to_symbol(%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym);
01311 #endif
01312 return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym);
01313 }
01314
01315
01316
01317
01318
01319
01320
01321 static long
01322 vms_get_reloc_upper_bound (abfd, section)
01323 bfd *abfd ATTRIBUTE_UNUSED;
01324 asection *section ATTRIBUTE_UNUSED;
01325 {
01326 #if VMS_DEBUG
01327 vms_debug (1, "vms_get_reloc_upper_bound(%p, %s)\n", abfd, section->name);
01328 #endif
01329 return -1L;
01330 }
01331
01332
01333
01334
01335
01336
01337
01338 static long
01339 vms_canonicalize_reloc (abfd, section, location, symbols)
01340 bfd *abfd ATTRIBUTE_UNUSED;
01341 asection *section ATTRIBUTE_UNUSED;
01342 arelent **location ATTRIBUTE_UNUSED;
01343 asymbol **symbols ATTRIBUTE_UNUSED;
01344 {
01345 #if VMS_DEBUG
01346 vms_debug (1, "vms_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name);
01347 #endif
01348 return FALSE;
01349 }
01350
01351
01352
01353
01354
01355
01356 static bfd_reloc_status_type
01357 reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
01358 bfd *abfd ATTRIBUTE_UNUSED;
01359 arelent *reloc ATTRIBUTE_UNUSED;
01360 asymbol *sym ATTRIBUTE_UNUSED;
01361 PTR data ATTRIBUTE_UNUSED;
01362 asection *sec ATTRIBUTE_UNUSED;
01363 bfd *output_bfd ATTRIBUTE_UNUSED;
01364 char **error_message ATTRIBUTE_UNUSED;
01365 {
01366 #if VMS_DEBUG
01367 vms_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd);
01368 vms_debug (2, "In section %s, symbol %s\n",
01369 sec->name, sym->name);
01370 vms_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n",
01371 reloc->sym_ptr_ptr[0]->name,
01372 (unsigned long)reloc->address,
01373 (unsigned long)reloc->addend, reloc->howto->name);
01374 vms_debug (2, "data at %p\n", data);
01375
01376 #endif
01377
01378 return bfd_reloc_ok;
01379 }
01380
01381
01382
01383 #define MINUS_ONE (((bfd_vma)0) - 1)
01384
01385 static reloc_howto_type alpha_howto_table[] =
01386 {
01387 HOWTO (ALPHA_R_IGNORE,
01388 0,
01389 0,
01390 8,
01391 TRUE,
01392 0,
01393 complain_overflow_dont,
01394 reloc_nil,
01395 "IGNORE",
01396 TRUE,
01397 0,
01398 0,
01399 TRUE),
01400
01401
01402 HOWTO (ALPHA_R_REFQUAD,
01403 0,
01404 4,
01405 64,
01406 FALSE,
01407 0,
01408 complain_overflow_bitfield,
01409 reloc_nil,
01410 "REFQUAD",
01411 TRUE,
01412 MINUS_ONE,
01413 MINUS_ONE,
01414 FALSE),
01415
01416
01417
01418
01419 HOWTO (ALPHA_R_BRADDR,
01420 2,
01421 2,
01422 21,
01423 TRUE,
01424 0,
01425 complain_overflow_signed,
01426 reloc_nil,
01427 "BRADDR",
01428 TRUE,
01429 0x1fffff,
01430 0x1fffff,
01431 FALSE),
01432
01433
01434 HOWTO (ALPHA_R_HINT,
01435 2,
01436 1,
01437 14,
01438 TRUE,
01439 0,
01440 complain_overflow_dont,
01441 reloc_nil,
01442 "HINT",
01443 TRUE,
01444 0x3fff,
01445 0x3fff,
01446 FALSE),
01447
01448
01449 HOWTO (ALPHA_R_SREL16,
01450 0,
01451 1,
01452 16,
01453 TRUE,
01454 0,
01455 complain_overflow_signed,
01456 reloc_nil,
01457 "SREL16",
01458 TRUE,
01459 0xffff,
01460 0xffff,
01461 FALSE),
01462
01463
01464 HOWTO (ALPHA_R_SREL32,
01465 0,
01466 2,
01467 32,
01468 TRUE,
01469 0,
01470 complain_overflow_signed,
01471 reloc_nil,
01472 "SREL32",
01473 TRUE,
01474 0xffffffff,
01475 0xffffffff,
01476 FALSE),
01477
01478
01479 HOWTO (ALPHA_R_SREL64,
01480 0,
01481 4,
01482 64,
01483 TRUE,
01484 0,
01485 complain_overflow_signed,
01486 reloc_nil,
01487 "SREL64",
01488 TRUE,
01489 MINUS_ONE,
01490 MINUS_ONE,
01491 FALSE),
01492
01493
01494 HOWTO (ALPHA_R_OP_PUSH,
01495 0,
01496 0,
01497 0,
01498 FALSE,
01499 0,
01500 complain_overflow_dont,
01501 reloc_nil,
01502 "OP_PUSH",
01503 FALSE,
01504 0,
01505 0,
01506 FALSE),
01507
01508
01509
01510 HOWTO (ALPHA_R_OP_STORE,
01511 0,
01512 4,
01513 64,
01514 FALSE,
01515 0,
01516 complain_overflow_dont,
01517 reloc_nil,
01518 "OP_STORE",
01519 FALSE,
01520 0,
01521 MINUS_ONE,
01522 FALSE),
01523
01524
01525
01526 HOWTO (ALPHA_R_OP_PSUB,
01527 0,
01528 0,
01529 0,
01530 FALSE,
01531 0,
01532 complain_overflow_dont,
01533 reloc_nil,
01534 "OP_PSUB",
01535 FALSE,
01536 0,
01537 0,
01538 FALSE),
01539
01540
01541
01542 HOWTO (ALPHA_R_OP_PRSHIFT,
01543 0,
01544 0,
01545 0,
01546 FALSE,
01547 0,
01548 complain_overflow_dont,
01549 reloc_nil,
01550 "OP_PRSHIFT",
01551 FALSE,
01552 0,
01553 0,
01554 FALSE),
01555
01556
01557 HOWTO (ALPHA_R_LINKAGE,
01558 0,
01559 8,
01560 256,
01561 FALSE,
01562 0,
01563 complain_overflow_dont,
01564 reloc_nil,
01565 "LINKAGE",
01566 FALSE,
01567 0,
01568 0,
01569 FALSE),
01570
01571
01572 HOWTO (ALPHA_R_REFLONG,
01573 0,
01574 2,
01575 32,
01576 FALSE,
01577 0,
01578 complain_overflow_bitfield,
01579 reloc_nil,
01580 "REFLONG",
01581 TRUE,
01582 0xffffffff,
01583 0xffffffff,
01584 FALSE),
01585
01586
01587 HOWTO (ALPHA_R_CODEADDR,
01588 0,
01589 4,
01590 64,
01591 FALSE,
01592 0,
01593 complain_overflow_signed,
01594 reloc_nil,
01595 "CODEADDR",
01596 FALSE,
01597 0xffffffff,
01598 0xffffffff,
01599 FALSE),
01600
01601 };
01602
01603
01604
01605
01606 static const struct reloc_howto_struct *
01607 vms_bfd_reloc_type_lookup (abfd, code)
01608 bfd *abfd ATTRIBUTE_UNUSED;
01609 bfd_reloc_code_real_type code;
01610 {
01611 int alpha_type;
01612
01613 #if VMS_DEBUG
01614 vms_debug (1, "vms_bfd_reloc_type_lookup(%p, %d)\t", abfd, code);
01615 #endif
01616
01617 switch (code)
01618 {
01619 case BFD_RELOC_16: alpha_type = ALPHA_R_SREL16; break;
01620 case BFD_RELOC_32: alpha_type = ALPHA_R_REFLONG; break;
01621 case BFD_RELOC_64: alpha_type = ALPHA_R_REFQUAD; break;
01622 case BFD_RELOC_CTOR: alpha_type = ALPHA_R_REFQUAD; break;
01623 case BFD_RELOC_23_PCREL_S2: alpha_type = ALPHA_R_BRADDR; break;
01624 case BFD_RELOC_ALPHA_HINT: alpha_type = ALPHA_R_HINT; break;
01625 case BFD_RELOC_16_PCREL: alpha_type = ALPHA_R_SREL16; break;
01626 case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break;
01627 case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break;
01628 case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break;
01629 case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break;
01630 default:
01631 (*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code);
01632 return (const struct reloc_howto_struct *) NULL;
01633 }
01634 #if VMS_DEBUG
01635 vms_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name);
01636 #endif
01637 return &alpha_howto_table[alpha_type];
01638 }
01639
01640
01641
01642
01643
01644
01645
01646 static bfd_boolean
01647 vms_set_arch_mach (abfd, arch, mach)
01648 bfd *abfd;
01649 enum bfd_architecture arch ATTRIBUTE_UNUSED;
01650 unsigned long mach ATTRIBUTE_UNUSED;
01651 {
01652 #if VMS_DEBUG
01653 vms_debug (1, "vms_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach);
01654 #endif
01655 abfd->arch_info = bfd_scan_arch("alpha");
01656
01657 return TRUE;
01658 }
01659
01660
01661
01662
01663
01664
01665
01666
01667
01668
01669 static bfd_boolean
01670 vms_set_section_contents (abfd, section, location, offset, count)
01671 bfd *abfd;
01672 asection *section;
01673 const PTR location;
01674 file_ptr offset;
01675 bfd_size_type count;
01676 {
01677 #if VMS_DEBUG
01678 vms_debug (1, "vms_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n",
01679 abfd, section->name, location, (long int)offset, (int)count);
01680 vms_debug (2, "size %d\n", (int) section->size);
01681 #endif
01682 return _bfd_save_vms_section(abfd, section, location, offset, count);
01683 }
01684
01685
01686
01687
01688
01689 static int
01690 vms_sizeof_headers (abfd, reloc)
01691 bfd *abfd ATTRIBUTE_UNUSED;
01692 bfd_boolean reloc ATTRIBUTE_UNUSED;
01693 {
01694 #if VMS_DEBUG
01695 vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False");
01696 #endif
01697 return 0;
01698 }
01699
01700
01701
01702
01703 static bfd_byte *
01704 vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
01705 relocatable, symbols)
01706 bfd *abfd ATTRIBUTE_UNUSED;
01707 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
01708 struct bfd_link_order *link_order ATTRIBUTE_UNUSED;
01709 bfd_byte *data ATTRIBUTE_UNUSED;
01710 bfd_boolean relocatable ATTRIBUTE_UNUSED;
01711 asymbol **symbols ATTRIBUTE_UNUSED;
01712 {
01713 #if VMS_DEBUG
01714 vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n",
01715 abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols);
01716 #endif
01717 return 0;
01718 }
01719
01720
01721
01722 static bfd_boolean
01723 vms_bfd_relax_section (abfd, section, link_info, again)
01724 bfd *abfd ATTRIBUTE_UNUSED;
01725 asection *section ATTRIBUTE_UNUSED;
01726 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
01727 bfd_boolean *again ATTRIBUTE_UNUSED;
01728 {
01729 #if VMS_DEBUG
01730 vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, <ret>)\n",
01731 abfd, section->name, link_info);
01732 #endif
01733 return TRUE;
01734 }
01735
01736 static bfd_boolean
01737 vms_bfd_gc_sections (abfd, link_info)
01738 bfd *abfd ATTRIBUTE_UNUSED;
01739 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
01740 {
01741 #if VMS_DEBUG
01742 vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info);
01743 #endif
01744 return TRUE;
01745 }
01746
01747 static bfd_boolean
01748 vms_bfd_merge_sections (abfd, link_info)
01749 bfd *abfd ATTRIBUTE_UNUSED;
01750 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
01751 {
01752 #if VMS_DEBUG
01753 vms_debug (1, "vms_bfd_merge_sections(%p, %p)\n", abfd, link_info);
01754 #endif
01755 return TRUE;
01756 }
01757
01758
01759
01760
01761 static struct bfd_link_hash_table *
01762 vms_bfd_link_hash_table_create (abfd)
01763 bfd *abfd ATTRIBUTE_UNUSED;
01764 {
01765 #if VMS_DEBUG
01766 vms_debug (1, "vms_bfd_link_hash_table_create(%p)\n", abfd);
01767 #endif
01768 return 0;
01769 }
01770
01771
01772
01773 static void
01774 vms_bfd_link_hash_table_free (hash)
01775 struct bfd_link_hash_table *hash ATTRIBUTE_UNUSED;
01776 {
01777 #if VMS_DEBUG
01778 vms_debug (1, "vms_bfd_link_hash_table_free(%p)\n", abfd);
01779 #endif
01780 }
01781
01782
01783
01784 static bfd_boolean
01785 vms_bfd_link_add_symbols (abfd, link_info)
01786 bfd *abfd ATTRIBUTE_UNUSED;
01787 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
01788 {
01789 #if VMS_DEBUG
01790 vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info);
01791 #endif
01792 return FALSE;
01793 }
01794
01795
01796
01797
01798 static bfd_boolean
01799 vms_bfd_final_link (abfd, link_info)
01800 bfd *abfd ATTRIBUTE_UNUSED;
01801 struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
01802 {
01803 #if VMS_DEBUG
01804 vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info);
01805 #endif
01806 return TRUE;
01807 }
01808
01809
01810
01811 static bfd_boolean
01812 vms_bfd_link_split_section (abfd, section)
01813 bfd *abfd ATTRIBUTE_UNUSED;
01814 asection *section ATTRIBUTE_UNUSED;
01815 {
01816 #if VMS_DEBUG
01817 vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name);
01818 #endif
01819 return FALSE;
01820 }
01821
01822
01823
01824
01825
01826 static long
01827 vms_get_dynamic_symtab_upper_bound (abfd)
01828 bfd *abfd ATTRIBUTE_UNUSED;
01829 {
01830 #if VMS_DEBUG
01831 vms_debug (1, "vms_get_dynamic_symtab_upper_bound(%p)\n", abfd);
01832 #endif
01833 return 0;
01834 }
01835
01836 static bfd_boolean
01837 vms_bfd_print_private_bfd_data (abfd, file)
01838 bfd *abfd ATTRIBUTE_UNUSED;
01839 void *file ATTRIBUTE_UNUSED;
01840 {
01841 #if VMS_DEBUG
01842 vms_debug (1, "vms_bfd_print_private_bfd_data(%p)\n", abfd);
01843 #endif
01844 return 0;
01845 }
01846
01847
01848
01849 static long
01850 vms_canonicalize_dynamic_symtab (abfd, symbols)
01851 bfd *abfd ATTRIBUTE_UNUSED;
01852 asymbol **symbols ATTRIBUTE_UNUSED;
01853 {
01854 #if VMS_DEBUG
01855 vms_debug (1, "vms_canonicalize_dynamic_symtab(%p, <ret>)\n", abfd);
01856 #endif
01857 return 0L;
01858 }
01859
01860
01861
01862 static long
01863 vms_get_dynamic_reloc_upper_bound (abfd)
01864 bfd *abfd ATTRIBUTE_UNUSED;
01865 {
01866 #if VMS_DEBUG
01867 vms_debug (1, "vms_get_dynamic_reloc_upper_bound(%p)\n", abfd);
01868 #endif
01869 return 0L;
01870 }
01871
01872
01873
01874 static long
01875 vms_canonicalize_dynamic_reloc (abfd, arel, symbols)
01876 bfd *abfd ATTRIBUTE_UNUSED;
01877 arelent **arel ATTRIBUTE_UNUSED;
01878 asymbol **symbols ATTRIBUTE_UNUSED;
01879 {
01880 #if VMS_DEBUG
01881 vms_debug (1, "vms_canonicalize_dynamic_reloc(%p)\n", abfd);
01882 #endif
01883 return 0L;
01884 }