old-cross-binutils/bfd/vms.c

1690 lines
46 KiB
C
Raw Normal View History

1999-05-03 07:29:11 +00:00
/* vms.c -- BFD back-end for VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 12:20:16 +00:00
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
* aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define. * aout-arm.c (MY_bfd_reloc_name_lookup): Define. (MY (bfd_reloc_name_lookup)): New function. * aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function. * aout-target.h (NAME (aout, reloc_name_lookup)): Declare. (MY_bfd_reloc_name_lookup): Define. * aout-tic30.c (tic30_aout_reloc_name_lookup): New function. (MY_bfd_reloc_name_lookup): Define. * aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare. (NAME (aout, reloc_name_lookup)): New function. * bout.c (b_out_bfd_reloc_name_lookup): New function. * coff-alpha.c (alpha_bfd_reloc_name_lookup): New function. (_bfd_ecoff_bfd_reloc_name_lookup): Define. * coff-arm.c (coff_arm_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-i386.c (coff_bfd_reloc_name_lookup): Define. (coff_i386_reloc_name_lookup): New function. * coff-i860.c (coff_i860_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-i960.c (coff_i960_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-m68k.c (m68k_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-maxq.c (maxq_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-mcore.c (mcore_coff_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-mips.c (mips_bfd_reloc_name_lookup): New function. (_bfd_ecoff_bfd_reloc_name_lookup): Define. * coff-ppc.c (ppc_coff_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-rs6000.c (coff_bfd_reloc_name_lookup): Define. (_bfd_xcoff_reloc_name_lookup): New function. (rs6000coff_vec, pmac_xcoff_vec): Init new field. * coff-sh.c (coff_bfd_reloc_name_lookup): Define. (sh_coff_reloc_name_lookup): New function. * coff-sparc.c (coff_sparc_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-tic30.c (coff_bfd_reloc_name_lookup): Define. (tic30_coff_reloc_name_lookup): New function. * coff-tic4x.c (coff_bfd_reloc_name_lookup): Define. (tic4x_coff_reloc_name_lookup): New function. * coff-tic54x.c (coff_bfd_reloc_name_lookup): Define. (tic54x_coff_reloc_name_lookup): New function. * coff-x86_64.c (coff_bfd_reloc_name_lookup): Define. (coff_amd64_reloc_name_lookup): New function. * coff-z80.c (coff_z80_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-z8k.c (coff_z8k_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define. (xcoff64_reloc_name_lookup): New function. (rs6000coff64_vec, aix5coff64_vec): Init new field. * coffcode.h (coff_bfd_reloc_name_lookup): Define. * elf-hppa.h (elf_hppa_reloc_name_lookup): New function. * elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-arm.c (elf32_arm_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-cris.c (cris_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-crx.c (elf_crx_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-fr30.c (fr30_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-frv.c (frv_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-h8300.c (elf32_h8_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i370.c (i370_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i386.c (elf_i386_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i860.c (elf32_i860_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i960.c (elf32_i960_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-ip2k.c (ip2k_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-iq2000.c (iq2000_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m32c.c (m32c_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68k.c (reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mcore.c (mcore_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mep.c (mep_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. (mips_vxworks_bfd_reloc_name_lookup): Likewise. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-mt.c (mt_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-openrisc.c (openrisc_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-pj.c (pj_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-ppc.c (ppc_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-s390.c (elf_s390_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-score.c (elf32_score_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-sh.c (sh_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-spu.c (spu_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-v850.c (v850_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-vax.c (reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xc16x.c (xc16x_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function. * elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function. * elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-s390.c (elf_s390_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-sh64.c (sh_elf64_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function. (bfd_elfNN_bfd_reloc_name_lookup): Define. * elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function. * elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare. * i386msdos.c (msdos_bfd_reloc_name_lookup): Define. * i386os9k.c (aout_32_bfd_reloc_name_lookup): Define. * ieee.c (ieee_bfd_reloc_name_lookup): Define. * libaout.h (NAME (aout, reloc_name_lookup)): Declare. * libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare. * mipsbsd.c (MY_bfd_reloc_name_lookup): Define. (MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup). (MY(reloc_name_lookup)): New function. * nlm-target.h (nlm_bfd_reloc_name_lookup): Define. * oasys.c (oasys_bfd_reloc_name_lookup): Define. * pdp11.c (NAME (aout, reloc_name_lookup)): New function. * pe-mips.c (coff_mips_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * reloc.c (bfd_reloc_name_lookup): New function. * riscix.c (riscix_reloc_name_lookup): New function. (MY_bfd_reloc_name_lookup): Define. * som.c (som_bfd_reloc_name_lookup): New function. * targets.c (struct bfd_target): Add reloc_name_lookup. (BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup. * versados.c (versados_bfd_reloc_name_lookup): Define. * vms.c (vms_bfd_reloc_name_lookup): New function. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2007-03-26 12:23:03 +00:00
2006, 2007 Free Software Foundation, Inc.
1999-05-03 07:29:11 +00:00
Written by Klaus K"ampf (kkaempf@rmi.de)
2005-04-21 07:45:39 +00:00
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 3 of the License, or
2005-04-21 07:45:39 +00:00
(at your option) any later version.
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
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.
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
1999-05-03 07:29:11 +00:00
#include "sysdep.h"
#include "bfd.h"
1999-05-03 07:29:11 +00:00
#include "bfdlink.h"
#include "libbfd.h"
#include "vms.h"
#define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
2005-04-21 07:45:39 +00:00
#define vms_make_empty_symbol _bfd_generic_make_empty_symbol
#define vms_bfd_link_just_syms _bfd_generic_link_just_syms
#define vms_bfd_is_group_section bfd_generic_is_group_section
#define vms_bfd_discard_group bfd_generic_discard_group
#define vms_section_already_linked _bfd_generic_section_already_linked
#define vms_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define vms_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
static unsigned int priv_section_count;
extern const bfd_target vms_vax_vec;
extern const bfd_target vms_alpha_vec;
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
/* Initialize private data. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_initialize (bfd * abfd)
1999-05-03 07:29:11 +00:00
{
int i;
bfd_size_type amt;
1999-05-03 07:29:11 +00:00
bfd_set_start_address (abfd, (bfd_vma) -1);
1999-05-03 07:29:11 +00:00
amt = sizeof (struct vms_private_data_struct);
2005-04-21 07:45:39 +00:00
abfd->tdata.any = bfd_alloc (abfd, amt);
if (abfd->tdata.any == NULL)
return FALSE;
1999-05-03 07:29:11 +00:00
#ifdef __ALPHA
2005-04-21 07:45:39 +00:00
PRIV (is_vax) = FALSE;
1999-05-03 07:29:11 +00:00
#else
2005-04-21 07:45:39 +00:00
PRIV (is_vax) = TRUE;
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
PRIV (vms_buf) = NULL;
PRIV (buf_size) = 0;
PRIV (rec_length) = 0;
PRIV (file_format) = FF_UNKNOWN;
PRIV (fixup_done) = FALSE;
PRIV (sections) = NULL;
amt = sizeof (struct stack_struct) * STACKSIZE;
2005-04-21 07:45:39 +00:00
PRIV (stack) = bfd_alloc (abfd, amt);
if (PRIV (stack) == NULL)
goto error_ret1;
PRIV (stackptr) = 0;
1999-05-03 07:29:11 +00:00
amt = sizeof (struct bfd_hash_table);
2005-04-21 07:45:39 +00:00
PRIV (vms_symbol_table) = bfd_alloc (abfd, amt);
if (PRIV (vms_symbol_table) == NULL)
goto error_ret1;
1999-05-03 07:29:11 +00:00
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 12:20:16 +00:00
if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc,
sizeof (vms_symbol_entry)))
goto error_ret1;
1999-05-03 07:29:11 +00:00
amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE;
2005-04-21 07:45:39 +00:00
PRIV (location_stack) = bfd_alloc (abfd, amt);
if (PRIV (location_stack) == NULL)
goto error_ret2;
1999-05-03 07:29:11 +00:00
for (i = 0; i < VMS_SECTION_COUNT; i++)
PRIV (vms_section_table)[i] = NULL;
1999-05-03 07:29:11 +00:00
amt = MAX_OUTREC_SIZE;
2005-04-21 07:45:39 +00:00
PRIV (output_buf) = bfd_alloc (abfd, amt);
if (PRIV (output_buf) == NULL)
goto error_ret2;
PRIV (push_level) = 0;
PRIV (pushed_size) = 0;
PRIV (length_pos) = 2;
PRIV (output_size) = 0;
PRIV (output_alignment) = 1;
1999-05-03 07:29:11 +00:00
return TRUE;
error_ret2:
bfd_hash_table_free (PRIV (vms_symbol_table));
error_ret1:
bfd_release (abfd, abfd->tdata.any);
2005-04-21 07:45:39 +00:00
abfd->tdata.any = NULL;
return FALSE;
1999-05-03 07:29:11 +00: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
2005-04-21 07:45:39 +00:00
called from bfd_hash_traverse in vms_fixup_sections. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
fill_section_ptr (struct bfd_hash_entry * entry, void * sections)
1999-05-03 07:29:11 +00:00
{
asection *sec;
asymbol *sym;
2005-04-21 07:45:39 +00:00
sym = ((vms_symbol_entry *) entry)->symbol;
1999-05-03 07:29:11 +00:00
sec = sym->section;
#if VMS_DEBUG
vms_debug (6, "fill_section_ptr: sym %p, sec %p\n", sym, sec);
#endif
2005-04-21 07:45:39 +00:00
/* Fill forward references (these contain section number, not section ptr). */
if ((unsigned int) (size_t) sec < priv_section_count)
2005-04-21 07:45:39 +00:00
sec = ((vms_symbol_entry *) entry)->symbol->section =
((asection **) sections)[(unsigned int) (size_t) sec];
1999-05-03 07:29:11 +00:00
if (strcmp (sym->name, sec->name) == 0)
sym->flags |= BSF_SECTION_SYM;
return TRUE;
1999-05-03 07:29:11 +00: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
2005-04-21 07:45:39 +00:00
copy abfd->sections to PRIV(sections). */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_fixup_sections (bfd * abfd)
1999-05-03 07:29:11 +00:00
{
if (PRIV (fixup_done))
return TRUE;
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
/* Traverse symbol table and fill in all section pointers. */
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
/* Can't provide section count as argument to fill_section_ptr(). */
priv_section_count = PRIV (section_count);
2005-04-21 07:45:39 +00:00
bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr, (PRIV (sections)));
1999-05-03 07:29:11 +00:00
PRIV (fixup_done) = TRUE;
1999-05-03 07:29:11 +00:00
return TRUE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
1999-05-03 07:29:11 +00: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 *
2005-04-21 07:45:39 +00:00
vms_object_p (bfd * abfd)
1999-05-03 07:29:11 +00:00
{
int err = 0;
int prev_type;
2005-04-21 07:45:39 +00:00
const struct bfd_target *target_vector = NULL;
const bfd_arch_info_type *arch = NULL;
void * tdata_save = abfd->tdata.any;
bfd_vma saddr_save = bfd_get_start_address (abfd);
1999-05-03 07:29:11 +00:00
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_object_p (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
if (!vms_initialize (abfd))
goto error_ret;
1999-05-03 07:29:11 +00:00
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET))
goto err_wrong_format;
1999-05-03 07:29:11 +00:00
prev_type = -1;
do
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (7, "reading at %08lx\n", bfd_tell (abfd));
1999-05-03 07:29:11 +00:00
#endif
if (_bfd_vms_next_record (abfd) < 0)
{
#if VMS_DEBUG
vms_debug (2, "next_record failed\n");
1999-05-03 07:29:11 +00:00
#endif
goto err_wrong_format;
1999-05-03 07:29:11 +00:00
}
if ((prev_type == EOBJ_S_C_EGSD)
&& (PRIV (rec_type) != EOBJ_S_C_EGSD))
1999-05-03 07:29:11 +00:00
{
2002-06-25 06:21:54 +00:00
if (! vms_fixup_sections (abfd))
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
vms_debug (2, "vms_fixup_sections failed\n");
#endif
goto err_wrong_format;
1999-05-03 07:29:11 +00:00
}
}
prev_type = PRIV (rec_type);
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
if (target_vector == NULL)
1999-05-03 07:29:11 +00:00
{
if (prev_type <= OBJ_S_C_MAXRECTYP)
2005-04-21 07:45:39 +00:00
target_vector = & vms_vax_vec;
1999-05-03 07:29:11 +00:00
else
2005-04-21 07:45:39 +00:00
target_vector = & vms_alpha_vec;
1999-05-03 07:29:11 +00:00
}
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
goto err_wrong_format;
1999-05-03 07:29:11 +00:00
}
}
while ((prev_type != EOBJ_S_C_EEOM) && (prev_type != OBJ_S_C_EOM) && (prev_type != OBJ_S_C_EOMW));
2005-04-21 07:45:39 +00:00
if (target_vector == & vms_vax_vec)
1999-05-03 07:29:11 +00:00
{
2002-06-25 06:21:54 +00:00
if (! vms_fixup_sections (abfd))
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
vms_debug (2, "vms_fixup_sections failed\n");
#endif
goto err_wrong_format;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* Set arch_info to vax. */
1999-05-03 07:29:11 +00:00
arch = bfd_scan_arch ("vax");
2005-04-21 07:45:39 +00:00
PRIV (is_vax) = TRUE;
1999-05-03 07:29:11 +00:00
#if VMS_DEBUG
vms_debug (2, "arch is vax\n");
#endif
}
2005-04-21 07:45:39 +00:00
else if (target_vector == & vms_alpha_vec)
1999-05-03 07:29:11 +00:00
{
2005-04-21 07:45:39 +00:00
/* Set arch_info to alpha. */
1999-05-03 07:29:11 +00:00
arch = bfd_scan_arch ("alpha");
2005-04-21 07:45:39 +00:00
PRIV (is_vax) = FALSE;
1999-05-03 07:29:11 +00:00
#if VMS_DEBUG
vms_debug (2, "arch is alpha\n");
#endif
}
2005-04-21 07:45:39 +00:00
if (arch == NULL)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
vms_debug (2, "arch not found\n");
#endif
goto err_wrong_format;
1999-05-03 07:29:11 +00:00
}
abfd->arch_info = arch;
return target_vector;
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;
bfd_set_start_address (abfd, saddr_save);
return NULL;
1999-05-03 07:29:11 +00: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 *
2005-04-21 07:45:39 +00:00
vms_archive_p (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_archive_p (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return NULL;
1999-05-03 07:29:11 +00:00
}
/* Set the format of a file being written. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_mkobject (bfd * abfd)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_mkobject (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
if (!vms_initialize (abfd))
2005-04-21 07:45:39 +00:00
return FALSE;
1999-05-03 07:29:11 +00: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
2005-04-21 07:45:39 +00:00
if (arch == NULL)
1999-05-03 07:29:11 +00:00
{
2005-04-21 07:45:39 +00:00
bfd_set_error (bfd_error_wrong_format);
return FALSE;
1999-05-03 07:29:11 +00:00
}
abfd->arch_info = arch;
}
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Write cached information into a file being written, at bfd_close. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_write_object_contents (bfd * abfd)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_write_object_contents (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
if (abfd->section_count > 0) /* we have sections */
{
if (PRIV (is_vax))
1999-05-03 07:29:11 +00:00
{
if (_bfd_vms_write_hdr (abfd, OBJ_S_C_HDR) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_gsd (abfd, OBJ_S_C_GSD) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_tir (abfd, OBJ_S_C_TIR) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_tbt (abfd, OBJ_S_C_TBT) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_dbg (abfd, OBJ_S_C_DBG) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (abfd->section_count > 255)
{
if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOMW) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
}
else
{
if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOM) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
}
}
else
{
if (_bfd_vms_write_hdr (abfd, EOBJ_S_C_EMH) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_gsd (abfd, EOBJ_S_C_EGSD) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_tir (abfd, EOBJ_S_C_ETIR) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_tbt (abfd, EOBJ_S_C_ETBT) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_dbg (abfd, EOBJ_S_C_EDBG) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
if (_bfd_vms_write_eom (abfd, EOBJ_S_C_EEOM) != 0)
return FALSE;
1999-05-03 07:29:11 +00:00
}
}
return TRUE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* 4.1, generic. */
1999-05-03 07:29:11 +00:00
/* Called when the BFD is being closed to do any necessary cleanup. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_close_and_cleanup (bfd * abfd)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_close_and_cleanup (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
if (abfd == NULL)
return TRUE;
1999-05-03 07:29:11 +00:00
if (PRIV (vms_buf) != NULL)
free (PRIV (vms_buf));
1999-05-03 07:29:11 +00:00
if (PRIV (sections) != NULL)
free (PRIV (sections));
1999-05-03 07:29:11 +00:00
if (PRIV (vms_symbol_table))
bfd_hash_table_free (PRIV (vms_symbol_table));
1999-05-03 07:29:11 +00:00
bfd_release (abfd, abfd->tdata.any);
1999-05-03 07:29:11 +00:00
abfd->tdata.any = NULL;
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Ask the BFD to free all cached information. */
2005-04-21 07:45:39 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_free_cached_info (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_free_cached_info (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Called when a new section is created. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_new_section_hook (bfd * abfd, asection *section)
1999-05-03 07:29:11 +00:00
{
/* Count hasn't been incremented yet. */
unsigned int section_count = abfd->section_count + 1;
1999-05-03 07:29:11 +00:00
#if VMS_DEBUG
vms_debug (1, "vms_new_section_hook (%p, [%d]%s), count %d\n",
abfd, section->index, section->name, section_count);
1999-05-03 07:29:11 +00:00
#endif
bfd_set_section_alignment (abfd, section, 4);
1999-05-03 07:29:11 +00:00
if (section_count > PRIV (section_count))
1999-05-03 07:29:11 +00:00
{
bfd_size_type amt = section_count;
amt *= sizeof (asection *);
2005-04-21 07:45:39 +00:00
PRIV (sections) = bfd_realloc (PRIV (sections), amt);
if (PRIV (sections) == NULL)
return FALSE;
PRIV (section_count) = section_count;
1999-05-03 07:29:11 +00:00
}
#if VMS_DEBUG
vms_debug (6, "section_count: %d\n", PRIV (section_count));
1999-05-03 07:29:11 +00:00
#endif
PRIV (sections)[section->index] = section;
1999-05-03 07:29:11 +00:00
#if VMS_DEBUG
vms_debug (7, "%d: %s\n", section->index, section->name);
#endif
bfd/ * libbfd-in.h (_bfd_generic_new_section_hook): Declare. * section.c (bfd_abs_symbol, bfd_com_symbol): Delete. (bfd_und_symbol, bfd_ind_symbol): Delete. (BFD_FAKE_SECTION): Remove SYM_PTR param, set symbol_ptr_ptr to &SEC.symbol. (STD_SECTION): Adjust. (_bfd_generic_new_section_hook): New function, extracted from.. (bfd_section_init): ..here. (bfd_make_section_old_way): Call new_section_hook for abs, com, und and ind sections. * elf.c (_bfd_elf_large_com_section): Adjust. * aoutx.h (new_section_hook): Call _bfd_generic_new_section_hook. * pdp11.c (new_section_hook): Likewise. * coffcode.h (coff_new_section_hook): Likewise. * ecoff.c (_bfd_ecoff_new_section_hook): Likewise. * elf.c (_bfd_elf_new_section_hook): Likewise. * vms.c (vms_new_section_hook): Likwise. * elf32-arm.c (elf32_arm_new_section_hook): Check used_by_bfd isn't already set. * elf32-sh64.c (sh64_elf_new_section_hook): Likewise. * elf32-xtensa.c (elf_xtensa_new_section_hook): Likewise. * elf64-mmix.c (mmix_elf_new_section_hook): Likewise. * elf64-ppc.c (ppc64_elf_new_section_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_new_section_hook): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_new_section_hook): Likewise. * ieee.c (ieee_new_section_hook): Likewise. Call _bfd_generic_new_section_hook too. * mmo.c (mmo_new_section_hook): Likewise. * oasys.c (oasys_new_section_hook): Likewise. * som.c (som_new_section_hook): Likewise. * coff-w65.c (reloc_processing): Don't use bfd_abs_symbol. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * subsegs.c (subseg_get): Don't call obj_sec_set_private_data. * config/obj-elf.h (obj_sec_set_private_data): Delete. * config/tc-hppa.c (tc_gen_reloc): Don't use bfd_abs_symbol. * config/tc-mn10300.c (tc_gen_reloc): Likewise.
2006-05-03 14:26:41 +00:00
return _bfd_generic_new_section_hook (abfd, section);
1999-05-03 07:29:11 +00: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) */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_get_section_contents (bfd * abfd ATTRIBUTE_UNUSED,
asection *section ATTRIBUTE_UNUSED,
void * buf ATTRIBUTE_UNUSED,
file_ptr offset ATTRIBUTE_UNUSED,
bfd_size_type buf_size ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_section_contents (%p, %s, %p, off %ld, size %d)\n",
1999-05-03 07:29:11 +00:00
abfd, section->name, buf, offset, (int)buf_size);
#endif
2005-04-21 07:45:39 +00:00
/* Shouldn't be called, since all sections are IN_MEMORY. */
return FALSE;
1999-05-03 07:29:11 +00:00
}
/* Read the contents of a section.
buf points to a buffer of buf_size bytes to be filled with
2005-04-21 07:45:39 +00:00
section data (starting at offset into section). */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_get_section_contents_in_window (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 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_section_contents_in_window (%p, %s, %p, off %ld, count %d)\n",
1999-05-03 07:29:11 +00:00
abfd, section->name, w, offset, (int)count);
#endif
2005-04-21 07:45:39 +00:00
/* Shouldn't be called, since all sections are IN_MEMORY. */
return FALSE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* Part 4.2, copy private data. */
1999-05-03 07:29:11 +00:00
/* Called to copy BFD general private data from one object file
to another. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_copy_private_bfd_data (bfd *src ATTRIBUTE_UNUSED,
bfd *dest ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_copy_private_bfd_data (%p, %p)\n", src, dest);
1999-05-03 07:29:11 +00:00
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Merge private BFD information from the BFD @var{ibfd} to the
the output file BFD @var{obfd} when linking. Return <<TRUE>>
on success, <<FALSE>> on error. Possible error returns are:
1999-05-03 07:29:11 +00:00
o <<bfd_error_no_memory>> -
Not enough memory exists to create private data for @var{obfd}. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_merge_private_bfd_data (bfd * ibfd ATTRIBUTE_UNUSED,
bfd * obfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1,"vms_bfd_merge_private_bfd_data (%p, %p)\n", ibfd, obfd);
1999-05-03 07:29:11 +00:00
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Set private BFD flag information in the BFD @var{abfd}.
Return <<TRUE>> on success, <<FALSE>> on error. Possible error
1999-05-03 07:29:11 +00:00
returns are:
o <<bfd_error_no_memory>> -
Not enough memory exists to create private data for @var{obfd}. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_set_private_flags (bfd * abfd ATTRIBUTE_UNUSED,
flagword flags ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1,"vms_bfd_set_private_flags (%p, %lx)\n", abfd, (long)flags);
1999-05-03 07:29:11 +00:00
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Called to copy BFD private section data from one object file
to another. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_copy_private_section_data (bfd *srcbfd ATTRIBUTE_UNUSED,
asection *srcsec ATTRIBUTE_UNUSED,
bfd *dstbfd ATTRIBUTE_UNUSED,
asection *dstsec ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_copy_private_section_data (%p, %s, %p, %s)\n",
1999-05-03 07:29:11 +00:00
srcbfd, srcsec->name, dstbfd, dstsec->name);
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Called to copy BFD private symbol data from one object file
to another. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_copy_private_symbol_data (bfd *ibfd ATTRIBUTE_UNUSED,
asymbol *isym ATTRIBUTE_UNUSED,
bfd *obfd ATTRIBUTE_UNUSED,
asymbol *osym ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_copy_private_symbol_data (%p, %s, %p, %s)\n",
1999-05-03 07:29:11 +00:00
ibfd, isym->name, obfd, osym->name);
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* Part 4.3, core file. */
1999-05-03 07:29:11 +00:00
/* Return a read-only string explaining which program was running
when it failed and produced the core file abfd. */
static char *
2005-04-21 07:45:39 +00:00
vms_core_file_failing_command (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_core_file_failing_command (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return NULL;
1999-05-03 07:29:11 +00:00
}
/* Returns the signal number which caused the core dump which
generated the file the BFD abfd is attached to. */
static int
2005-04-21 07:45:39 +00:00
vms_core_file_failing_signal (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_core_file_failing_signal (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return 0;
}
/* 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 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_core_file_matches_executable_p (bfd * abfd ATTRIBUTE_UNUSED,
bfd *bbfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_core_file_matches_executable_p (%p, %p)\n", abfd, bbfd);
1999-05-03 07:29:11 +00:00
#endif
return FALSE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* Part 4.4, archive. */
1999-05-03 07:29:11 +00:00
/* ??? do something with an archive map.
Return FALSE on error, TRUE otherwise. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_slurp_armap (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_slurp_armap (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return FALSE;
1999-05-03 07:29:11 +00:00
}
/* ??? do something with an extended name table.
Return FALSE on error, TRUE otherwise. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_slurp_extended_name_table (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_slurp_extended_name_table (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return FALSE;
1999-05-03 07:29:11 +00:00
}
/* ??? do something with an extended name table.
Return FALSE on error, TRUE otherwise. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_construct_extended_name_table (bfd * abfd ATTRIBUTE_UNUSED,
char **tabloc ATTRIBUTE_UNUSED,
bfd_size_type *tablen ATTRIBUTE_UNUSED,
const char **name ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_construct_extended_name_table (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return FALSE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* Truncate the name of an archive to match system-dependent restrictions. */
1999-05-03 07:29:11 +00:00
static void
2005-04-21 07:45:39 +00:00
vms_truncate_arname (bfd * abfd ATTRIBUTE_UNUSED,
const char *pathname ATTRIBUTE_UNUSED,
char *arhdr ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_truncate_arname (%p, %s, %s)\n", abfd, pathname, arhdr);
1999-05-03 07:29:11 +00:00
#endif
return;
}
2005-04-21 07:45:39 +00:00
/* ??? write archive map. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_write_armap (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 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_write_armap (%p, %d, %p, %d %d)\n",
1999-05-03 07:29:11 +00:00
arch, elength, map, orl_count, stridx);
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Read archive header ??? */
2005-04-21 07:45:39 +00:00
static void *
vms_read_ar_hdr (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_read_ar_hdr (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return NULL;
1999-05-03 07:29:11 +00:00
}
/* 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 *
2005-04-21 07:45:39 +00:00
vms_openr_next_archived_file (bfd *arch ATTRIBUTE_UNUSED,
bfd *prev ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_openr_next_archived_file (%p, %p)\n", arch, prev);
1999-05-03 07:29:11 +00:00
#endif
return NULL;
1999-05-03 07:29:11 +00: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 *
2005-04-21 07:45:39 +00:00
vms_get_elt_at_index (bfd * abfd, symindex index)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_elt_at_index (%p, %p)\n", abfd, index);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return _bfd_generic_get_elt_at_index (abfd, index);
1999-05-03 07:29:11 +00:00
}
/* ???
2005-04-21 07:45:39 +00:00
-> bfd_generic_stat_arch_elt. */
1999-05-03 07:29:11 +00:00
static int
2005-04-21 07:45:39 +00:00
vms_generic_stat_arch_elt (bfd * abfd, struct stat *st)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_generic_stat_arch_elt (%p, %p)\n", abfd, st);
1999-05-03 07:29:11 +00:00
#endif
return bfd_generic_stat_arch_elt (abfd, st);
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* This is a new function in bfd 2.5. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_update_armap_timestamp (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_update_armap_timestamp (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* Part 4.5, symbols. */
1999-05-03 07:29:11 +00:00
/* 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
2005-04-21 07:45:39 +00:00
vms_get_symtab_upper_bound (bfd * abfd)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_symtab_upper_bound (%p), %d symbols\n", abfd, PRIV (gsd_sym_count));
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return (PRIV (gsd_sym_count) + 1) * sizeof (asymbol *);
1999-05-03 07:29:11 +00:00
}
/* Copy symbols from hash table to symbol vector
Index: doc/ChangeLog 2003-10-15 Andrew Cagney <cagney@redhat.com> * bfdint.texi (BFD target vector symbols): Rename _get_symtab to _canonicalize_symtab. 2003-10-15 Andrew Cagney <cagney@redhat.com> * targets.c (BFD_JUMP_TABLE_SYMBOLS): Replace NAME##_get_symtab with NAME##_canonicalize_symtab. * libcoff-in.h (coff_canonicalize_symtab): Update. * xsym.h (bfd_sym_canonicalize_symtab): Update. * elf-bfd.h (_bfd_elf_canonicalize_symtab): Update. * coffgen.c (coff_canonicalize_symtab): Update. * libbfd-in.h (_bfd_nosymbols_canonicalize_symtab): Update. * libnlm.h (nlmNAME(canonicalize_symtab)): Update. * ieee.c (ieee_vec): Update comment. * libecoff.h (_bfd_ecoff_canonicalize_symtab): Update. * mmo.c (mmo_canonicalize_symtab): Update. * nlm-target.h (nlm_canonicalize_symtab): Update. * nlmcode.h (nlm_canonicalize_symtab): Update. * i386msdos.c (msdos_canonicalize_symtab): Update. * hp300hpux.c (MY (canonicalize_symtab)): Update. * oasys.c (oasys_canonicalize_symtab): Update. * som.c (som_canonicalize_symtab): Update. * pef.c (bfd_pef_canonicalize_symtab): Update. * nlmcode.h (nlm_canonicalize_symtab): Update. * xsym.c (bfd_sym_canonicalize_symtab): Update. * vms.c (vms_canonicalize_symtab): Update. * versados.c (versados_canonicalize_symtab): Update. * mach-o.c (bfd_mach_o_canonicalize_symtab): Update. * ieee.c (ieee_canonicalize_symtab): Update. * pdp11.c (NAME(aout,canonicalize_symtab)): Update. * reloc.c: Update comment. * libaout.h (NAME(aout,canonicalize_symtab)): Update. * coff64-rs6000.c (aix5coff64_vec): Update. * coff64-rs6000.c (bfd_xcoff_aix5_backend_data): Update. * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update. * aoutx.h (NAME(aout,canonicalize_symtab)): Update. * elfxx-target.h (bfd_elfNN_canonicalize_symtab): Update. * hp300hpux.c (MY_canonicalize_symtab): Update. * ecoff.c (_bfd_ecoff_canonicalize_symtab): Update. * aout-tic30.c (MY_canonicalize_symtab): Update. * aout-target.h (MY_canonicalize_symtab): Update. * ppcboot.c (ppcboot_canonicalize_symtab): Update. * elf.c (_bfd_elf_canonicalize_symtab): Update. * elfcode.h (elf_canonicalize_symtab): Update. * ihex.c (ihex_canonicalize_symtab): Update. * tekhex.c (tekhex_canonicalize_symtab): Update. * binary.c (binary_canonicalize_symtab): Update. * srec.c (srec_canonicalize_symtab): Update.
2003-10-16 04:11:10 +00:00
called from bfd_hash_traverse in vms_canonicalize_symtab
2005-04-21 07:45:39 +00:00
init counter to 0 if entry == 0. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
copy_symbols (struct bfd_hash_entry *entry, void * arg)
1999-05-03 07:29:11 +00:00
{
2005-04-21 07:45:39 +00:00
bfd * abfd = (bfd *) arg;
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
if (entry == NULL) /* Init counter. */
PRIV (symnum) = 0;
2005-04-21 07:45:39 +00:00
else /* Fill vector, inc counter. */
PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol;
1999-05-03 07:29:11 +00:00
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Read the symbols from the BFD abfd, and fills in the vector
location with pointers to the symbols and a trailing NULL.
2005-04-21 07:45:39 +00:00
Return number of symbols read. */
1999-05-03 07:29:11 +00:00
static long
2005-04-21 07:45:39 +00:00
vms_canonicalize_symtab (bfd * abfd, asymbol **symbols)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_canonicalize_symtab (%p, <ret>)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
/* Init counter. */
copy_symbols (NULL, abfd);
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
/* Traverse table and fill symbols vector. */
PRIV (symcache) = symbols;
2005-04-21 07:45:39 +00:00
bfd_hash_traverse (PRIV (vms_symbol_table), copy_symbols, abfd);
1999-05-03 07:29:11 +00:00
symbols[PRIV (gsd_sym_count)] = NULL;
1999-05-03 07:29:11 +00:00
return PRIV (gsd_sym_count);
1999-05-03 07:29:11 +00: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 (???)
2005-04-21 07:45:39 +00:00
bfd_print_symbol_all print all we know, which is not much right now :-). */
1999-05-03 07:29:11 +00:00
static void
2005-04-21 07:45:39 +00:00
vms_print_symbol (bfd * abfd,
void * file,
asymbol *symbol,
bfd_print_symbol_type how)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_print_symbol (%p, %p, %p, %d)\n", abfd, file, symbol, how);
1999-05-03 07:29:11 +00:00
#endif
switch (how)
{
case bfd_print_symbol_name:
case bfd_print_symbol_more:
fprintf ((FILE *)file," %s", symbol->name);
1999-05-03 07:29:11 +00:00
break;
case bfd_print_symbol_all:
{
const char *section_name = symbol->section->name;
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
bfd_print_symbol_vandf (abfd, file, symbol);
1999-05-03 07:29:11 +00:00
2005-04-21 07:45:39 +00:00
fprintf ((FILE *) file," %-8s %s", section_name, symbol->name);
1999-05-03 07:29:11 +00:00
}
break;
}
}
/* 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
2005-04-21 07:45:39 +00:00
- debug. */
1999-05-03 07:29:11 +00:00
static void
2005-04-21 07:45:39 +00:00
vms_get_symbol_info (bfd * abfd ATTRIBUTE_UNUSED,
asymbol *symbol,
symbol_info *ret)
1999-05-03 07:29:11 +00:00
{
asection *sec;
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_symbol_info (%p, %p, %p)\n", abfd, symbol, ret);
1999-05-03 07:29:11 +00:00
#endif
sec = symbol->section;
2005-04-21 07:45:39 +00:00
if (ret == NULL)
1999-05-03 07:29:11 +00:00
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 TRUE if the given symbol sym in the BFD abfd is
a compiler generated local label, else return FALSE. */
1999-05-03 07:29:11 +00:00
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED,
const char *name)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_is_local_label_name (%p, %s)\n", abfd, name);
1999-05-03 07:29:11 +00:00
#endif
return name[0] == '$';
}
2005-04-21 07:45:39 +00:00
/* Get source line number for symbol. */
1999-05-03 07:29:11 +00:00
static alent *
2005-04-21 07:45:39 +00:00
vms_get_lineno (bfd * abfd ATTRIBUTE_UNUSED,
asymbol *symbol ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_lineno (%p, %p)\n", abfd, symbol);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return NULL;
1999-05-03 07:29:11 +00:00
}
/* 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. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_find_nearest_line (bfd * abfd ATTRIBUTE_UNUSED,
asection *section ATTRIBUTE_UNUSED,
asymbol **symbols ATTRIBUTE_UNUSED,
bfd_vma offset ATTRIBUTE_UNUSED,
const char **file ATTRIBUTE_UNUSED,
const char **func ATTRIBUTE_UNUSED,
unsigned int *line ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_find_nearest_line (%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n",
1999-05-03 07:29:11 +00:00
abfd, section->name, symbols, (long int)offset);
#endif
return FALSE;
1999-05-03 07:29:11 +00:00
}
Approved by nickc@redhat.com 2005-05-23 Fred Fish <fnf@specifixinc.com> * dwarf2.c (struct dwarf2_debug): Add inliner_chain member. (struct funcinfo): Add caller_func, caller_file, caller_line. tag, and nesting_level members. (lookup_address_in_function_table): Change first passed parameter from "struct funcinfo *" to "struct comp_unit *". (lookup_address_in_function_table): Dereference unit to find function table. (lookup_address_in_function_table): Traverse the function list to create a chain of inlined functions back to the first non inlined function. (scan_unit_for_functions): Remember tag and nesting level. Handle DW_AT_call_file and DW_AT_call_line. (comp_unit_find_nearest_line): Adjust lookup_address_in_function_table call to pass unit pointer instead of function table pointer. For inlined functions, save pointer to the inliner chain. (_bfd_dwarf2_find_nearest_line): Initialize inliner_chain to NULL. (_bfd_dwarf2_find_inliner_info): New function that returns information from the inliner chain after a call to bfd_find_nearest_line. * bfd.c (bfd_find_inliner_info): Define using BFD_SEND. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Add entry for NAME##_find_inliner_info. (bfd_target): Add _bfd_find_inliner_info. * bfd-in2.h: Regenerate. * libbfd-in.h (_bfd_nosymbols_find_inliner_info): Define as macro that always returns bfd_false. (_bfd_dwarf2_find_inliner_info): Declare. * libbfd.h: Regenerate. * elf32-arm.c (elf32_arm_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. (bfd_elf32_find_inliner_info): Define to elf32_arm_find_inliner_info. * elfxx-mips.c (_bfd_mips_elf_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * elfxx-mips.h (_bfd_mips_elf_find_inliner_info): Declare. * elfn32-mips.c (bfd_elf32_find_inliner_info): Define to _bfd_mips_elf_find_inliner_info. * elf64-mips.c (bfd_elf64_find_inliner_info): Ditto. * elf32-mips.c (bfd_elf32_find_inliner_info): Ditto. * elf.c (_bfd_elf_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * elf-bfd.h (_bfd_elf_find_inliner_info): Declare. * elfxx-target.h (bfd_elfNN_find_inliner_info): Define to _bfd_elf_find_inliner_info. * coffgen.c (coff_find_inliner_info): New function that calls _bfd_dwarf2_find_inliner_info. * libcoff-in.h (coff_find_inliner_info): Declare. * libcoff.h: Regenerate. * coff-rs6000.c (rs6000coff_vec): Add coff_find_inliner_info. (pmac_xcoff_vec) Ditto. * coff64-rs6000.c (rs6000coff64_vec): Ditto. (aix5coff64_vec): Ditto. * aout-target.h (MY_find_inliner_info): Define as _bfd_nosymbols_find_inliner_info. * aout-tic30.c (MY_find_inliner_info): Ditto. * binary.c (binary_find_inliner_info): Ditto. * i386msdos.c (msdos_find_inliner_info): Ditto. * ihex.c (ihex_find_inliner_info): Ditto. * libaout.h (aout_32_find_inliner_info): Ditto. * libecoff.h (_bfd_ecoff_find_inliner_info): Ditto. * mach-o.c (bfd_mach_o_find_inliner_info): Ditto. * mmo.c (mmo_find_inliner_info): Ditto. * nlm-target.h (nlm_find_inliner_info): Ditto. * pef.c (bfd_pef_find_inliner_info): Ditto. * ppcboot.c (ppcboot_find_inliner_info): Ditto. * srec.c (srec_find_inliner_info): Ditto. * tekhex.c (tekhex_find_inliner_info): Ditto. * versados.c (versados_find_inliner_info): Ditto. * xsym.c (bfd_sym_find_inliner_info): Ditto. * ieee.c (ieee_find_inliner_info): New function that always returns FALSE. * oasys.c (oasys_find_inliner_info): Ditto. * vms.c (vms_find_inliner_info): Ditto.
2005-05-23 17:44:55 +00:00
static bfd_boolean
vms_find_inliner_info (bfd * abfd ATTRIBUTE_UNUSED,
const char **file ATTRIBUTE_UNUSED,
const char **func ATTRIBUTE_UNUSED,
unsigned int *line ATTRIBUTE_UNUSED)
{
#if VMS_DEBUG
vms_debug (1, "vms_find_inliner_info (%p, <ret>, <ret>, <ret>)\n",
abfd);
#endif
return FALSE;
}
1999-05-03 07:29:11 +00: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 *
2005-04-21 07:45:39 +00:00
vms_bfd_make_debug_symbol (bfd * abfd ATTRIBUTE_UNUSED,
void *ptr ATTRIBUTE_UNUSED,
unsigned long size ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_make_debug_symbol (%p, %p, %ld)\n", abfd, ptr, size);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return NULL;
1999-05-03 07:29:11 +00:00
}
/* Read minisymbols. For minisymbols, we use the unmodified a.out
symbols. The minisymbol_to_symbol function translates these into
BFD asymbol structures. */
static long
2005-04-21 07:45:39 +00:00
vms_read_minisymbols (bfd * abfd,
bfd_boolean dynamic,
void * *minisymsp,
unsigned int *sizep)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_read_minisymbols (%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep);
1999-05-03 07:29:11 +00:00
#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 *
2005-04-21 07:45:39 +00:00
vms_minisymbol_to_symbol (bfd * abfd,
bfd_boolean dynamic,
const void * minisym,
asymbol *sym)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_minisymbol_to_symbol (%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym);
1999-05-03 07:29:11 +00:00
#endif
return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym);
}
2005-04-21 07:45:39 +00:00
/* Part 4.6, relocations. */
1999-05-03 07:29:11 +00:00
/* 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
2005-04-21 07:45:39 +00:00
vms_get_reloc_upper_bound (bfd * abfd ATTRIBUTE_UNUSED,
asection *section ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_reloc_upper_bound (%p, %s)\n", abfd, section->name);
1999-05-03 07:29:11 +00:00
#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
2005-04-21 07:45:39 +00:00
vms_canonicalize_reloc (bfd * abfd ATTRIBUTE_UNUSED,
asection *section ATTRIBUTE_UNUSED,
arelent **location ATTRIBUTE_UNUSED,
asymbol **symbols ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_canonicalize_reloc (%p, %s, <ret>, <ret>)\n", abfd, section->name);
1999-05-03 07:29:11 +00:00
#endif
return FALSE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* This is just copied from ecoff-alpha, needs to be fixed probably. */
1999-05-03 07:29:11 +00:00
/* How to process the various reloc types. */
static bfd_reloc_status_type
2005-04-21 07:45:39 +00:00
reloc_nil (bfd * abfd ATTRIBUTE_UNUSED,
arelent *reloc ATTRIBUTE_UNUSED,
asymbol *sym ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *sec ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "reloc_nil (abfd %p, output_bfd %p)\n", abfd, output_bfd);
1999-05-03 07:29:11 +00:00
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);
2005-04-21 07:45:39 +00:00
/* _bfd_hexdump (2, data, bfd_get_reloc_size (reloc->howto), 0); */
1999-05-03 07:29:11 +00:00
#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[] =
{
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_IGNORE, /* Type. */
0, /* Rightshift. */
0, /* Size (0 = byte, 1 = short, 2 = long). */
8, /* Bitsize. */
TRUE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_dont,/* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"IGNORE", /* Name. */
TRUE, /* Partial_inplace. */
0, /* Source mask */
0, /* Dest mask. */
TRUE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* A 64 bit reference to a symbol. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_REFQUAD, /* Type. */
0, /* Rightshift. */
4, /* Size (0 = byte, 1 = short, 2 = long). */
64, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_bitfield, /* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"REFQUAD", /* Name. */
TRUE, /* Partial_inplace. */
MINUS_ONE, /* Source mask. */
MINUS_ONE, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00: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. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_BRADDR, /* Type. */
2, /* Rightshift. */
2, /* Size (0 = byte, 1 = short, 2 = long). */
21, /* Bitsize. */
TRUE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_signed, /* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"BRADDR", /* Name. */
TRUE, /* Partial_inplace. */
0x1fffff, /* Source mask. */
0x1fffff, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* A hint for a jump to a register. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_HINT, /* Type. */
2, /* Rightshift. */
1, /* Size (0 = byte, 1 = short, 2 = long). */
14, /* Bitsize. */
TRUE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_dont,/* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"HINT", /* Name. */
TRUE, /* Partial_inplace. */
0x3fff, /* Source mask. */
0x3fff, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* 16 bit PC relative offset. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_SREL16, /* Type. */
0, /* Rightshift. */
1, /* Size (0 = byte, 1 = short, 2 = long). */
16, /* Bitsize. */
TRUE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_signed, /* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"SREL16", /* Name. */
TRUE, /* Partial_inplace. */
0xffff, /* Source mask. */
0xffff, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* 32 bit PC relative offset. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_SREL32, /* Type. */
0, /* Rightshift. */
2, /* Size (0 = byte, 1 = short, 2 = long). */
32, /* Bitsize. */
TRUE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_signed, /* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"SREL32", /* Name. */
TRUE, /* Partial_inplace. */
0xffffffff, /* Source mask. */
0xffffffff, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* A 64 bit PC relative offset. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_SREL64, /* Type. */
0, /* Rightshift. */
4, /* Size (0 = byte, 1 = short, 2 = long). */
64, /* Bitsize. */
TRUE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_signed, /* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"SREL64", /* Name. */
TRUE, /* Partial_inplace. */
MINUS_ONE, /* Source mask. */
MINUS_ONE, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* Push a value on the reloc evaluation stack. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_OP_PUSH, /* Type. */
0, /* Rightshift. */
0, /* Size (0 = byte, 1 = short, 2 = long). */
0, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_dont,/* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"OP_PUSH", /* Name. */
FALSE, /* Partial_inplace. */
0, /* Source mask. */
0, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00: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. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_OP_STORE, /* Type. */
0, /* Rightshift. */
4, /* Size (0 = byte, 1 = short, 2 = long). */
64, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_dont,/* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"OP_STORE", /* Name. */
FALSE, /* Partial_inplace. */
0, /* Source mask. */
MINUS_ONE, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* Subtract the reloc address from the value on the top of the
relocation stack. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_OP_PSUB, /* Type. */
0, /* Rightshift. */
0, /* Size (0 = byte, 1 = short, 2 = long). */
0, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_dont,/* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"OP_PSUB", /* Name. */
FALSE, /* Partial_inplace. */
0, /* Source mask. */
0, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* Shift the value on the top of the relocation stack right by the
given value. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_OP_PRSHIFT, /* Type. */
0, /* Rightshift. */
0, /* Size (0 = byte, 1 = short, 2 = long). */
0, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_dont,/* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"OP_PRSHIFT", /* Name. */
FALSE, /* Partial_inplace. */
0, /* Source mask. */
0, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* Hack. Linkage is done by linker. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_LINKAGE, /* Type. */
0, /* Rightshift. */
8, /* Size (0 = byte, 1 = short, 2 = long). */
256, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_dont,/* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"LINKAGE", /* Name. */
FALSE, /* Partial_inplace. */
0, /* Source mask. */
0, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* A 32 bit reference to a symbol. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_REFLONG, /* Type. */
0, /* Rightshift. */
2, /* Size (0 = byte, 1 = short, 2 = long). */
32, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_bitfield, /* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"REFLONG", /* Name. */
TRUE, /* Partial_inplace. */
0xffffffff, /* Source mask. */
0xffffffff, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00:00
/* A 64 bit reference to a procedure, written as 32 bit value. */
2005-04-21 07:45:39 +00:00
HOWTO (ALPHA_R_CODEADDR, /* Type. */
0, /* Rightshift. */
4, /* Size (0 = byte, 1 = short, 2 = long). */
64, /* Bitsize. */
FALSE, /* PC relative. */
0, /* Bitpos. */
complain_overflow_signed,/* Complain_on_overflow. */
reloc_nil, /* Special_function. */
"CODEADDR", /* Name. */
FALSE, /* Partial_inplace. */
0xffffffff, /* Source mask. */
0xffffffff, /* Dest mask. */
FALSE), /* PC rel offset. */
1999-05-03 07:29:11 +00: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 *
2005-04-21 07:45:39 +00:00
vms_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code)
1999-05-03 07:29:11 +00:00
{
int alpha_type;
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_reloc_type_lookup (%p, %d)\t", abfd, code);
1999-05-03 07:29:11 +00:00
#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);
2005-04-21 07:45:39 +00:00
return NULL;
1999-05-03 07:29:11 +00:00
}
#if VMS_DEBUG
vms_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name);
#endif
2005-04-21 07:45:39 +00:00
return & alpha_howto_table[alpha_type];
1999-05-03 07:29:11 +00:00
}
* aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define. * aout-arm.c (MY_bfd_reloc_name_lookup): Define. (MY (bfd_reloc_name_lookup)): New function. * aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function. * aout-target.h (NAME (aout, reloc_name_lookup)): Declare. (MY_bfd_reloc_name_lookup): Define. * aout-tic30.c (tic30_aout_reloc_name_lookup): New function. (MY_bfd_reloc_name_lookup): Define. * aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare. (NAME (aout, reloc_name_lookup)): New function. * bout.c (b_out_bfd_reloc_name_lookup): New function. * coff-alpha.c (alpha_bfd_reloc_name_lookup): New function. (_bfd_ecoff_bfd_reloc_name_lookup): Define. * coff-arm.c (coff_arm_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-i386.c (coff_bfd_reloc_name_lookup): Define. (coff_i386_reloc_name_lookup): New function. * coff-i860.c (coff_i860_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-i960.c (coff_i960_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-m68k.c (m68k_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-maxq.c (maxq_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-mcore.c (mcore_coff_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-mips.c (mips_bfd_reloc_name_lookup): New function. (_bfd_ecoff_bfd_reloc_name_lookup): Define. * coff-ppc.c (ppc_coff_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-rs6000.c (coff_bfd_reloc_name_lookup): Define. (_bfd_xcoff_reloc_name_lookup): New function. (rs6000coff_vec, pmac_xcoff_vec): Init new field. * coff-sh.c (coff_bfd_reloc_name_lookup): Define. (sh_coff_reloc_name_lookup): New function. * coff-sparc.c (coff_sparc_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-tic30.c (coff_bfd_reloc_name_lookup): Define. (tic30_coff_reloc_name_lookup): New function. * coff-tic4x.c (coff_bfd_reloc_name_lookup): Define. (tic4x_coff_reloc_name_lookup): New function. * coff-tic54x.c (coff_bfd_reloc_name_lookup): Define. (tic54x_coff_reloc_name_lookup): New function. * coff-x86_64.c (coff_bfd_reloc_name_lookup): Define. (coff_amd64_reloc_name_lookup): New function. * coff-z80.c (coff_z80_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-z8k.c (coff_z8k_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define. (xcoff64_reloc_name_lookup): New function. (rs6000coff64_vec, aix5coff64_vec): Init new field. * coffcode.h (coff_bfd_reloc_name_lookup): Define. * elf-hppa.h (elf_hppa_reloc_name_lookup): New function. * elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-arm.c (elf32_arm_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-cris.c (cris_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-crx.c (elf_crx_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-fr30.c (fr30_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-frv.c (frv_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-h8300.c (elf32_h8_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i370.c (i370_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i386.c (elf_i386_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i860.c (elf32_i860_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i960.c (elf32_i960_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-ip2k.c (ip2k_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-iq2000.c (iq2000_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m32c.c (m32c_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68k.c (reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mcore.c (mcore_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mep.c (mep_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. (mips_vxworks_bfd_reloc_name_lookup): Likewise. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-mt.c (mt_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-openrisc.c (openrisc_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-pj.c (pj_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-ppc.c (ppc_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-s390.c (elf_s390_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-score.c (elf32_score_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-sh.c (sh_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-spu.c (spu_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-v850.c (v850_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-vax.c (reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xc16x.c (xc16x_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function. * elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function. * elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-s390.c (elf_s390_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-sh64.c (sh_elf64_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function. (bfd_elfNN_bfd_reloc_name_lookup): Define. * elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function. * elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare. * i386msdos.c (msdos_bfd_reloc_name_lookup): Define. * i386os9k.c (aout_32_bfd_reloc_name_lookup): Define. * ieee.c (ieee_bfd_reloc_name_lookup): Define. * libaout.h (NAME (aout, reloc_name_lookup)): Declare. * libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare. * mipsbsd.c (MY_bfd_reloc_name_lookup): Define. (MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup). (MY(reloc_name_lookup)): New function. * nlm-target.h (nlm_bfd_reloc_name_lookup): Define. * oasys.c (oasys_bfd_reloc_name_lookup): Define. * pdp11.c (NAME (aout, reloc_name_lookup)): New function. * pe-mips.c (coff_mips_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * reloc.c (bfd_reloc_name_lookup): New function. * riscix.c (riscix_reloc_name_lookup): New function. (MY_bfd_reloc_name_lookup): Define. * som.c (som_bfd_reloc_name_lookup): New function. * targets.c (struct bfd_target): Add reloc_name_lookup. (BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup. * versados.c (versados_bfd_reloc_name_lookup): Define. * vms.c (vms_bfd_reloc_name_lookup): New function. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2007-03-26 12:23:03 +00:00
static reloc_howto_type *
vms_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
const char *r_name)
{
unsigned int i;
for (i = 0;
i < sizeof (alpha_howto_table) / sizeof (alpha_howto_table[0]);
i++)
if (alpha_howto_table[i].name != NULL
&& strcasecmp (alpha_howto_table[i].name, r_name) == 0)
return &alpha_howto_table[i];
return NULL;
}
2005-04-21 07:45:39 +00:00
/* Part 4.7, writing an object file. */
1999-05-03 07:29:11 +00:00
/* 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. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_set_arch_mach (bfd * abfd,
enum bfd_architecture arch ATTRIBUTE_UNUSED,
unsigned long mach ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_set_arch_mach (%p, %d, %ld)\n", abfd, arch, mach);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
abfd->arch_info = bfd_scan_arch ("alpha");
1999-05-03 07:29:11 +00:00
return TRUE;
1999-05-03 07:29:11 +00: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.
Normally TRUE is returned, else FALSE. Possible error returns are:
1999-05-03 07:29:11 +00: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 */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_set_section_contents (bfd * abfd,
asection *section,
const void * location,
file_ptr offset,
bfd_size_type count)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
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);
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
vms_debug (2, "size %d\n", (int) section->size);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return _bfd_save_vms_section (abfd, section, location, offset, count);
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* Part 4.8, linker. */
1999-05-03 07:29:11 +00:00
/* Get the size of the section headers. */
static int
2005-04-21 07:45:39 +00:00
vms_sizeof_headers (bfd * abfd ATTRIBUTE_UNUSED,
bfd/ * elf-bfd.h (struct elf_backend_data): Add bfd_link_info pointer parameter. (_bfd_elf_sizeof_headers): Replace bfd_boolean param with bfd_link_info pointer. * targets.c (struct bfd_target <_bfd_sizeof_headers>): Likewise. * bfd.c (bfd_sizeof_headers): Tweak param name. * aout-adobe.c (aout_adobe_sizeof_headers): Adjust. * aoutx.h (NAME (aout, sizeof_headers)): Adjust. * binary.c (binary_sizeof_headers): Adjust. * bout.c (b_out_sizeof_headers): Adjust. * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust. * coff64-rs6000.c (xcoff64_sizeof_headers): Adjust. * coffgen.c (coff_sizeof_headers): Adjust. * ecoff.c (_bfd_ecoff_sizeof_headers): Adjust. (ecoff_compute_section_file_positions): Adjust. (_bfd_ecoff_write_object_contents): Adjust. * elf.c (get_program_header_size, _bfd_elf_sizeof_headers): Adjust. * elf32-arm.c (elf32_arm_additional_program_headers): Adjust. * elf32-i370.c (elf_backend_additional_program_headers): Adjust. * elf32-ppc.c (ppc_elf_additional_program_headers): Adjust. * elf64-hppa.c (elf64_hppa_additional_program_headers): Adjust. * elf64-x86-64.c (elf64_x86_64_additional_program_headers): Adjust. * elfxx-ia64.c (elfNN_ia64_additional_program_headers): Adjust. * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Adjust. * elfxx-mips.h (_bfd_mips_elf_additional_program_headers): Adjust. * i386msdos.c: Convert to ISO C. (msdos_sizeof_headers): Adjust. * i386os9k.c: Convert to ISO C. (os9k_sizeof_headers): Adjust. * ieee.c (ieee_sizeof_headers): Adjust. * ihex.c (ihex_sizeof_headers): Adjust. * libaout.h (NAME (aout, sizeof_headers)): Adjust. * libbfd-in.h (_bfd_nolink_sizeof_headers): Adjust. * libcoff-in.h (coff_sizeof_headers): Adjust. * libecoff.h (_bfd_ecoff_sizeof_headers): Adjust. * mach-o.c (bfd_mach_o_sizeof_headers): Adjust. * mmo.c (mmo_sizeof_headers): Adjust. * oasys.c (oasys_sizeof_headers): Adjust. * pdp11.c (NAME (aout, sizeof_headers)): Adjust. * pef.c (bfd_pef_sizeof_headers): Adjust. * ppcboot.c (ppcboot_sizeof_headers): Adjust. * som.c (som_sizeof_headers): Adjust. * srec.c (srec_sizeof_headers): Adjust. * tekhex.c (tekhex_sizeof_headers): Adjust. * versados.c (versados_sizeof_headers): Adjust. * vms.c (vms_sizeof_headers): Adjust. * xcoff-target.h (_bfd_xcoff_sizeof_headers): Adjust. * xsym.c (bfd_sym_sizeof_headers): Adjust. * xsym.h (bfd_sym_sizeof_headers): Adjust. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * ldexp.c (fold_name): Adjust bfd_sizeof_headers call.
2006-06-19 13:17:44 +00:00
struct bfd_link_info *info ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_sizeof_headers (%p, %s)\n", abfd, (reloc)?"True":"False");
1999-05-03 07:29:11 +00:00
#endif
return 0;
}
/* Provides default handling of relocation effort for back ends
which can't be bothered to do it efficiently. */
static bfd_byte *
2005-04-21 07:45:39 +00:00
vms_bfd_get_relocated_section_contents (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,
bfd_boolean relocatable ATTRIBUTE_UNUSED,
asymbol **symbols ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_get_relocated_section_contents (%p, %p, %p, %p, %s, %p)\n",
abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return NULL;
1999-05-03 07:29:11 +00:00
}
/* ??? */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_relax_section (bfd * abfd ATTRIBUTE_UNUSED,
asection *section ATTRIBUTE_UNUSED,
struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
bfd_boolean *again ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_relax_section (%p, %s, %p, <ret>)\n",
abfd, section->name, link_info);
1999-05-03 07:29:11 +00:00
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_gc_sections (bfd * abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_gc_sections (%p, %p)\n", abfd, link_info);
1999-05-03 07:29:11 +00:00
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_merge_sections (bfd * abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
* 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 12:23:48 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_merge_sections (%p, %p)\n", abfd, link_info);
* 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 12:23:48 +00:00
#endif
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 12:23:48 +00:00
}
1999-05-03 07:29:11 +00:00
/* Create a hash table for the linker. Different backends store
different information in this table. */
static struct bfd_link_hash_table *
2005-04-21 07:45:39 +00:00
vms_bfd_link_hash_table_create (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_link_hash_table_create (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return NULL;
1999-05-03 07:29:11 +00:00
}
2002-04-04 Daniel Jacobowitz <drow@mvista.com> * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define. * aout-target.h (MY_bfd_link_hash_table_free): Conditionally define. * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise. * bfd.c (bfd_link_hash_table_free): Define. * binary.c (binary_bfd_link_hash_table_free): Define. * bout.c (b_out_bfd_link_hash_table_free): Define. * coff-rs6000.c (rs6000coff_vec): Include _bfd_generic_link_hash_table_free. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define. * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally define. * i386msdos.c (msdos_bfd_link_hash_table_free): Define. * i386os9k.c (os9k_bfd_link_hash_table_free): Define. * ieee.c (ieee_bfd_link_hash_table_free): Define. * ihex.c (ihex_bfd_link_hash_table_free): Define. * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define. (_bfd_generic_link_hash_table_free): Add prototype. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype. * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define. * linker.c (_bfd_generic_link_hash_table_free): New function. * mmo.c (mmo_bfd_link_hash_table_free): Define. * nlm-target.h (nlm_bfd_link_hash_table_free): Define. * oasys.c (oasys_bfd_link_hash_table_free): Define. * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define. * som.c (som_bfd_link_hash_table_free): Define. * srec.c (srec_bfd_link_hash_table_free): Define. * tekhex.c (tekhex_bfd_link_hash_table_free): Define. * versados.c (versados_bfd_link_hash_table_free): Define. * vms.c (vms_bfd_link_hash_table_free): New function. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function. * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc instead of bfd_alloc. * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise. * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise. * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise. * cofflink.c (_bfd_coff_link_hash_table_create): Likewise. * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise. * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise. * elf.c (_bfd_elf_link_hash_table_create): Likewise. * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise. * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise. * elf32-i386.c (elf_i386_link_hash_table_create): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create): Likewise. * elf32-sh.c (sh_elf_link_hash_table_create): Likewise. * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create): Likewise. * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise. * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise. * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise. * linker.c (_bfd_generic_link_hash_table_create): Likewise. * m68klinux.c (linux_link_hash_table_create): Likewise. * sparclinux.c (linux_link_hash_table_create): Likewise. * sunos.c (sunos_link_hash_table_create): Likewise. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise. * targets.c: Add _bfd_link_hash_table_free to xvec. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2002-04-04 19:53:38 +00:00
/* Free a linker hash table. */
static void
2005-04-21 07:45:39 +00:00
vms_bfd_link_hash_table_free (struct bfd_link_hash_table *hash ATTRIBUTE_UNUSED)
2002-04-04 Daniel Jacobowitz <drow@mvista.com> * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define. * aout-target.h (MY_bfd_link_hash_table_free): Conditionally define. * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise. * bfd.c (bfd_link_hash_table_free): Define. * binary.c (binary_bfd_link_hash_table_free): Define. * bout.c (b_out_bfd_link_hash_table_free): Define. * coff-rs6000.c (rs6000coff_vec): Include _bfd_generic_link_hash_table_free. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define. * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally define. * i386msdos.c (msdos_bfd_link_hash_table_free): Define. * i386os9k.c (os9k_bfd_link_hash_table_free): Define. * ieee.c (ieee_bfd_link_hash_table_free): Define. * ihex.c (ihex_bfd_link_hash_table_free): Define. * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define. (_bfd_generic_link_hash_table_free): Add prototype. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype. * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define. * linker.c (_bfd_generic_link_hash_table_free): New function. * mmo.c (mmo_bfd_link_hash_table_free): Define. * nlm-target.h (nlm_bfd_link_hash_table_free): Define. * oasys.c (oasys_bfd_link_hash_table_free): Define. * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define. * som.c (som_bfd_link_hash_table_free): Define. * srec.c (srec_bfd_link_hash_table_free): Define. * tekhex.c (tekhex_bfd_link_hash_table_free): Define. * versados.c (versados_bfd_link_hash_table_free): Define. * vms.c (vms_bfd_link_hash_table_free): New function. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function. * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc instead of bfd_alloc. * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise. * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise. * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise. * cofflink.c (_bfd_coff_link_hash_table_create): Likewise. * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise. * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise. * elf.c (_bfd_elf_link_hash_table_create): Likewise. * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise. * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise. * elf32-i386.c (elf_i386_link_hash_table_create): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create): Likewise. * elf32-sh.c (sh_elf_link_hash_table_create): Likewise. * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create): Likewise. * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise. * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise. * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise. * linker.c (_bfd_generic_link_hash_table_create): Likewise. * m68klinux.c (linux_link_hash_table_create): Likewise. * sparclinux.c (linux_link_hash_table_create): Likewise. * sunos.c (sunos_link_hash_table_create): Likewise. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise. * targets.c: Add _bfd_link_hash_table_free to xvec. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2002-04-04 19:53:38 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_link_hash_table_free (%p)\n", abfd);
2002-04-04 Daniel Jacobowitz <drow@mvista.com> * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define. * aout-target.h (MY_bfd_link_hash_table_free): Conditionally define. * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise. * bfd.c (bfd_link_hash_table_free): Define. * binary.c (binary_bfd_link_hash_table_free): Define. * bout.c (b_out_bfd_link_hash_table_free): Define. * coff-rs6000.c (rs6000coff_vec): Include _bfd_generic_link_hash_table_free. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define. * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally define. * i386msdos.c (msdos_bfd_link_hash_table_free): Define. * i386os9k.c (os9k_bfd_link_hash_table_free): Define. * ieee.c (ieee_bfd_link_hash_table_free): Define. * ihex.c (ihex_bfd_link_hash_table_free): Define. * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define. (_bfd_generic_link_hash_table_free): Add prototype. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype. * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define. * linker.c (_bfd_generic_link_hash_table_free): New function. * mmo.c (mmo_bfd_link_hash_table_free): Define. * nlm-target.h (nlm_bfd_link_hash_table_free): Define. * oasys.c (oasys_bfd_link_hash_table_free): Define. * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define. * som.c (som_bfd_link_hash_table_free): Define. * srec.c (srec_bfd_link_hash_table_free): Define. * tekhex.c (tekhex_bfd_link_hash_table_free): Define. * versados.c (versados_bfd_link_hash_table_free): Define. * vms.c (vms_bfd_link_hash_table_free): New function. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function. * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc instead of bfd_alloc. * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise. * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise. * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise. * cofflink.c (_bfd_coff_link_hash_table_create): Likewise. * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise. * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise. * elf.c (_bfd_elf_link_hash_table_create): Likewise. * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise. * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise. * elf32-i386.c (elf_i386_link_hash_table_create): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create): Likewise. * elf32-sh.c (sh_elf_link_hash_table_create): Likewise. * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create): Likewise. * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise. * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise. * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise. * linker.c (_bfd_generic_link_hash_table_create): Likewise. * m68klinux.c (linux_link_hash_table_create): Likewise. * sparclinux.c (linux_link_hash_table_create): Likewise. * sunos.c (sunos_link_hash_table_create): Likewise. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise. * targets.c: Add _bfd_link_hash_table_free to xvec. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2002-04-04 19:53:38 +00:00
#endif
}
1999-05-03 07:29:11 +00:00
/* Add symbols from this object file into the hash table. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_link_add_symbols (bfd * abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_link_add_symbols (%p, %p)\n", abfd, link_info);
1999-05-03 07:29:11 +00:00
#endif
return FALSE;
1999-05-03 07:29:11 +00:00
}
/* Do a link based on the link_order structures attached to each
section of the BFD. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_final_link (bfd * abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_final_link (%p, %p)\n", abfd, link_info);
1999-05-03 07:29:11 +00:00
#endif
return TRUE;
1999-05-03 07:29:11 +00:00
}
/* Should this section be split up into smaller pieces during linking. */
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_link_split_section (bfd * abfd ATTRIBUTE_UNUSED,
asection *section ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_link_split_section (%p, %s)\n", abfd, section->name);
1999-05-03 07:29:11 +00:00
#endif
return FALSE;
1999-05-03 07:29:11 +00:00
}
2005-04-21 07:45:39 +00:00
/* Part 4.9, dynamic symbols and relocations. */
1999-05-03 07:29:11 +00:00
/* Get the amount of memory required to hold the dynamic symbols. */
static long
2005-04-21 07:45:39 +00:00
vms_get_dynamic_symtab_upper_bound (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_dynamic_symtab_upper_bound (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return 0;
}
static bfd_boolean
2005-04-21 07:45:39 +00:00
vms_bfd_print_private_bfd_data (bfd * abfd ATTRIBUTE_UNUSED,
void *file ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_bfd_print_private_bfd_data (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
2005-04-21 07:45:39 +00:00
return FALSE;
1999-05-03 07:29:11 +00:00
}
/* Read in the dynamic symbols. */
static long
2005-04-21 07:45:39 +00:00
vms_canonicalize_dynamic_symtab (bfd * abfd ATTRIBUTE_UNUSED,
asymbol **symbols ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_canonicalize_dynamic_symtab (%p, <ret>)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return 0L;
}
/* Get the amount of memory required to hold the dynamic relocs. */
static long
2005-04-21 07:45:39 +00:00
vms_get_dynamic_reloc_upper_bound (bfd * abfd ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_get_dynamic_reloc_upper_bound (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return 0L;
}
/* Read in the dynamic relocs. */
static long
2005-04-21 07:45:39 +00:00
vms_canonicalize_dynamic_reloc (bfd * abfd ATTRIBUTE_UNUSED,
arelent **arel ATTRIBUTE_UNUSED,
asymbol **symbols ATTRIBUTE_UNUSED)
1999-05-03 07:29:11 +00:00
{
#if VMS_DEBUG
2005-04-21 07:45:39 +00:00
vms_debug (1, "vms_canonicalize_dynamic_reloc (%p)\n", abfd);
1999-05-03 07:29:11 +00:00
#endif
return 0L;
}
2005-04-21 07:45:39 +00:00
const bfd_target vms_alpha_vec =
{
"vms-alpha", /* Name. */
bfd_target_evax_flavour,
BFD_ENDIAN_LITTLE, /* Data byte order is little. */
BFD_ENDIAN_LITTLE, /* Header byte order is little. */
(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),
NULL,
NULL
};
const bfd_target vms_vax_vec =
{
"vms-vax", /* Name. */
bfd_target_ovax_flavour,
BFD_ENDIAN_LITTLE, /* Data byte order is little. */
BFD_ENDIAN_LITTLE, /* Header byte order is little. */
(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, /* Headers. */
{_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),
NULL,
NULL
};