1999-05-03 09:29:11 +02:00
|
|
|
|
/* vms.c -- BFD back-end for VAX (openVMS/VAX) and
|
|
|
|
|
EVAX (openVMS/Alpha) files.
|
2003-06-25 08:40:27 +02:00
|
|
|
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
2001-03-08 22:04:02 +01:00
|
|
|
|
Free Software Foundation, Inc.
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
Written by Klaus K"ampf (kkaempf@rmi.de)
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
|
|
#include "bfd.h"
|
|
|
|
|
#include "sysdep.h"
|
|
|
|
|
#include "bfdlink.h"
|
|
|
|
|
#include "libbfd.h"
|
|
|
|
|
|
|
|
|
|
#include "vms.h"
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_initialize
|
|
|
|
|
PARAMS ((bfd *));
|
1999-07-12 12:30:21 +02:00
|
|
|
|
static unsigned int priv_section_count;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean fill_section_ptr
|
|
|
|
|
PARAMS ((struct bfd_hash_entry *, PTR));
|
|
|
|
|
static bfd_boolean vms_fixup_sections
|
|
|
|
|
PARAMS ((bfd *));
|
|
|
|
|
static bfd_boolean copy_symbols
|
|
|
|
|
PARAMS ((struct bfd_hash_entry *, PTR));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
static bfd_reloc_status_type reloc_nil
|
|
|
|
|
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static const struct bfd_target *vms_object_p
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static const struct bfd_target *vms_archive_p
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd_boolean vms_mkobject
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd_boolean vms_write_object_contents
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd_boolean vms_close_and_cleanup
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd_boolean vms_bfd_free_cached_info
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd_boolean vms_new_section_hook
|
|
|
|
|
PARAMS ((bfd *abfd, asection *section));
|
|
|
|
|
static bfd_boolean vms_get_section_contents
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2,
|
|
|
|
|
bfd_size_type x3));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_get_section_contents_in_window
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset,
|
|
|
|
|
bfd_size_type count));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_copy_private_bfd_data
|
|
|
|
|
PARAMS ((bfd *src, bfd *dest));
|
|
|
|
|
static bfd_boolean vms_bfd_copy_private_section_data
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_copy_private_symbol_data
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_print_private_bfd_data
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, void *file));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static char *vms_core_file_failing_command
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static int vms_core_file_failing_signal
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd_boolean vms_core_file_matches_executable_p
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, bfd *bbfd));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_slurp_armap
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd_boolean vms_slurp_extended_name_table
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd_boolean vms_construct_extended_name_table
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen,
|
|
|
|
|
const char **name));
|
|
|
|
|
static void vms_truncate_arname
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
PARAMS ((bfd *abfd, const char *pathname, char *arhdr));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_write_armap
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *arch, unsigned int elength, struct orl *map,
|
|
|
|
|
unsigned int orl_count, int stridx));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static PTR vms_read_ar_hdr
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static bfd *vms_get_elt_at_index
|
|
|
|
|
PARAMS ((bfd *abfd, symindex index));
|
|
|
|
|
static bfd *vms_openr_next_archived_file
|
|
|
|
|
PARAMS ((bfd *arch, bfd *prev));
|
|
|
|
|
static bfd_boolean vms_update_armap_timestamp
|
|
|
|
|
PARAMS ((bfd *abfd));
|
|
|
|
|
static int vms_generic_stat_arch_elt
|
|
|
|
|
PARAMS ((bfd *, struct stat *));
|
|
|
|
|
static long vms_get_symtab_upper_bound
|
|
|
|
|
PARAMS ((bfd *abfd));
|
2003-10-16 06:11:10 +02:00
|
|
|
|
static long vms_canonicalize_symtab
|
2002-11-30 09:39:46 +01:00
|
|
|
|
PARAMS ((bfd *abfd, asymbol **symbols));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
static void vms_print_symbol
|
|
|
|
|
PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how));
|
|
|
|
|
static void vms_get_symbol_info
|
|
|
|
|
PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_is_local_label_name
|
|
|
|
|
PARAMS ((bfd *abfd, const char *));
|
|
|
|
|
static alent *vms_get_lineno
|
|
|
|
|
PARAMS ((bfd *abfd, asymbol *symbol));
|
|
|
|
|
static bfd_boolean vms_find_nearest_line
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset,
|
|
|
|
|
const char **file, const char **func, unsigned int *line));
|
|
|
|
|
static asymbol *vms_bfd_make_debug_symbol
|
|
|
|
|
PARAMS ((bfd *abfd, void *ptr, unsigned long size));
|
|
|
|
|
static long vms_read_minisymbols
|
2002-11-30 09:39:46 +01:00
|
|
|
|
PARAMS ((bfd *abfd, bfd_boolean dynamic, PTR *minisymsp,
|
|
|
|
|
unsigned int *sizep));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
static asymbol *vms_minisymbol_to_symbol
|
2002-11-30 09:39:46 +01:00
|
|
|
|
PARAMS ((bfd *abfd, bfd_boolean dynamic, const PTR minisym, asymbol *sym));
|
|
|
|
|
static long vms_get_reloc_upper_bound
|
|
|
|
|
PARAMS ((bfd *abfd, asection *sect));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
static long vms_canonicalize_reloc
|
|
|
|
|
PARAMS ((bfd *abfd, asection *srcsec, arelent **location,
|
|
|
|
|
asymbol **symbols));
|
|
|
|
|
static const struct reloc_howto_struct *vms_bfd_reloc_type_lookup
|
|
|
|
|
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_set_arch_mach
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_set_section_contents
|
2003-11-04 11:41:52 +01:00
|
|
|
|
PARAMS ((bfd *abfd, asection *section, const PTR location, file_ptr offset,
|
1999-05-03 09:29:11 +02:00
|
|
|
|
bfd_size_type count));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static int vms_sizeof_headers
|
|
|
|
|
PARAMS ((bfd *abfd, bfd_boolean reloc));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
static bfd_byte *vms_bfd_get_relocated_section_contents
|
|
|
|
|
PARAMS ((bfd *abfd, struct bfd_link_info *link_info,
|
|
|
|
|
struct bfd_link_order *link_order, bfd_byte *data,
|
2003-06-25 08:40:27 +02:00
|
|
|
|
bfd_boolean relocatable, asymbol **symbols));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_relax_section
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info,
|
2002-11-30 09:39:46 +01:00
|
|
|
|
bfd_boolean *again));
|
|
|
|
|
static bfd_boolean vms_bfd_gc_sections
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_merge_sections
|
* merge.c (struct sec_merge_hash_entry): Add u.entsize and u.suffix
fields, change sec into secinfo.
(struct sec_merge_info): Add chain, remove last fields.
(struct sec_merge_sec_info): Add next, sec, psecinfo fields.
(sec_merge_hash_lookup): If lookup could not use a string only
because it has bad alignment, mark the old string for deletion.
(sec_merge_add): Add secinfo argument. Don't compute entry's
position, instead record the section.
(sec_merge_emit): Update for the sec into secinfo change in
struct sec_merge_hash_entry.
(_bfd_merge_section): Only record the section for merging, defer
putting strings into the hash table.
(cmplengthentry, last4_eq, last_eq, record_section, merge_strings,
_bfd_merge_sections): New functions.
(_bfd_merged_section_offset): Update for the sec_merge_hash_entry
changes.
* libbfd-in.h (_bfd_merge_sections): Add prototype.
(_bfd_nolink_bfd_merge_sections): Define.
* libbfd.h: Likewise.
(bfd_generic_merge_sections): Add prototype.
* targets.c (BFD_JUMP_TABLE_LINK): Add _bfd_merge_sections.
(struct bfd_target): Likewise.
* bfd.c (bfd_merge_sections): Define.
* bfd-in2.h: Rebuilt.
* elf.c (_bfd_elf_merge_sections): New function.
* elf-bfd.h (_bfd_elf_merge_sections): Add prototype.
* elfxx-target.h (bfd_elfNN_bfd_merge_sections): Define.
* reloc.c (bfd_generic_merge_sections): New function.
* vms.c (vms_bfd_merge_sections): New function.
* aout-adobe.c (aout_32_bfd_merge_sections): Define.
* aout-target.h (MY_bfd_merge_sections): Define.
* aout-tic30.c (MY_bfd_merge_sections): Define.
* binary.c (binary_bfd_merge_sections): Define.
* bout.c (b_out_bfd_merge_sections): Define.
* coff-alpha.c (_bfd_ecoff_bfd_merge_sections): Define.
* coffcode.c (coff_bfd_merge_sections): Define.
* coff-mips.c (_bfd_ecoff_bfd_merge_sections): Define.
* i386msdos.c (msdos_bfd_merge_sections): Define.
* i386os9k.c (os9k_bfd_merge_sections): Define.
* ieee.c (ieee_bfd_merge_sections): Define.
* ihex.c (ihex_bfd_merge_sections): Define.
* nlm-target.h (nlm_bfd_merge_sections): Define.
* oasys.c (oasys_bfd_merge_sections): Define.
* ppcboot.c (ppcboot_bfd_merge_sections): Define.
* som.c (som_bfd_merge_sections): Define.
* srec.c (srec_bfd_merge_sections): Define.
* tekhex.c (tekhex_bfd_merge_sections): Define.
* versados.c (versados_bfd_merge_sections): Define.
* xcoff-target.h (_bfd_xcoff_bfd_merge_sections): Define.
* ldlang.c (lang_process): Call bfd_merge_sections.
2001-05-11 14:23:48 +02:00
|
|
|
|
PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
static struct bfd_link_hash_table *vms_bfd_link_hash_table_create
|
|
|
|
|
PARAMS ((bfd *abfd));
|
2002-04-04 21:53:38 +02:00
|
|
|
|
static void vms_bfd_link_hash_table_free
|
|
|
|
|
PARAMS ((struct bfd_link_hash_table *hash));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_link_add_symbols
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_final_link
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, struct bfd_link_info *link_info));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_link_split_section
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PARAMS ((bfd *abfd, asection *section));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static long vms_get_dynamic_symtab_upper_bound
|
|
|
|
|
PARAMS ((bfd *abfd));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
static long vms_canonicalize_dynamic_symtab
|
|
|
|
|
PARAMS ((bfd *abfd, asymbol **symbols));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static long vms_get_dynamic_reloc_upper_bound
|
|
|
|
|
PARAMS ((bfd *abfd));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
static long vms_canonicalize_dynamic_reloc
|
|
|
|
|
PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols));
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean vms_bfd_merge_private_bfd_data
|
|
|
|
|
PARAMS ((bfd *ibfd, bfd *obfd));
|
|
|
|
|
static bfd_boolean vms_bfd_set_private_flags
|
|
|
|
|
PARAMS ((bfd *abfd, flagword flags));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-01-06 08:30:35 +01:00
|
|
|
|
#define vms_make_empty_symbol _bfd_generic_make_empty_symbol
|
2002-05-15 02:18:58 +02:00
|
|
|
|
#define vms_bfd_link_just_syms _bfd_generic_link_just_syms
|
2002-06-05 05:43:11 +02:00
|
|
|
|
#define vms_bfd_discard_group bfd_generic_discard_group
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
|
|
const bfd_target vms_alpha_vec =
|
|
|
|
|
{
|
|
|
|
|
"vms-alpha", /* name */
|
|
|
|
|
bfd_target_evax_flavour,
|
1999-07-19 16:55:16 +02:00
|
|
|
|
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
|
|
|
|
BFD_ENDIAN_LITTLE, /* header byte order is little */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
(HAS_RELOC | HAS_SYMS
|
|
|
|
|
| WP_TEXT | D_PAGED), /* object flags */
|
|
|
|
|
(SEC_ALLOC | SEC_LOAD | SEC_RELOC
|
|
|
|
|
| SEC_READONLY | SEC_CODE | SEC_DATA
|
|
|
|
|
| SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */
|
|
|
|
|
0, /* symbol_leading_char */
|
|
|
|
|
' ', /* ar_pad_char */
|
|
|
|
|
15, /* ar_max_namelen */
|
|
|
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
|
|
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
|
|
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16,
|
|
|
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
|
|
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
|
|
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16,
|
|
|
|
|
|
|
|
|
|
{_bfd_dummy_target, vms_object_p, /* bfd_check_format */
|
|
|
|
|
vms_archive_p, _bfd_dummy_target},
|
|
|
|
|
{bfd_false, vms_mkobject, /* bfd_set_format */
|
|
|
|
|
_bfd_generic_mkarchive, bfd_false},
|
|
|
|
|
{bfd_false, vms_write_object_contents, /* bfd_write_contents */
|
|
|
|
|
_bfd_write_archive_contents, bfd_false},
|
|
|
|
|
|
|
|
|
|
BFD_JUMP_TABLE_GENERIC (vms),
|
|
|
|
|
BFD_JUMP_TABLE_COPY (vms),
|
|
|
|
|
BFD_JUMP_TABLE_CORE (vms),
|
|
|
|
|
BFD_JUMP_TABLE_ARCHIVE (vms),
|
|
|
|
|
BFD_JUMP_TABLE_SYMBOLS (vms),
|
|
|
|
|
BFD_JUMP_TABLE_RELOCS (vms),
|
|
|
|
|
BFD_JUMP_TABLE_WRITE (vms),
|
|
|
|
|
BFD_JUMP_TABLE_LINK (vms),
|
|
|
|
|
BFD_JUMP_TABLE_DYNAMIC (vms),
|
|
|
|
|
|
1999-07-19 16:55:16 +02:00
|
|
|
|
NULL,
|
2000-12-23 17:48:10 +01:00
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
(PTR) 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const bfd_target vms_vax_vec =
|
|
|
|
|
{
|
|
|
|
|
"vms-vax", /* name */
|
|
|
|
|
bfd_target_ovax_flavour,
|
1999-07-19 16:55:16 +02:00
|
|
|
|
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
|
|
|
|
BFD_ENDIAN_LITTLE, /* header byte order is little */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
(HAS_RELOC | HAS_SYMS /* object flags */
|
|
|
|
|
| WP_TEXT | D_PAGED
|
|
|
|
|
| HAS_LINENO | HAS_DEBUG | HAS_LOCALS),
|
|
|
|
|
|
|
|
|
|
(SEC_ALLOC | SEC_LOAD | SEC_RELOC
|
|
|
|
|
| SEC_READONLY | SEC_CODE | SEC_DATA
|
|
|
|
|
| SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */
|
|
|
|
|
0, /* symbol_leading_char */
|
|
|
|
|
' ', /* ar_pad_char */
|
|
|
|
|
15, /* ar_max_namelen */
|
|
|
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
|
|
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
|
|
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
|
|
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
|
|
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
|
|
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
|
|
|
|
|
|
|
|
|
{_bfd_dummy_target, vms_object_p, /* bfd_check_format */
|
|
|
|
|
vms_archive_p, _bfd_dummy_target},
|
|
|
|
|
{bfd_false, vms_mkobject, /* bfd_set_format */
|
|
|
|
|
_bfd_generic_mkarchive, bfd_false},
|
|
|
|
|
{bfd_false, vms_write_object_contents, /* bfd_write_contents */
|
|
|
|
|
_bfd_write_archive_contents, bfd_false},
|
|
|
|
|
|
|
|
|
|
BFD_JUMP_TABLE_GENERIC (vms),
|
|
|
|
|
BFD_JUMP_TABLE_COPY (vms),
|
|
|
|
|
BFD_JUMP_TABLE_CORE (vms),
|
|
|
|
|
BFD_JUMP_TABLE_ARCHIVE (vms),
|
|
|
|
|
BFD_JUMP_TABLE_SYMBOLS (vms),
|
|
|
|
|
BFD_JUMP_TABLE_RELOCS (vms),
|
|
|
|
|
BFD_JUMP_TABLE_WRITE (vms),
|
|
|
|
|
BFD_JUMP_TABLE_LINK (vms),
|
|
|
|
|
BFD_JUMP_TABLE_DYNAMIC (vms),
|
|
|
|
|
|
1999-07-19 16:55:16 +02:00
|
|
|
|
NULL,
|
2000-12-23 17:48:10 +01:00
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
(PTR) 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
|
|
/* Initialize private data */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_initialize (abfd)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
{
|
|
|
|
|
int i;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
bfd_size_type amt;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
bfd_set_start_address (abfd, (bfd_vma) -1);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
amt = sizeof (struct vms_private_data_struct);
|
2002-07-30 07:49:24 +02:00
|
|
|
|
abfd->tdata.any = (struct vms_private_data_struct*) bfd_alloc (abfd, amt);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (abfd->tdata.any == 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
#ifdef __ALPHA
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (is_vax) = 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#else
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (is_vax) = 1;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (vms_buf) = 0;
|
|
|
|
|
PRIV (buf_size) = 0;
|
|
|
|
|
PRIV (rec_length) = 0;
|
|
|
|
|
PRIV (file_format) = FF_UNKNOWN;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
PRIV (fixup_done) = FALSE;
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (sections) = NULL;
|
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
amt = sizeof (struct stack_struct) * STACKSIZE;
|
2002-07-30 07:49:24 +02:00
|
|
|
|
PRIV (stack) = (struct stack_struct *) bfd_alloc (abfd, amt);
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (stack) == 0)
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto error_ret1;
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (stackptr) = 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
amt = sizeof (struct bfd_hash_table);
|
2002-07-30 07:49:24 +02:00
|
|
|
|
PRIV (vms_symbol_table) = (struct bfd_hash_table *) bfd_alloc (abfd, amt);
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (vms_symbol_table) == 0)
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto error_ret1;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc))
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto error_ret1;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE;
|
2002-07-30 07:49:24 +02:00
|
|
|
|
PRIV (location_stack) = (struct location_struct *) bfd_alloc (abfd, amt);
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (location_stack) == 0)
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto error_ret2;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < VMS_SECTION_COUNT; i++)
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (vms_section_table)[i] = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-07-30 07:49:24 +02:00
|
|
|
|
amt = MAX_OUTREC_SIZE;
|
|
|
|
|
PRIV (output_buf) = (unsigned char *) bfd_alloc (abfd, amt);
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (output_buf) == 0)
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto error_ret2;
|
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (push_level) = 0;
|
|
|
|
|
PRIV (pushed_size) = 0;
|
|
|
|
|
PRIV (length_pos) = 2;
|
|
|
|
|
PRIV (output_size) = 0;
|
|
|
|
|
PRIV (output_alignment) = 1;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
2002-07-30 07:49:24 +02:00
|
|
|
|
|
|
|
|
|
error_ret2:
|
|
|
|
|
bfd_hash_table_free (PRIV (vms_symbol_table));
|
|
|
|
|
error_ret1:
|
|
|
|
|
bfd_release (abfd, abfd->tdata.any);
|
|
|
|
|
abfd->tdata.any = 0;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fill symbol->section with section ptr
|
|
|
|
|
symbol->section is filled with the section index for defined symbols
|
|
|
|
|
during reading the GSD/EGSD section. But we need the pointer to the
|
|
|
|
|
bfd section later.
|
|
|
|
|
|
|
|
|
|
It has the correct value for referenced (undefined section) symbols
|
|
|
|
|
|
|
|
|
|
called from bfd_hash_traverse in vms_fixup_sections */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
fill_section_ptr (entry, sections)
|
|
|
|
|
struct bfd_hash_entry *entry;
|
|
|
|
|
PTR sections;
|
|
|
|
|
{
|
|
|
|
|
asection *sec;
|
|
|
|
|
asymbol *sym;
|
|
|
|
|
|
|
|
|
|
sym = ((vms_symbol_entry *)entry)->symbol;
|
|
|
|
|
sec = sym->section;
|
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (6, "fill_section_ptr: sym %p, sec %p\n", sym, sec);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* fill forward references (these contain section number, not section ptr). */
|
|
|
|
|
|
1999-07-12 12:30:21 +02:00
|
|
|
|
if ((unsigned int) sec < priv_section_count)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
sec = ((vms_symbol_entry *)entry)->symbol->section =
|
|
|
|
|
((asection **)sections)[(int)sec];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strcmp (sym->name, sec->name) == 0)
|
|
|
|
|
sym->flags |= BSF_SECTION_SYM;
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fixup sections
|
|
|
|
|
set up all pointers and arrays, counters and sizes are fixed now
|
|
|
|
|
|
|
|
|
|
we build a private sections vector for easy access since sections
|
|
|
|
|
are always referenced by an index number.
|
|
|
|
|
|
|
|
|
|
alloc PRIV(sections) according to abfd->section_count
|
|
|
|
|
copy abfd->sections to PRIV(sections) */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_fixup_sections (abfd)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
{
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (fixup_done))
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* traverse symbol table and fill in all section pointers
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* can't provide section count as argument to fill_section_ptr(). */
|
2001-02-16 20:22:12 +01:00
|
|
|
|
priv_section_count = PRIV (section_count);
|
|
|
|
|
bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr,
|
|
|
|
|
(PTR) (PRIV (sections)));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
PRIV (fixup_done) = TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
|
|
/* Check the format for a file being read.
|
|
|
|
|
Return a (bfd_target *) if it's an object file or zero if not. */
|
|
|
|
|
|
|
|
|
|
static const struct bfd_target *
|
|
|
|
|
vms_object_p (abfd)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
{
|
|
|
|
|
int err = 0;
|
|
|
|
|
int prev_type;
|
|
|
|
|
const struct bfd_target *target_vector = 0;
|
|
|
|
|
const bfd_arch_info_type *arch = 0;
|
2002-07-30 07:49:24 +02:00
|
|
|
|
PTR tdata_save = abfd->tdata.any;
|
2002-11-04 22:44:36 +01:00
|
|
|
|
bfd_vma saddr_save = bfd_get_start_address (abfd);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_object_p(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!vms_initialize (abfd))
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto error_ret;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET))
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto err_wrong_format;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
prev_type = -1;
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (7, "reading at %08lx\n", bfd_tell(abfd));
|
|
|
|
|
#endif
|
|
|
|
|
if (_bfd_vms_next_record (abfd) < 0)
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
2000-12-23 17:48:10 +01:00
|
|
|
|
vms_debug (2, "next_record failed\n");
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto err_wrong_format;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((prev_type == EOBJ_S_C_EGSD)
|
2001-02-16 20:22:12 +01:00
|
|
|
|
&& (PRIV (rec_type) != EOBJ_S_C_EGSD))
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
2002-06-25 08:21:54 +02:00
|
|
|
|
if (! vms_fixup_sections (abfd))
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "vms_fixup_sections failed\n");
|
|
|
|
|
#endif
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto err_wrong_format;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
prev_type = PRIV (rec_type);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
if (target_vector == 0)
|
|
|
|
|
{
|
|
|
|
|
if (prev_type <= OBJ_S_C_MAXRECTYP)
|
|
|
|
|
target_vector = &vms_vax_vec;
|
|
|
|
|
else
|
|
|
|
|
target_vector = &vms_alpha_vec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (prev_type)
|
|
|
|
|
{
|
|
|
|
|
case OBJ_S_C_HDR:
|
|
|
|
|
case EOBJ_S_C_EMH:
|
|
|
|
|
err = _bfd_vms_slurp_hdr (abfd, prev_type);
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_S_C_EOM:
|
|
|
|
|
case OBJ_S_C_EOMW:
|
|
|
|
|
case EOBJ_S_C_EEOM:
|
|
|
|
|
err = _bfd_vms_slurp_eom (abfd, prev_type);
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_S_C_GSD:
|
|
|
|
|
case EOBJ_S_C_EGSD:
|
|
|
|
|
err = _bfd_vms_slurp_gsd (abfd, prev_type);
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_S_C_TIR:
|
|
|
|
|
case EOBJ_S_C_ETIR:
|
|
|
|
|
err = _bfd_vms_slurp_tir (abfd, prev_type);
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_S_C_DBG:
|
|
|
|
|
case EOBJ_S_C_EDBG:
|
|
|
|
|
err = _bfd_vms_slurp_dbg (abfd, prev_type);
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_S_C_TBT:
|
|
|
|
|
case EOBJ_S_C_ETBT:
|
|
|
|
|
err = _bfd_vms_slurp_tbt (abfd, prev_type);
|
|
|
|
|
break;
|
|
|
|
|
case OBJ_S_C_LNK:
|
|
|
|
|
err = _bfd_vms_slurp_lnk (abfd, prev_type);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
err = -1;
|
|
|
|
|
}
|
|
|
|
|
if (err != 0)
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "slurp type %d failed with %d\n", prev_type, err);
|
|
|
|
|
#endif
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto err_wrong_format;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while ((prev_type != EOBJ_S_C_EEOM) && (prev_type != OBJ_S_C_EOM) && (prev_type != OBJ_S_C_EOMW));
|
|
|
|
|
|
|
|
|
|
if (target_vector == &vms_vax_vec)
|
|
|
|
|
{
|
2002-06-25 08:21:54 +02:00
|
|
|
|
if (! vms_fixup_sections (abfd))
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "vms_fixup_sections failed\n");
|
|
|
|
|
#endif
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto err_wrong_format;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* set arch_info to vax */
|
2000-12-23 17:48:10 +01:00
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
arch = bfd_scan_arch ("vax");
|
|
|
|
|
PRIV (is_vax) = 1;
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "arch is vax\n");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else if (target_vector == &vms_alpha_vec)
|
|
|
|
|
{
|
|
|
|
|
/* set arch_info to alpha */
|
2000-12-23 17:48:10 +01:00
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
arch = bfd_scan_arch ("alpha");
|
|
|
|
|
PRIV (is_vax) = 0;
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "arch is alpha\n");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (arch == 0)
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "arch not found\n");
|
|
|
|
|
#endif
|
2002-07-30 07:49:24 +02:00
|
|
|
|
goto err_wrong_format;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
abfd->arch_info = arch;
|
|
|
|
|
|
|
|
|
|
return target_vector;
|
2002-07-30 07:49:24 +02:00
|
|
|
|
|
|
|
|
|
err_wrong_format:
|
|
|
|
|
bfd_set_error (bfd_error_wrong_format);
|
|
|
|
|
error_ret:
|
|
|
|
|
if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
|
|
|
|
|
bfd_release (abfd, abfd->tdata.any);
|
|
|
|
|
abfd->tdata.any = tdata_save;
|
2002-11-04 22:44:36 +01:00
|
|
|
|
bfd_set_start_address (abfd, saddr_save);
|
2002-07-30 07:49:24 +02:00
|
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check the format for a file being read.
|
|
|
|
|
Return a (bfd_target *) if it's an archive file or zero. */
|
|
|
|
|
|
|
|
|
|
static const struct bfd_target *
|
|
|
|
|
vms_archive_p (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_archive_p(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set the format of a file being written. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_mkobject (abfd)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_mkobject(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!vms_initialize (abfd))
|
2002-07-30 07:49:24 +02:00
|
|
|
|
return 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
#ifdef __VAX
|
|
|
|
|
const bfd_arch_info_type *arch = bfd_scan_arch ("vax");
|
|
|
|
|
#else
|
|
|
|
|
const bfd_arch_info_type *arch = bfd_scan_arch ("alpha");
|
|
|
|
|
#endif
|
|
|
|
|
if (arch == 0)
|
|
|
|
|
{
|
|
|
|
|
bfd_set_error(bfd_error_wrong_format);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
abfd->arch_info = arch;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write cached information into a file being written, at bfd_close. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_write_object_contents (abfd)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_write_object_contents(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (abfd->section_count > 0) /* we have sections */
|
|
|
|
|
{
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (is_vax))
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
if (_bfd_vms_write_hdr (abfd, OBJ_S_C_HDR) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_gsd (abfd, OBJ_S_C_GSD) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_tir (abfd, OBJ_S_C_TIR) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_tbt (abfd, OBJ_S_C_TBT) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_dbg (abfd, OBJ_S_C_DBG) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (abfd->section_count > 255)
|
|
|
|
|
{
|
|
|
|
|
if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOMW) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOM) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (_bfd_vms_write_hdr (abfd, EOBJ_S_C_EMH) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_gsd (abfd, EOBJ_S_C_EGSD) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_tir (abfd, EOBJ_S_C_ETIR) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_tbt (abfd, EOBJ_S_C_ETBT) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_dbg (abfd, EOBJ_S_C_EDBG) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
if (_bfd_vms_write_eom (abfd, EOBJ_S_C_EEOM) != 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- 4.1, generic -----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* Called when the BFD is being closed to do any necessary cleanup. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_close_and_cleanup (abfd)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_close_and_cleanup(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
if (abfd == 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (vms_buf) != NULL)
|
2002-07-30 07:49:24 +02:00
|
|
|
|
free (PRIV (vms_buf));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (sections) != NULL)
|
2002-07-30 07:49:24 +02:00
|
|
|
|
free (PRIV (sections));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (vms_symbol_table))
|
2002-07-30 07:49:24 +02:00
|
|
|
|
bfd_hash_table_free (PRIV (vms_symbol_table));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-07-30 07:49:24 +02:00
|
|
|
|
bfd_release (abfd, abfd->tdata.any);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
abfd->tdata.any = NULL;
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Ask the BFD to free all cached information. */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_free_cached_info (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_free_cached_info(%p)\n", abfd);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called when a new section is created. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_new_section_hook (abfd, section)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
asection *section;
|
|
|
|
|
{
|
2001-11-13 04:52:25 +01:00
|
|
|
|
/* Count hasn't been incremented yet. */
|
|
|
|
|
unsigned int section_count = abfd->section_count + 1;
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#if VMS_DEBUG
|
2001-11-13 04:52:25 +01:00
|
|
|
|
vms_debug (1, "vms_new_section_hook (%p, [%d]%s), count %d\n",
|
|
|
|
|
abfd, section->index, section->name, section_count);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif
|
2001-11-13 04:52:25 +01:00
|
|
|
|
bfd_set_section_alignment (abfd, section, 4);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2001-11-13 04:52:25 +01:00
|
|
|
|
if (section_count > PRIV (section_count))
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
2001-11-13 04:52:25 +01:00
|
|
|
|
bfd_size_type amt = section_count;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
amt *= sizeof (asection *);
|
|
|
|
|
PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt);
|
2001-02-16 20:22:12 +01:00
|
|
|
|
if (PRIV (sections) == 0)
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
2001-11-13 04:52:25 +01:00
|
|
|
|
PRIV (section_count) = section_count;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
#if VMS_DEBUG
|
2001-02-16 20:22:12 +01:00
|
|
|
|
vms_debug (6, "section_count: %d\n", PRIV (section_count));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (sections)[section->index] = section;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (7, "%d: %s\n", section->index, section->name);
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the contents of a section.
|
|
|
|
|
buf points to a buffer of buf_size bytes to be filled with
|
|
|
|
|
section data (starting at offset into section) */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_get_section_contents (abfd, section, buf, offset, buf_size)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *section ATTRIBUTE_UNUSED;
|
|
|
|
|
PTR buf ATTRIBUTE_UNUSED;
|
|
|
|
|
file_ptr offset ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd_size_type buf_size ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_get_section_contents(%p, %s, %p, off %ld, size %d)\n",
|
|
|
|
|
abfd, section->name, buf, offset, (int)buf_size);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* shouldn't be called, since all sections are IN_MEMORY */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the contents of a section.
|
|
|
|
|
buf points to a buffer of buf_size bytes to be filled with
|
|
|
|
|
section data (starting at offset into section) */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_get_section_contents_in_window (abfd, section, w, offset, count)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *section ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd_window *w ATTRIBUTE_UNUSED;
|
|
|
|
|
file_ptr offset ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd_size_type count ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n",
|
|
|
|
|
abfd, section->name, w, offset, (int)count);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* shouldn't be called, since all sections are IN_MEMORY */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- Part 4.2, copy private data --------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* Called to copy BFD general private data from one object file
|
|
|
|
|
to another. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_copy_private_bfd_data (src, dest)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *src ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd *dest ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Merge private BFD information from the BFD @var{ibfd} to the
|
2002-11-30 09:39:46 +01:00
|
|
|
|
the output file BFD @var{obfd} when linking. Return <<TRUE>>
|
|
|
|
|
on success, <<FALSE>> on error. Possible error returns are:
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
o <<bfd_error_no_memory>> -
|
|
|
|
|
Not enough memory exists to create private data for @var{obfd}. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_merge_private_bfd_data (ibfd, obfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *ibfd ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd *obfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set private BFD flag information in the BFD @var{abfd}.
|
2002-11-30 09:39:46 +01:00
|
|
|
|
Return <<TRUE>> on success, <<FALSE>> on error. Possible error
|
1999-05-03 09:29:11 +02:00
|
|
|
|
returns are:
|
|
|
|
|
|
|
|
|
|
o <<bfd_error_no_memory>> -
|
|
|
|
|
Not enough memory exists to create private data for @var{obfd}. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_set_private_flags (abfd, flags)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
flagword flags ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called to copy BFD private section data from one object file
|
|
|
|
|
to another. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *srcbfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *srcsec ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd *dstbfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *dstsec ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n",
|
|
|
|
|
srcbfd, srcsec->name, dstbfd, dstsec->name);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called to copy BFD private symbol data from one object file
|
|
|
|
|
to another. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *ibfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asymbol *isym ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd *obfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asymbol *osym ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n",
|
|
|
|
|
ibfd, isym->name, obfd, osym->name);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- Part 4.3, core file ----------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* Return a read-only string explaining which program was running
|
|
|
|
|
when it failed and produced the core file abfd. */
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
vms_core_file_failing_command (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_core_file_failing_command(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns the signal number which caused the core dump which
|
|
|
|
|
generated the file the BFD abfd is attached to. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
vms_core_file_failing_signal (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_core_file_failing_signal(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
/* Return TRUE if the core file attached to core_bfd was generated
|
|
|
|
|
by a run of the executable file attached to exec_bfd, FALSE otherwise. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_core_file_matches_executable_p (abfd, bbfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd *bbfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- Part 4.4, archive ------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* ??? do something with an archive map.
|
2002-11-30 09:39:46 +01:00
|
|
|
|
Return FALSE on error, TRUE otherwise. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_slurp_armap (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_slurp_armap(%p)\n", abfd);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ??? do something with an extended name table.
|
2002-11-30 09:39:46 +01:00
|
|
|
|
Return FALSE on error, TRUE otherwise. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_slurp_extended_name_table (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ??? do something with an extended name table.
|
2002-11-30 09:39:46 +01:00
|
|
|
|
Return FALSE on error, TRUE otherwise. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_construct_extended_name_table (abfd, tabloc, tablen, name)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
char **tabloc ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd_size_type *tablen ATTRIBUTE_UNUSED;
|
|
|
|
|
const char **name ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Truncate the name of an archive to match system-dependent restrictions */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
vms_truncate_arname (abfd, pathname, arhdr)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
const char *pathname ATTRIBUTE_UNUSED;
|
1999-07-12 12:30:21 +02:00
|
|
|
|
char *arhdr ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr);
|
|
|
|
|
#endif
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ??? write archive map */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_write_armap (arch, elength, map, orl_count, stridx)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *arch ATTRIBUTE_UNUSED;
|
|
|
|
|
unsigned int elength ATTRIBUTE_UNUSED;
|
|
|
|
|
struct orl *map ATTRIBUTE_UNUSED;
|
|
|
|
|
unsigned int orl_count ATTRIBUTE_UNUSED;
|
|
|
|
|
int stridx ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n",
|
|
|
|
|
arch, elength, map, orl_count, stridx);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read archive header ??? */
|
|
|
|
|
|
|
|
|
|
static PTR
|
|
|
|
|
vms_read_ar_hdr (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd * abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_read_ar_hdr(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return (PTR)0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Provided a BFD, @var{archive}, containing an archive and NULL, open
|
|
|
|
|
an input BFD on the first contained element and returns that.
|
|
|
|
|
Subsequent calls should pass the archive and the previous return value
|
|
|
|
|
to return a created BFD to the next contained element.
|
|
|
|
|
NULL is returned when there are no more. */
|
|
|
|
|
|
|
|
|
|
static bfd *
|
|
|
|
|
vms_openr_next_archived_file (arch, prev)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *arch ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd *prev ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_openr_next_archived_file(%p, %p)\n", arch, prev);
|
|
|
|
|
#endif
|
2000-05-01 07:02:57 +02:00
|
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the BFD which is referenced by the symbol in ABFD indexed by
|
|
|
|
|
INDEX. INDEX should have been returned by bfd_get_next_mapent. */
|
|
|
|
|
|
|
|
|
|
static bfd *
|
|
|
|
|
vms_get_elt_at_index (abfd, index)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
symindex index;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_get_elt_at_index(%p, %p)\n", abfd, index);
|
|
|
|
|
#endif
|
|
|
|
|
return _bfd_generic_get_elt_at_index(abfd, index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ???
|
|
|
|
|
-> bfd_generic_stat_arch_elt */
|
|
|
|
|
|
|
|
|
|
static int
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
vms_generic_stat_arch_elt (abfd, st)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
bfd *abfd;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
struct stat *st;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
vms_debug (1, "vms_generic_stat_arch_elt(%p, %p)\n", abfd, st);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
return bfd_generic_stat_arch_elt (abfd, st);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This is a new function in bfd 2.5 */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_update_armap_timestamp (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- Part 4.5, symbols --------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* Return the number of bytes required to store a vector of pointers
|
|
|
|
|
to asymbols for all the symbols in the BFD abfd, including a
|
|
|
|
|
terminal NULL pointer. If there are no symbols in the BFD,
|
|
|
|
|
then return 0. If an error occurs, return -1. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
vms_get_symtab_upper_bound (abfd)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
2001-02-16 20:22:12 +01:00
|
|
|
|
vms_debug (1, "vms_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV (gsd_sym_count));
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif
|
2001-02-16 20:22:12 +01:00
|
|
|
|
return (PRIV (gsd_sym_count)+1) * sizeof (asymbol *);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Copy symbols from hash table to symbol vector
|
|
|
|
|
|
2003-10-16 06:11:10 +02:00
|
|
|
|
called from bfd_hash_traverse in vms_canonicalize_symtab
|
1999-05-03 09:29:11 +02:00
|
|
|
|
init counter to 0 if entry == 0 */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
copy_symbols (entry, arg)
|
|
|
|
|
struct bfd_hash_entry *entry;
|
|
|
|
|
PTR arg;
|
|
|
|
|
{
|
|
|
|
|
bfd *abfd = (bfd *) arg;
|
|
|
|
|
|
|
|
|
|
if (entry == NULL) /* init counter */
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (symnum) = 0;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
else /* fill vector, inc counter */
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the symbols from the BFD abfd, and fills in the vector
|
|
|
|
|
location with pointers to the symbols and a trailing NULL.
|
|
|
|
|
|
|
|
|
|
return # of symbols read */
|
|
|
|
|
|
|
|
|
|
static long
|
2003-10-16 06:11:10 +02:00
|
|
|
|
vms_canonicalize_symtab (abfd, symbols)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
bfd *abfd;
|
|
|
|
|
asymbol **symbols;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
2003-10-16 06:11:10 +02:00
|
|
|
|
vms_debug (1, "vms_canonicalize_symtab(%p, <ret>)\n", abfd);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* init counter */
|
|
|
|
|
(void)copy_symbols((struct bfd_hash_entry *)0, abfd);
|
|
|
|
|
|
|
|
|
|
/* traverse table and fill symbols vector */
|
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
PRIV (symcache) = symbols;
|
|
|
|
|
bfd_hash_traverse(PRIV (vms_symbol_table), copy_symbols, (PTR)abfd);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
symbols[PRIV (gsd_sym_count)] = NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2001-02-16 20:22:12 +01:00
|
|
|
|
return PRIV (gsd_sym_count);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print symbol to file according to how. how is one of
|
|
|
|
|
bfd_print_symbol_name just print the name
|
|
|
|
|
bfd_print_symbol_more print more (???)
|
|
|
|
|
bfd_print_symbol_all print all we know, which is not much right now :-) */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
vms_print_symbol (abfd, file, symbol, how)
|
2001-08-23 17:45:19 +02:00
|
|
|
|
bfd *abfd;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PTR file;
|
|
|
|
|
asymbol *symbol;
|
|
|
|
|
bfd_print_symbol_type how;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_print_symbol(%p, %p, %p, %d)\n", abfd, file, symbol, how);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
switch (how)
|
|
|
|
|
{
|
|
|
|
|
case bfd_print_symbol_name:
|
|
|
|
|
case bfd_print_symbol_more:
|
2000-12-23 17:48:10 +01:00
|
|
|
|
fprintf ((FILE *)file," %s", symbol->name);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case bfd_print_symbol_all:
|
|
|
|
|
{
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
const char *section_name = symbol->section->name;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2001-08-23 17:45:19 +02:00
|
|
|
|
bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2000-12-23 17:48:10 +01:00
|
|
|
|
fprintf ((FILE *)file," %-8s %s", section_name, symbol->name);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return information about symbol in ret.
|
|
|
|
|
|
|
|
|
|
fill type, value and name
|
|
|
|
|
type:
|
|
|
|
|
A absolute
|
|
|
|
|
B bss segment symbol
|
|
|
|
|
C common symbol
|
|
|
|
|
D data segment symbol
|
|
|
|
|
f filename
|
|
|
|
|
t a static function symbol
|
|
|
|
|
T text segment symbol
|
|
|
|
|
U undefined
|
|
|
|
|
- debug */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
vms_get_symbol_info (abfd, symbol, ret)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
asymbol *symbol;
|
|
|
|
|
symbol_info *ret;
|
|
|
|
|
{
|
|
|
|
|
asection *sec;
|
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_get_symbol_info(%p, %p, %p)\n", abfd, symbol, ret);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
sec = symbol->section;
|
|
|
|
|
|
|
|
|
|
if (ret == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (bfd_is_com_section (sec))
|
|
|
|
|
ret->type = 'C';
|
|
|
|
|
else if (bfd_is_abs_section (sec))
|
|
|
|
|
ret->type = 'A';
|
|
|
|
|
else if (bfd_is_und_section (sec))
|
|
|
|
|
ret->type = 'U';
|
|
|
|
|
else if (bfd_is_ind_section (sec))
|
|
|
|
|
ret->type = 'I';
|
|
|
|
|
else if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
|
|
|
|
|
ret->type = 'T';
|
|
|
|
|
else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
|
|
|
|
|
ret->type = 'D';
|
|
|
|
|
else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
|
|
|
|
|
ret->type = 'B';
|
|
|
|
|
else
|
|
|
|
|
ret->type = '-';
|
|
|
|
|
|
|
|
|
|
if (ret->type != 'U')
|
|
|
|
|
ret->value = symbol->value + symbol->section->vma;
|
|
|
|
|
else
|
|
|
|
|
ret->value = 0;
|
|
|
|
|
ret->name = symbol->name;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
/* Return TRUE if the given symbol sym in the BFD abfd is
|
|
|
|
|
a compiler generated local label, else return FALSE. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_is_local_label_name (abfd, name)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
const char *name;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_is_local_label_name(%p, %s)\n", abfd, name);
|
|
|
|
|
#endif
|
|
|
|
|
return name[0] == '$';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get source line number for symbol */
|
|
|
|
|
|
|
|
|
|
static alent *
|
|
|
|
|
vms_get_lineno (abfd, symbol)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asymbol *symbol ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_get_lineno(%p, %p)\n", abfd, symbol);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Provided a BFD, a section and an offset into the section, calculate and
|
|
|
|
|
return the name of the source file and the line nearest to the wanted
|
|
|
|
|
location. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_find_nearest_line (abfd, section, symbols, offset, file, func, line)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *section ATTRIBUTE_UNUSED;
|
|
|
|
|
asymbol **symbols ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd_vma offset ATTRIBUTE_UNUSED;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 11:57:26 +02:00
|
|
|
|
const char **file ATTRIBUTE_UNUSED;
|
|
|
|
|
const char **func ATTRIBUTE_UNUSED;
|
1999-07-12 12:30:21 +02:00
|
|
|
|
unsigned int *line ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n",
|
|
|
|
|
abfd, section->name, symbols, (long int)offset);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Back-door to allow format-aware applications to create debug symbols
|
|
|
|
|
while using BFD for everything else. Currently used by the assembler
|
|
|
|
|
when creating COFF files. */
|
|
|
|
|
|
|
|
|
|
static asymbol *
|
|
|
|
|
vms_bfd_make_debug_symbol (abfd, ptr, size)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
void *ptr ATTRIBUTE_UNUSED;
|
|
|
|
|
unsigned long size ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read minisymbols. For minisymbols, we use the unmodified a.out
|
|
|
|
|
symbols. The minisymbol_to_symbol function translates these into
|
|
|
|
|
BFD asymbol structures. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
vms_read_minisymbols (abfd, dynamic, minisymsp, sizep)
|
|
|
|
|
bfd *abfd;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
bfd_boolean dynamic;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PTR *minisymsp;
|
|
|
|
|
unsigned int *sizep;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_read_minisymbols(%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep);
|
|
|
|
|
#endif
|
|
|
|
|
return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert a minisymbol to a BFD asymbol. A minisymbol is just an
|
|
|
|
|
unmodified a.out symbol. The SYM argument is a structure returned
|
|
|
|
|
by bfd_make_empty_symbol, which we fill in here. */
|
|
|
|
|
|
|
|
|
|
static asymbol *
|
|
|
|
|
vms_minisymbol_to_symbol (abfd, dynamic, minisym, sym)
|
|
|
|
|
bfd *abfd;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
bfd_boolean dynamic;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
const PTR minisym;
|
|
|
|
|
asymbol *sym;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_minisymbol_to_symbol(%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym);
|
|
|
|
|
#endif
|
|
|
|
|
return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- Part 4.6, relocations --------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* Return the number of bytes required to store the relocation information
|
|
|
|
|
associated with section sect attached to bfd abfd.
|
|
|
|
|
If an error occurs, return -1. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
vms_get_reloc_upper_bound (abfd, section)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *section ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_get_reloc_upper_bound(%p, %s)\n", abfd, section->name);
|
|
|
|
|
#endif
|
|
|
|
|
return -1L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Call the back end associated with the open BFD abfd and translate the
|
|
|
|
|
external form of the relocation information attached to sec into the
|
|
|
|
|
internal canonical form. Place the table into memory at loc, which has
|
|
|
|
|
been preallocated, usually by a call to bfd_get_reloc_upper_bound.
|
|
|
|
|
Returns the number of relocs, or -1 on error. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
vms_canonicalize_reloc (abfd, section, location, symbols)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *section ATTRIBUTE_UNUSED;
|
|
|
|
|
arelent **location ATTRIBUTE_UNUSED;
|
|
|
|
|
asymbol **symbols ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
|
/* this is just copied from ecoff-alpha, needs to be fixed probably */
|
|
|
|
|
|
|
|
|
|
/* How to process the various reloc types. */
|
|
|
|
|
|
|
|
|
|
static bfd_reloc_status_type
|
|
|
|
|
reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
arelent *reloc ATTRIBUTE_UNUSED;
|
|
|
|
|
asymbol *sym ATTRIBUTE_UNUSED;
|
|
|
|
|
PTR data ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *sec ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd *output_bfd ATTRIBUTE_UNUSED;
|
|
|
|
|
char **error_message ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd);
|
|
|
|
|
vms_debug (2, "In section %s, symbol %s\n",
|
|
|
|
|
sec->name, sym->name);
|
|
|
|
|
vms_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n",
|
|
|
|
|
reloc->sym_ptr_ptr[0]->name,
|
|
|
|
|
(unsigned long)reloc->address,
|
|
|
|
|
(unsigned long)reloc->addend, reloc->howto->name);
|
|
|
|
|
vms_debug (2, "data at %p\n", data);
|
|
|
|
|
/* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return bfd_reloc_ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
|
|
|
|
|
from smaller values. Start with zero, widen, *then* decrement. */
|
|
|
|
|
#define MINUS_ONE (((bfd_vma)0) - 1)
|
|
|
|
|
|
|
|
|
|
static reloc_howto_type alpha_howto_table[] =
|
|
|
|
|
{
|
|
|
|
|
HOWTO (ALPHA_R_IGNORE, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
8, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"IGNORE", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* src_mask */
|
|
|
|
|
0, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* A 64 bit reference to a symbol. */
|
|
|
|
|
HOWTO (ALPHA_R_REFQUAD, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
4, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
64, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_bitfield, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"REFQUAD", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
MINUS_ONE, /* src_mask */
|
|
|
|
|
MINUS_ONE, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* A 21 bit branch. The native assembler generates these for
|
|
|
|
|
branches within the text segment, and also fills in the PC
|
|
|
|
|
relative offset in the instruction. */
|
|
|
|
|
HOWTO (ALPHA_R_BRADDR, /* type */
|
|
|
|
|
2, /* rightshift */
|
|
|
|
|
2, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
21, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_signed, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"BRADDR", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0x1fffff, /* src_mask */
|
|
|
|
|
0x1fffff, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* A hint for a jump to a register. */
|
|
|
|
|
HOWTO (ALPHA_R_HINT, /* type */
|
|
|
|
|
2, /* rightshift */
|
|
|
|
|
1, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
14, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"HINT", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0x3fff, /* src_mask */
|
|
|
|
|
0x3fff, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* 16 bit PC relative offset. */
|
|
|
|
|
HOWTO (ALPHA_R_SREL16, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
1, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
16, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_signed, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"SREL16", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0xffff, /* src_mask */
|
|
|
|
|
0xffff, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* 32 bit PC relative offset. */
|
|
|
|
|
HOWTO (ALPHA_R_SREL32, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
2, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
32, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_signed, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"SREL32", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0xffffffff, /* src_mask */
|
|
|
|
|
0xffffffff, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* A 64 bit PC relative offset. */
|
|
|
|
|
HOWTO (ALPHA_R_SREL64, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
4, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
64, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_signed, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"SREL64", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
MINUS_ONE, /* src_mask */
|
|
|
|
|
MINUS_ONE, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* Push a value on the reloc evaluation stack. */
|
|
|
|
|
HOWTO (ALPHA_R_OP_PUSH, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
0, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"OP_PUSH", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* src_mask */
|
|
|
|
|
0, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* Store the value from the stack at the given address. Store it in
|
|
|
|
|
a bitfield of size r_size starting at bit position r_offset. */
|
|
|
|
|
HOWTO (ALPHA_R_OP_STORE, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
4, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
64, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"OP_STORE", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* src_mask */
|
|
|
|
|
MINUS_ONE, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* Subtract the reloc address from the value on the top of the
|
|
|
|
|
relocation stack. */
|
|
|
|
|
HOWTO (ALPHA_R_OP_PSUB, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
0, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"OP_PSUB", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* src_mask */
|
|
|
|
|
0, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* Shift the value on the top of the relocation stack right by the
|
|
|
|
|
given value. */
|
|
|
|
|
HOWTO (ALPHA_R_OP_PRSHIFT, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
0, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
0, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"OP_PRSHIFT", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* src_mask */
|
|
|
|
|
0, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* Hack. Linkage is done by linker. */
|
|
|
|
|
HOWTO (ALPHA_R_LINKAGE, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
8, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
256, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_dont, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"LINKAGE", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* src_mask */
|
|
|
|
|
0, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* A 32 bit reference to a symbol. */
|
|
|
|
|
HOWTO (ALPHA_R_REFLONG, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
2, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
32, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_bitfield, /* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"REFLONG", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
TRUE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0xffffffff, /* src_mask */
|
|
|
|
|
0xffffffff, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
/* A 64 bit reference to a procedure, written as 32 bit value. */
|
|
|
|
|
HOWTO (ALPHA_R_CODEADDR, /* type */
|
|
|
|
|
0, /* rightshift */
|
|
|
|
|
4, /* size (0 = byte, 1 = short, 2 = long) */
|
|
|
|
|
64, /* bitsize */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* pc_relative */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0, /* bitpos */
|
|
|
|
|
complain_overflow_signed,/* complain_on_overflow */
|
|
|
|
|
reloc_nil, /* special_function */
|
|
|
|
|
"CODEADDR", /* name */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE, /* partial_inplace */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
0xffffffff, /* src_mask */
|
|
|
|
|
0xffffffff, /* dst_mask */
|
2002-11-30 09:39:46 +01:00
|
|
|
|
FALSE), /* pcrel_offset */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Return a pointer to a howto structure which, when invoked, will perform
|
|
|
|
|
the relocation code on data from the architecture noted. */
|
|
|
|
|
|
|
|
|
|
static const struct reloc_howto_struct *
|
|
|
|
|
vms_bfd_reloc_type_lookup (abfd, code)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
bfd_reloc_code_real_type code;
|
|
|
|
|
{
|
|
|
|
|
int alpha_type;
|
|
|
|
|
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_reloc_type_lookup(%p, %d)\t", abfd, code);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case BFD_RELOC_16: alpha_type = ALPHA_R_SREL16; break;
|
|
|
|
|
case BFD_RELOC_32: alpha_type = ALPHA_R_REFLONG; break;
|
|
|
|
|
case BFD_RELOC_64: alpha_type = ALPHA_R_REFQUAD; break;
|
|
|
|
|
case BFD_RELOC_CTOR: alpha_type = ALPHA_R_REFQUAD; break;
|
|
|
|
|
case BFD_RELOC_23_PCREL_S2: alpha_type = ALPHA_R_BRADDR; break;
|
|
|
|
|
case BFD_RELOC_ALPHA_HINT: alpha_type = ALPHA_R_HINT; break;
|
|
|
|
|
case BFD_RELOC_16_PCREL: alpha_type = ALPHA_R_SREL16; break;
|
|
|
|
|
case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break;
|
|
|
|
|
case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break;
|
|
|
|
|
case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break;
|
|
|
|
|
case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break;
|
|
|
|
|
default:
|
|
|
|
|
(*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code);
|
|
|
|
|
return (const struct reloc_howto_struct *) NULL;
|
|
|
|
|
}
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name);
|
|
|
|
|
#endif
|
|
|
|
|
return &alpha_howto_table[alpha_type];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- Part 4.7, writing an object file ---------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* Set the architecture and machine type in BFD abfd to arch and mach.
|
|
|
|
|
Find the correct pointer to a structure and insert it into the arch_info
|
|
|
|
|
pointer. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_set_arch_mach (abfd, arch, mach)
|
|
|
|
|
bfd *abfd;
|
1999-07-12 12:30:21 +02:00
|
|
|
|
enum bfd_architecture arch ATTRIBUTE_UNUSED;
|
|
|
|
|
unsigned long mach ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach);
|
|
|
|
|
#endif
|
|
|
|
|
abfd->arch_info = bfd_scan_arch("alpha");
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sets the contents of the section section in BFD abfd to the data starting
|
|
|
|
|
in memory at data. The data is written to the output section starting at
|
|
|
|
|
offset offset for count bytes.
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
Normally TRUE is returned, else FALSE. Possible error returns are:
|
1999-05-03 09:29:11 +02:00
|
|
|
|
o bfd_error_no_contents - The output section does not have the
|
|
|
|
|
SEC_HAS_CONTENTS attribute, so nothing can be written to it.
|
|
|
|
|
o and some more too */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_set_section_contents (abfd, section, location, offset, count)
|
|
|
|
|
bfd *abfd;
|
|
|
|
|
asection *section;
|
2003-11-04 11:41:52 +01:00
|
|
|
|
const PTR location;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
file_ptr offset;
|
|
|
|
|
bfd_size_type count;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n",
|
|
|
|
|
abfd, section->name, location, (long int)offset, (int)count);
|
|
|
|
|
vms_debug (2, "secraw %d, seccooked %d\n", (int)section->_raw_size, (int)section->_cooked_size);
|
|
|
|
|
#endif
|
|
|
|
|
return _bfd_save_vms_section(abfd, section, location, offset, count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- Part 4.8, linker -------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* Get the size of the section headers. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
vms_sizeof_headers (abfd, reloc)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
bfd_boolean reloc ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False");
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Provides default handling of relocation effort for back ends
|
|
|
|
|
which can't be bothered to do it efficiently. */
|
|
|
|
|
|
|
|
|
|
static bfd_byte *
|
|
|
|
|
vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
|
2003-06-25 08:40:27 +02:00
|
|
|
|
relocatable, symbols)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
|
|
|
|
|
struct bfd_link_order *link_order ATTRIBUTE_UNUSED;
|
|
|
|
|
bfd_byte *data ATTRIBUTE_UNUSED;
|
2003-06-25 08:40:27 +02:00
|
|
|
|
bfd_boolean relocatable ATTRIBUTE_UNUSED;
|
1999-07-12 12:30:21 +02:00
|
|
|
|
asymbol **symbols ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n",
|
2003-06-25 08:40:27 +02:00
|
|
|
|
abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ??? */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_relax_section (abfd, section, link_info, again)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *section ATTRIBUTE_UNUSED;
|
|
|
|
|
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
bfd_boolean *again ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, <ret>)\n",
|
|
|
|
|
abfd, section->name, link_info);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_gc_sections (abfd, link_info)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
* merge.c (struct sec_merge_hash_entry): Add u.entsize and u.suffix
fields, change sec into secinfo.
(struct sec_merge_info): Add chain, remove last fields.
(struct sec_merge_sec_info): Add next, sec, psecinfo fields.
(sec_merge_hash_lookup): If lookup could not use a string only
because it has bad alignment, mark the old string for deletion.
(sec_merge_add): Add secinfo argument. Don't compute entry's
position, instead record the section.
(sec_merge_emit): Update for the sec into secinfo change in
struct sec_merge_hash_entry.
(_bfd_merge_section): Only record the section for merging, defer
putting strings into the hash table.
(cmplengthentry, last4_eq, last_eq, record_section, merge_strings,
_bfd_merge_sections): New functions.
(_bfd_merged_section_offset): Update for the sec_merge_hash_entry
changes.
* libbfd-in.h (_bfd_merge_sections): Add prototype.
(_bfd_nolink_bfd_merge_sections): Define.
* libbfd.h: Likewise.
(bfd_generic_merge_sections): Add prototype.
* targets.c (BFD_JUMP_TABLE_LINK): Add _bfd_merge_sections.
(struct bfd_target): Likewise.
* bfd.c (bfd_merge_sections): Define.
* bfd-in2.h: Rebuilt.
* elf.c (_bfd_elf_merge_sections): New function.
* elf-bfd.h (_bfd_elf_merge_sections): Add prototype.
* elfxx-target.h (bfd_elfNN_bfd_merge_sections): Define.
* reloc.c (bfd_generic_merge_sections): New function.
* vms.c (vms_bfd_merge_sections): New function.
* aout-adobe.c (aout_32_bfd_merge_sections): Define.
* aout-target.h (MY_bfd_merge_sections): Define.
* aout-tic30.c (MY_bfd_merge_sections): Define.
* binary.c (binary_bfd_merge_sections): Define.
* bout.c (b_out_bfd_merge_sections): Define.
* coff-alpha.c (_bfd_ecoff_bfd_merge_sections): Define.
* coffcode.c (coff_bfd_merge_sections): Define.
* coff-mips.c (_bfd_ecoff_bfd_merge_sections): Define.
* i386msdos.c (msdos_bfd_merge_sections): Define.
* i386os9k.c (os9k_bfd_merge_sections): Define.
* ieee.c (ieee_bfd_merge_sections): Define.
* ihex.c (ihex_bfd_merge_sections): Define.
* nlm-target.h (nlm_bfd_merge_sections): Define.
* oasys.c (oasys_bfd_merge_sections): Define.
* ppcboot.c (ppcboot_bfd_merge_sections): Define.
* som.c (som_bfd_merge_sections): Define.
* srec.c (srec_bfd_merge_sections): Define.
* tekhex.c (tekhex_bfd_merge_sections): Define.
* versados.c (versados_bfd_merge_sections): Define.
* xcoff-target.h (_bfd_xcoff_bfd_merge_sections): Define.
* ldlang.c (lang_process): Call bfd_merge_sections.
2001-05-11 14:23:48 +02:00
|
|
|
|
vms_bfd_merge_sections (abfd, link_info)
|
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_merge_sections(%p, %p)\n", abfd, link_info);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
* merge.c (struct sec_merge_hash_entry): Add u.entsize and u.suffix
fields, change sec into secinfo.
(struct sec_merge_info): Add chain, remove last fields.
(struct sec_merge_sec_info): Add next, sec, psecinfo fields.
(sec_merge_hash_lookup): If lookup could not use a string only
because it has bad alignment, mark the old string for deletion.
(sec_merge_add): Add secinfo argument. Don't compute entry's
position, instead record the section.
(sec_merge_emit): Update for the sec into secinfo change in
struct sec_merge_hash_entry.
(_bfd_merge_section): Only record the section for merging, defer
putting strings into the hash table.
(cmplengthentry, last4_eq, last_eq, record_section, merge_strings,
_bfd_merge_sections): New functions.
(_bfd_merged_section_offset): Update for the sec_merge_hash_entry
changes.
* libbfd-in.h (_bfd_merge_sections): Add prototype.
(_bfd_nolink_bfd_merge_sections): Define.
* libbfd.h: Likewise.
(bfd_generic_merge_sections): Add prototype.
* targets.c (BFD_JUMP_TABLE_LINK): Add _bfd_merge_sections.
(struct bfd_target): Likewise.
* bfd.c (bfd_merge_sections): Define.
* bfd-in2.h: Rebuilt.
* elf.c (_bfd_elf_merge_sections): New function.
* elf-bfd.h (_bfd_elf_merge_sections): Add prototype.
* elfxx-target.h (bfd_elfNN_bfd_merge_sections): Define.
* reloc.c (bfd_generic_merge_sections): New function.
* vms.c (vms_bfd_merge_sections): New function.
* aout-adobe.c (aout_32_bfd_merge_sections): Define.
* aout-target.h (MY_bfd_merge_sections): Define.
* aout-tic30.c (MY_bfd_merge_sections): Define.
* binary.c (binary_bfd_merge_sections): Define.
* bout.c (b_out_bfd_merge_sections): Define.
* coff-alpha.c (_bfd_ecoff_bfd_merge_sections): Define.
* coffcode.c (coff_bfd_merge_sections): Define.
* coff-mips.c (_bfd_ecoff_bfd_merge_sections): Define.
* i386msdos.c (msdos_bfd_merge_sections): Define.
* i386os9k.c (os9k_bfd_merge_sections): Define.
* ieee.c (ieee_bfd_merge_sections): Define.
* ihex.c (ihex_bfd_merge_sections): Define.
* nlm-target.h (nlm_bfd_merge_sections): Define.
* oasys.c (oasys_bfd_merge_sections): Define.
* ppcboot.c (ppcboot_bfd_merge_sections): Define.
* som.c (som_bfd_merge_sections): Define.
* srec.c (srec_bfd_merge_sections): Define.
* tekhex.c (tekhex_bfd_merge_sections): Define.
* versados.c (versados_bfd_merge_sections): Define.
* xcoff-target.h (_bfd_xcoff_bfd_merge_sections): Define.
* ldlang.c (lang_process): Call bfd_merge_sections.
2001-05-11 14:23:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
/* Create a hash table for the linker. Different backends store
|
|
|
|
|
different information in this table. */
|
|
|
|
|
|
|
|
|
|
static struct bfd_link_hash_table *
|
|
|
|
|
vms_bfd_link_hash_table_create (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_link_hash_table_create(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-04 21:53:38 +02:00
|
|
|
|
/* Free a linker hash table. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
vms_bfd_link_hash_table_free (hash)
|
|
|
|
|
struct bfd_link_hash_table *hash ATTRIBUTE_UNUSED;
|
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_link_hash_table_free(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
/* Add symbols from this object file into the hash table. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_link_add_symbols (abfd, link_info)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Do a link based on the link_order structures attached to each
|
|
|
|
|
section of the BFD. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_final_link (abfd, link_info)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return TRUE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Should this section be split up into smaller pieces during linking. */
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_link_split_section (abfd, section)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asection *section ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name);
|
|
|
|
|
#endif
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return FALSE;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*-- Part 4.9, dynamic symbols and relocations ------------------------------*/
|
|
|
|
|
|
|
|
|
|
/* Get the amount of memory required to hold the dynamic symbols. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
vms_get_dynamic_symtab_upper_bound (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_get_dynamic_symtab_upper_bound(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static bfd_boolean
|
1999-05-03 09:29:11 +02:00
|
|
|
|
vms_bfd_print_private_bfd_data (abfd, file)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
void *file ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_bfd_print_private_bfd_data(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read in the dynamic symbols. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
vms_canonicalize_dynamic_symtab (abfd, symbols)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
asymbol **symbols ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_canonicalize_dynamic_symtab(%p, <ret>)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return 0L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the amount of memory required to hold the dynamic relocs. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
vms_get_dynamic_reloc_upper_bound (abfd)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_get_dynamic_reloc_upper_bound(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return 0L;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read in the dynamic relocs. */
|
|
|
|
|
|
|
|
|
|
static long
|
|
|
|
|
vms_canonicalize_dynamic_reloc (abfd, arel, symbols)
|
1999-07-12 12:30:21 +02:00
|
|
|
|
bfd *abfd ATTRIBUTE_UNUSED;
|
|
|
|
|
arelent **arel ATTRIBUTE_UNUSED;
|
|
|
|
|
asymbol **symbols ATTRIBUTE_UNUSED;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
#if VMS_DEBUG
|
|
|
|
|
vms_debug (1, "vms_canonicalize_dynamic_reloc(%p)\n", abfd);
|
|
|
|
|
#endif
|
|
|
|
|
return 0L;
|
|
|
|
|
}
|