binutils-gdb/bfd/aout-target.h

713 lines
21 KiB
C
Raw Permalink Normal View History

1999-05-03 09:29:11 +02:00
/* Define a target vector and some small routines for a variant of a.out.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
1999-05-03 09:29:11 +02:00
2005-04-11 10:23:05 +02:00
This file is part of BFD, the Binary File Descriptor library.
1999-05-03 09:29:11 +02:00
2005-04-11 10:23:05 +02: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-11 10:23:05 +02:00
(at your option) any later version.
1999-05-03 09:29:11 +02:00
2005-04-11 10:23:05 +02: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 09:29:11 +02:00
2005-04-11 10:23:05 +02: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 09:29:11 +02:00
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
#include "aout/ar.h"
/*#include "libaout.h"*/
#ifndef SEGMENT_SIZE
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#endif
2005-04-11 10:23:05 +02:00
extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
* 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 14:23:03 +02:00
extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *);
1999-05-03 09:29:11 +02:00
/* Set parameters about this a.out file that are machine-dependent.
This routine is called from some_aout_object_p just before it returns. */
#ifndef MY_callback
bfd_cleanup for object_p The object_p (and archive_p, core_file_p) functions are not supposed to have any target specific malloc'd memory attached to the bfd on their return. This should be obvious on a failure return, but it's also true for a successful return. The reason is that even though the object_p recognises the file, that particular target may not be used and thus the bfd won't be closed calling close_and_cleanup for the target that allocated the memory. It turns out that the object_p bfd_target* return value isn't needed. In all cases except ld/plugin.c the target is abfd->xvec and with ld/plugin.c the target isn't used. So this patch returns a cleanup function from object_p instead, called in bfd_check_format_matches to tidy the bfd before trying a different target match. The only cleanup that does anything at this stage is the alpha-vms one. bfd/ * targets.c (bfd_cleanup): New typedef. (struct bfd <_bfd_check_format>): Return a bfd_cleanup. * libbfd-in.h (_bfd_no_cleanup): Define. * format.c (bfd_reinit): Add cleanup parameter, call it. (bfd_check_format_matches): Set cleanup from _bfd_check_format call and pass to bfd_reinit. Delete temp, use abfd->xvec instead. * aout-target.h (callback, object_p): Return bfd_cleanup. * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise. * archive.c (bfd_generic_archive_p): Likewise. * binary.c (binary_object_p): Likewise. * coff-alpha.c (alpha_ecoff_object_p): Likewise. * coff-ia64.c (ia64coff_object_p): Likewise. * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise. * coff-sh.c (coff_small_object_p): Likewise. * coff-stgo32.c (go32_check_format): Likewise. * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p), (xcoff64_core_p): Likewise. * coffgen.c (coff_real_object_p, coff_object_p): Likewise. * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p), (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise. * elfcode.h (elf_object_p): Likewise. * elfcore.h (elf_core_file_p): Likewise. * i386msdos.c (msdos_object_p): Likewise. * ihex.c (ihex_object_p): Likewise. * libaout.h (some_aout_object_p): Likewise. * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target), (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise. * libbfd.c (_bfd_dummy_target): Likewise. * libcoff-in.h (coff_object_p): Likewise. * mach-o-aarch64.c (bfd_mach_o_arm64_object_p), (bfd_mach_o_arm64_core_p): Likewise. * mach-o-arm.c (bfd_mach_o_arm_object_p), (bfd_mach_o_arm_core_p): Likewise. * mach-o-i386.c (bfd_mach_o_i386_object_p), (bfd_mach_o_i386_core_p): Likewise. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p), (bfd_mach_o_x86_64_core_p): Likewise. * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p), (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise. * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p), (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise. * mmo.c (mmo_object_p): Likewise. * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise. * peicode.h (coff_real_object_p, pe_ILF_object_p), (pe_bfd_object_p): Likewise. * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise. * ppcboot.c (ppcboot_object_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * som.c (som_object_setup, som_object_p): Likewise. * srec.c (srec_object_p, symbolsrec_object_p): Likewise. * tekhex.c (tekhex_object_p): Likewise. * vms-alpha.c (alpha_vms_object_p): Likewise. * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p), (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise. * wasm-module.c (wasm_object_p): Likewise. * xsym.c (bfd_sym_object_p): Likewise. * xsym.h (bfd_sym_object_p): Likewise. * aoutx.h (some_aout_object_p): Likewise, and callback parameter return type. * pdp11.c (some_aout_object_p): Likewise. * plugin.c (register_ld_plugin_object_p): Update object_p parameter type. * plugin.h (register_ld_plugin_object_p): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * plugin.c (plugin_object_p): Return a bfd_cleanup. (plugin_cleanup): New function.
2020-03-02 05:51:09 +01:00
static bfd_cleanup
2005-04-11 10:23:05 +02:00
MY (callback) (bfd *abfd)
1999-05-03 09:29:11 +02:00
{
struct internal_exec *execp = exec_hdr (abfd);
unsigned int arch_align_power;
unsigned long arch_align;
2005-04-11 10:23:05 +02:00
/* Calculate the file positions of the parts of a newly read aout header. */
obj_textsec (abfd)->size = N_TXTSIZE (execp);
1999-05-03 09:29:11 +02:00
2005-04-11 10:23:05 +02:00
/* The virtual memory addresses of the sections. */
obj_textsec (abfd)->vma = N_TXTADDR (execp);
obj_datasec (abfd)->vma = N_DATADDR (execp);
obj_bsssec (abfd)->vma = N_BSSADDR (execp);
1999-05-03 09:29:11 +02:00
/* For some targets, if the entry point is not in the same page
as the start of the text, then adjust the VMA so that it is.
FIXME: Do this with a macro like SET_ARCH_MACH instead? */
if (aout_backend_info (abfd)->entry_is_text_address
&& execp->a_entry > obj_textsec (abfd)->vma)
{
bfd_vma adjust;
adjust = execp->a_entry - obj_textsec (abfd)->vma;
/* Adjust only by whole pages. */
1999-05-03 09:29:11 +02:00
adjust &= ~(TARGET_PAGE_SIZE - 1);
obj_textsec (abfd)->vma += adjust;
obj_datasec (abfd)->vma += adjust;
obj_bsssec (abfd)->vma += adjust;
}
/* Set the load addresses to be the same as the virtual addresses. */
obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
2005-04-11 10:23:05 +02:00
/* The file offsets of the sections. */
obj_textsec (abfd)->filepos = N_TXTOFF (execp);
obj_datasec (abfd)->filepos = N_DATOFF (execp);
1999-05-03 09:29:11 +02:00
2005-04-11 10:23:05 +02:00
/* The file offsets of the relocation info. */
obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp);
1999-05-03 09:29:11 +02:00
/* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_SYMOFF (execp);
obj_str_filepos (abfd) = N_STROFF (execp);
1999-05-03 09:29:11 +02:00
/* Determine the architecture and machine type of the object file. */
#ifdef SET_ARCH_MACH
SET_ARCH_MACH (abfd, execp);
1999-05-03 09:29:11 +02:00
#else
bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
1999-05-03 09:29:11 +02:00
#endif
/* The number of relocation records. This must be called after
SET_ARCH_MACH. It assumes that SET_ARCH_MACH will set
obj_reloc_entry_size correctly, if the reloc size is not
RELOC_STD_SIZE. */
obj_textsec (abfd)->reloc_count =
execp->a_trsize / obj_reloc_entry_size (abfd);
obj_datasec (abfd)->reloc_count =
execp->a_drsize / obj_reloc_entry_size (abfd);
/* Now that we know the architecture, set the alignments of the
2005-04-11 10:23:05 +02:00
sections. This is normally done by NAME (aout,new_section_hook),
1999-05-03 09:29:11 +02:00
but when the initial sections were created the architecture had
not yet been set. However, for backward compatibility, we don't
set the alignment power any higher than as required by the size
of the section. */
arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
arch_align = 1 << arch_align_power;
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 06:46:28 +02:00
if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align)
== obj_textsec (abfd)->size)
&& (BFD_ALIGN (obj_datasec (abfd)->size, arch_align)
== obj_datasec (abfd)->size)
&& (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align)
== obj_bsssec (abfd)->size))
1999-05-03 09:29:11 +02:00
{
obj_textsec (abfd)->alignment_power = arch_align_power;
obj_datasec (abfd)->alignment_power = arch_align_power;
obj_bsssec (abfd)->alignment_power = arch_align_power;
}
/* Don't set sizes now -- can't be sure until we know arch & mach.
Sizes get set in set_sizes callback, later. */
bfd_cleanup for object_p The object_p (and archive_p, core_file_p) functions are not supposed to have any target specific malloc'd memory attached to the bfd on their return. This should be obvious on a failure return, but it's also true for a successful return. The reason is that even though the object_p recognises the file, that particular target may not be used and thus the bfd won't be closed calling close_and_cleanup for the target that allocated the memory. It turns out that the object_p bfd_target* return value isn't needed. In all cases except ld/plugin.c the target is abfd->xvec and with ld/plugin.c the target isn't used. So this patch returns a cleanup function from object_p instead, called in bfd_check_format_matches to tidy the bfd before trying a different target match. The only cleanup that does anything at this stage is the alpha-vms one. bfd/ * targets.c (bfd_cleanup): New typedef. (struct bfd <_bfd_check_format>): Return a bfd_cleanup. * libbfd-in.h (_bfd_no_cleanup): Define. * format.c (bfd_reinit): Add cleanup parameter, call it. (bfd_check_format_matches): Set cleanup from _bfd_check_format call and pass to bfd_reinit. Delete temp, use abfd->xvec instead. * aout-target.h (callback, object_p): Return bfd_cleanup. * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise. * archive.c (bfd_generic_archive_p): Likewise. * binary.c (binary_object_p): Likewise. * coff-alpha.c (alpha_ecoff_object_p): Likewise. * coff-ia64.c (ia64coff_object_p): Likewise. * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise. * coff-sh.c (coff_small_object_p): Likewise. * coff-stgo32.c (go32_check_format): Likewise. * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p), (xcoff64_core_p): Likewise. * coffgen.c (coff_real_object_p, coff_object_p): Likewise. * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p), (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise. * elfcode.h (elf_object_p): Likewise. * elfcore.h (elf_core_file_p): Likewise. * i386msdos.c (msdos_object_p): Likewise. * ihex.c (ihex_object_p): Likewise. * libaout.h (some_aout_object_p): Likewise. * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target), (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise. * libbfd.c (_bfd_dummy_target): Likewise. * libcoff-in.h (coff_object_p): Likewise. * mach-o-aarch64.c (bfd_mach_o_arm64_object_p), (bfd_mach_o_arm64_core_p): Likewise. * mach-o-arm.c (bfd_mach_o_arm_object_p), (bfd_mach_o_arm_core_p): Likewise. * mach-o-i386.c (bfd_mach_o_i386_object_p), (bfd_mach_o_i386_core_p): Likewise. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p), (bfd_mach_o_x86_64_core_p): Likewise. * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p), (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise. * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p), (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise. * mmo.c (mmo_object_p): Likewise. * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise. * peicode.h (coff_real_object_p, pe_ILF_object_p), (pe_bfd_object_p): Likewise. * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise. * ppcboot.c (ppcboot_object_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * som.c (som_object_setup, som_object_p): Likewise. * srec.c (srec_object_p, symbolsrec_object_p): Likewise. * tekhex.c (tekhex_object_p): Likewise. * vms-alpha.c (alpha_vms_object_p): Likewise. * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p), (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise. * wasm-module.c (wasm_object_p): Likewise. * xsym.c (bfd_sym_object_p): Likewise. * xsym.h (bfd_sym_object_p): Likewise. * aoutx.h (some_aout_object_p): Likewise, and callback parameter return type. * pdp11.c (some_aout_object_p): Likewise. * plugin.c (register_ld_plugin_object_p): Update object_p parameter type. * plugin.h (register_ld_plugin_object_p): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * plugin.c (plugin_object_p): Return a bfd_cleanup. (plugin_cleanup): New function.
2020-03-02 05:51:09 +01:00
return _bfd_no_cleanup;
1999-05-03 09:29:11 +02:00
}
#endif
#ifndef MY_object_p
2005-04-11 10:23:05 +02:00
/* Finish up the reading of an a.out file header. */
1999-05-03 09:29:11 +02:00
bfd_cleanup for object_p The object_p (and archive_p, core_file_p) functions are not supposed to have any target specific malloc'd memory attached to the bfd on their return. This should be obvious on a failure return, but it's also true for a successful return. The reason is that even though the object_p recognises the file, that particular target may not be used and thus the bfd won't be closed calling close_and_cleanup for the target that allocated the memory. It turns out that the object_p bfd_target* return value isn't needed. In all cases except ld/plugin.c the target is abfd->xvec and with ld/plugin.c the target isn't used. So this patch returns a cleanup function from object_p instead, called in bfd_check_format_matches to tidy the bfd before trying a different target match. The only cleanup that does anything at this stage is the alpha-vms one. bfd/ * targets.c (bfd_cleanup): New typedef. (struct bfd <_bfd_check_format>): Return a bfd_cleanup. * libbfd-in.h (_bfd_no_cleanup): Define. * format.c (bfd_reinit): Add cleanup parameter, call it. (bfd_check_format_matches): Set cleanup from _bfd_check_format call and pass to bfd_reinit. Delete temp, use abfd->xvec instead. * aout-target.h (callback, object_p): Return bfd_cleanup. * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise. * archive.c (bfd_generic_archive_p): Likewise. * binary.c (binary_object_p): Likewise. * coff-alpha.c (alpha_ecoff_object_p): Likewise. * coff-ia64.c (ia64coff_object_p): Likewise. * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise. * coff-sh.c (coff_small_object_p): Likewise. * coff-stgo32.c (go32_check_format): Likewise. * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p), (xcoff64_core_p): Likewise. * coffgen.c (coff_real_object_p, coff_object_p): Likewise. * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p), (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise. * elfcode.h (elf_object_p): Likewise. * elfcore.h (elf_core_file_p): Likewise. * i386msdos.c (msdos_object_p): Likewise. * ihex.c (ihex_object_p): Likewise. * libaout.h (some_aout_object_p): Likewise. * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target), (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise. * libbfd.c (_bfd_dummy_target): Likewise. * libcoff-in.h (coff_object_p): Likewise. * mach-o-aarch64.c (bfd_mach_o_arm64_object_p), (bfd_mach_o_arm64_core_p): Likewise. * mach-o-arm.c (bfd_mach_o_arm_object_p), (bfd_mach_o_arm_core_p): Likewise. * mach-o-i386.c (bfd_mach_o_i386_object_p), (bfd_mach_o_i386_core_p): Likewise. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p), (bfd_mach_o_x86_64_core_p): Likewise. * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p), (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise. * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p), (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise. * mmo.c (mmo_object_p): Likewise. * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise. * peicode.h (coff_real_object_p, pe_ILF_object_p), (pe_bfd_object_p): Likewise. * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise. * ppcboot.c (ppcboot_object_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * som.c (som_object_setup, som_object_p): Likewise. * srec.c (srec_object_p, symbolsrec_object_p): Likewise. * tekhex.c (tekhex_object_p): Likewise. * vms-alpha.c (alpha_vms_object_p): Likewise. * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p), (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise. * wasm-module.c (wasm_object_p): Likewise. * xsym.c (bfd_sym_object_p): Likewise. * xsym.h (bfd_sym_object_p): Likewise. * aoutx.h (some_aout_object_p): Likewise, and callback parameter return type. * pdp11.c (some_aout_object_p): Likewise. * plugin.c (register_ld_plugin_object_p): Update object_p parameter type. * plugin.h (register_ld_plugin_object_p): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * plugin.c (plugin_object_p): Return a bfd_cleanup. (plugin_cleanup): New function.
2020-03-02 05:51:09 +01:00
static bfd_cleanup
2005-04-11 10:23:05 +02:00
MY (object_p) (bfd *abfd)
1999-05-03 09:29:11 +02:00
{
2005-04-11 10:23:05 +02:00
struct external_exec exec_bytes; /* Raw exec header from file. */
struct internal_exec exec; /* Cleaned-up exec header. */
bfd_cleanup for object_p The object_p (and archive_p, core_file_p) functions are not supposed to have any target specific malloc'd memory attached to the bfd on their return. This should be obvious on a failure return, but it's also true for a successful return. The reason is that even though the object_p recognises the file, that particular target may not be used and thus the bfd won't be closed calling close_and_cleanup for the target that allocated the memory. It turns out that the object_p bfd_target* return value isn't needed. In all cases except ld/plugin.c the target is abfd->xvec and with ld/plugin.c the target isn't used. So this patch returns a cleanup function from object_p instead, called in bfd_check_format_matches to tidy the bfd before trying a different target match. The only cleanup that does anything at this stage is the alpha-vms one. bfd/ * targets.c (bfd_cleanup): New typedef. (struct bfd <_bfd_check_format>): Return a bfd_cleanup. * libbfd-in.h (_bfd_no_cleanup): Define. * format.c (bfd_reinit): Add cleanup parameter, call it. (bfd_check_format_matches): Set cleanup from _bfd_check_format call and pass to bfd_reinit. Delete temp, use abfd->xvec instead. * aout-target.h (callback, object_p): Return bfd_cleanup. * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise. * archive.c (bfd_generic_archive_p): Likewise. * binary.c (binary_object_p): Likewise. * coff-alpha.c (alpha_ecoff_object_p): Likewise. * coff-ia64.c (ia64coff_object_p): Likewise. * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise. * coff-sh.c (coff_small_object_p): Likewise. * coff-stgo32.c (go32_check_format): Likewise. * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p), (xcoff64_core_p): Likewise. * coffgen.c (coff_real_object_p, coff_object_p): Likewise. * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p), (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise. * elfcode.h (elf_object_p): Likewise. * elfcore.h (elf_core_file_p): Likewise. * i386msdos.c (msdos_object_p): Likewise. * ihex.c (ihex_object_p): Likewise. * libaout.h (some_aout_object_p): Likewise. * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target), (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise. * libbfd.c (_bfd_dummy_target): Likewise. * libcoff-in.h (coff_object_p): Likewise. * mach-o-aarch64.c (bfd_mach_o_arm64_object_p), (bfd_mach_o_arm64_core_p): Likewise. * mach-o-arm.c (bfd_mach_o_arm_object_p), (bfd_mach_o_arm_core_p): Likewise. * mach-o-i386.c (bfd_mach_o_i386_object_p), (bfd_mach_o_i386_core_p): Likewise. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p), (bfd_mach_o_x86_64_core_p): Likewise. * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p), (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise. * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p), (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise. * mmo.c (mmo_object_p): Likewise. * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise. * peicode.h (coff_real_object_p, pe_ILF_object_p), (pe_bfd_object_p): Likewise. * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise. * ppcboot.c (ppcboot_object_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * som.c (som_object_setup, som_object_p): Likewise. * srec.c (srec_object_p, symbolsrec_object_p): Likewise. * tekhex.c (tekhex_object_p): Likewise. * vms-alpha.c (alpha_vms_object_p): Likewise. * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p), (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise. * wasm-module.c (wasm_object_p): Likewise. * xsym.c (bfd_sym_object_p): Likewise. * xsym.h (bfd_sym_object_p): Likewise. * aoutx.h (some_aout_object_p): Likewise, and callback parameter return type. * pdp11.c (some_aout_object_p): Likewise. * plugin.c (register_ld_plugin_object_p): Update object_p parameter type. * plugin.h (register_ld_plugin_object_p): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * plugin.c (plugin_object_p): Return a bfd_cleanup. (plugin_cleanup): New function.
2020-03-02 05:51:09 +01:00
bfd_cleanup cleanup;
bfd_size_type to size_t bfd_size_type was invented a long time ago in the K&R days. Many places in binutils ought to be using size_t instead (and there are lots of places that use long or unsigned long that really ought to use size_t too). Note that you can't change everything over to size_t: A 32-bit host needs a larger type than size_t to support reading and processing of 64-bit ELF object files. This patch just tidies some of the more obvious uses of bfd_size_type that could be size_t. There no doubt are more lurking in the source. Incidentally, practically all functions used for output of object files can use size_t and don't need to worry about overflow of size expressions. If you have something like symcount * sizeof (void *) when symcount is counting symbols already in memory then you know that this expression can't overflow since the size of a symbol in memory is larger by far than that of a pointer. * aix386-core.c (aix386_core_file_p): Use size_t for "amt". * aout-target.h (object_p): Likewise. * aout-tic30.c (tic30_aout_object_p): Likewise. * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol), (emit_stringtab, write_syms, link_hash_table_create), (aout_link_write_other_symbol): Likewise. * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p), (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents), (_bfd_compute_and_write_armap): Likewise. * archures.c (bfd_arch_list): Likewise. * bfd.c (bfd_record_phdr): Likewise. * binary.c (binary_canonicalize_symtab): Likewise. * cisco-core.c (cisco_core_file_validate): Likewise. * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue), (find_arm_glue, record_arm_to_thumb_glue), (record_thumb_to_arm_glue): Likewise. * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc), (ppc_allocate_toc_section): Likewise. * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise. * coff-sh.c (sh_relax_section): Likewise. * coff64-rs6000.c (xcoff64_archive_p): Likewise. * coffcode.h (handle_COMDAT, coff_new_section_hook), (coff_set_alignment_hook, coff_mkobject), (coff_compute_section_file_positions): Likewise. * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol), (coff_find_nearest_line_with_names), ( bfd_coff_set_symbol_class): Likewise. * cofflink.c (_bfd_coff_link_hash_table_create), (_bfd_coff_link_input_bfd): Likewise. * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise. * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info), (build_line_info_table, sort_line_sequences), (line_info_add_include_dir, line_info_add_file_name), (decode_line_info, scan_unit_for_symbols, parse_comp_unit), (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise. * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol), (_bfd_ecoff_find_nearest_line), (_bfd_ecoff_bfd_link_hash_table_create): Likewise. * ecofflink.c (bfd_ecoff_debug_init): Likewise. * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise. * elf-m10300.c (mn10300_elf_relax_section), (elf32_mn10300_link_hash_table_create): Likewise. * elf-strtab.c (_bfd_elf_strtab_init): Likewise. * elf.c (make_mapping, copy_elf_program_header): Likewise. * elf32-arm.c (elf32_arm_link_hash_table_create), (elf32_arm_setup_section_lists, elf32_arm_check_relocs), (elf32_arm_new_section_hook): Likewise. * elf32-avr.c (elf_avr_new_section_hook), (elf32_avr_link_hash_table_create, get_local_syms), (elf32_avr_setup_section_lists): Likewise. * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create), (bfin_link_hash_table_create): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise. * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. * elf32-csky.c (csky_elf_link_hash_table_create), (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise. * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_create), (elf32_hppa_setup_section_lists, get_local_syms): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise. * elf32-m32r.c (m32r_elf_link_hash_table_create), (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_create), (elf32_m68hc11_setup_section_lists), (elf32_m68hc11_size_stubs): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-metag.c (elf_metag_link_hash_table_create), (elf_metag_setup_section_lists): Likewise. * elf32-microblaze.c (microblaze_elf_link_hash_table_create), (microblaze_elf_check_relocs): Likewise. * elf32-nds32.c (nds32_elf_link_hash_table_create), (nds32_elf_check_relocs): Likewise. * elf32-nios2.c (nios2_elf32_setup_section_lists), (get_local_syms, nios2_elf32_check_relocs), (nios2_elf32_link_hash_table_create): Likewise. * elf32-or1k.c (or1k_elf_link_hash_table_create), (or1k_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise. * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create), (elf_s390_check_relocs): Likewise. * elf32-score.c (score_elf_create_got_section), (s3_elf32_score_new_section_hook), (elf32_score_link_hash_table_create): Likewise. * elf32-score7.c (score_elf_create_got_section), (s7_elf32_score_new_section_hook): Likewise. * elf32-sh.c (sh_elf_link_hash_table_create), (sh_elf_check_relocs): Likewise. * elf32-tic6x.c (elf32_tic6x_link_hash_table_create), (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise. * elf32-tilepro.c (tilepro_elf_link_hash_table_create), (tilepro_elf_check_relocs): Likewise. * elf32-v850.c (remember_hi16s_reloc): Likewise. * elf32-vax.c (elf_vax_link_hash_table_create): Likewise. * elf32-xtensa.c (elf_xtensa_link_hash_table_create), (elf_xtensa_new_section_hook): Likewise. * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create), (get_got_entry, elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise. * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise. * elf64-mmix.c (mmix_elf_new_section_hook): Likewise. * elf64-ppc.c (ppc64_elf_new_section_hook), (ppc64_elf_link_hash_table_create, update_local_sym_info), (update_plt_info, ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create), (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elflink.c (bfd_elf_link_record_local_dynamic_symbol), (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols), (elf_link_add_archive_symbols, compute_bucket_count), (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create), (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out), (bfd_elf_final_link): Likewise. * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create), (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs), (elfNN_aarch64_new_section_hook): Likewise. * elfnn-ia64.c (elfNN_ia64_object_p): Likewise. * elfnn-riscv.c (riscv_elf_link_hash_table_create), (riscv_elf_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_new_section_hook), (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs), (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents), (_bfd_mips_elf_link_hash_table_create): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create), (_bfd_sparc_elf_check_relocs), (_bfd_sparc_elf_new_section_hook): Likewise. * elfxx-tilegx.c (tilegx_elf_link_hash_table_create), (tilegx_elf_check_relocs): Likewise. * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise. * format.c (bfd_check_format_matches): Likewise. * hash.c (_bfd_stringtab_init): Likewise. * ihex.c (ihex_scan): Likewise. * irix-core.c (irix_core_core_file_p): Likewise. * linker.c (bfd_wrapped_link_hash_lookup), (_bfd_generic_link_hash_table_create), (_bfd_generic_reloc_link_order): Likewise. * lynx-core.c (lynx_core_file_p): Likewise. * netbsd-core.c (netbsd_core_file_p): Likewise. * osf-core.c (osf_core_core_file_p): Likewise. * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol), (link_hash_table_create, aout_link_write_other_symbol): Likewise. * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise. * peicode.h (pe_mkobject): Likewise. * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise. * ptrace-core.c (ptrace_unix_core_file_p): Likewise. * sco5-core.c (read_uarea): Likewise. * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers), (som_write_fixups, som_write_space_strings, som_write_symbol_strings), (som_finish_writing, som_canonicalize_symtab, som_new_section_hook), (som_bfd_copy_private_section_data, bfd_som_set_section_attributes), (bfd_som_attach_aux_hdr, som_write_armap): Likewise. * srec.c (srec_scan): Likewise. * syms.c (_bfd_generic_make_empty_symbol): Likewise. * targets.c (bfd_target_list): Likewise. * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise. * trad-core.c (trad_unix_core_file_p): Likewise. * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create), (vms_new_section_hook): Likewise. * wasm-module.c (wasm_make_empty_symbol): Likewise. * xcofflink.c (xcoff_get_section_contents), (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path), (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym), (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
2020-02-19 03:42:00 +01:00
size_t amt = EXEC_BYTES_SIZE;
1999-05-03 09:29:11 +02:00
2005-04-11 10:23:05 +02:00
if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
1999-05-03 09:29:11 +02:00
#ifdef SWAP_MAGIC
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
2001-02-19 00:33:11 +01:00
exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
2005-04-11 10:23:05 +02:00
#endif
if (N_BADMAG (&exec))
2005-04-11 10:23:05 +02:00
return 0;
1999-05-03 09:29:11 +02:00
#ifdef MACHTYPE_OK
if (!(MACHTYPE_OK (N_MACHTYPE (&exec))))
2005-04-11 10:23:05 +02:00
return 0;
1999-05-03 09:29:11 +02:00
#endif
2005-04-11 10:23:05 +02:00
NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
1999-05-03 09:29:11 +02:00
#ifdef SWAP_MAGIC
2005-04-11 10:23:05 +02:00
/* Swap_exec_header_in read in a_info with the wrong byte order. */
1999-05-03 09:29:11 +02:00
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
2005-04-11 10:23:05 +02:00
#endif
1999-05-03 09:29:11 +02:00
bfd_cleanup for object_p The object_p (and archive_p, core_file_p) functions are not supposed to have any target specific malloc'd memory attached to the bfd on their return. This should be obvious on a failure return, but it's also true for a successful return. The reason is that even though the object_p recognises the file, that particular target may not be used and thus the bfd won't be closed calling close_and_cleanup for the target that allocated the memory. It turns out that the object_p bfd_target* return value isn't needed. In all cases except ld/plugin.c the target is abfd->xvec and with ld/plugin.c the target isn't used. So this patch returns a cleanup function from object_p instead, called in bfd_check_format_matches to tidy the bfd before trying a different target match. The only cleanup that does anything at this stage is the alpha-vms one. bfd/ * targets.c (bfd_cleanup): New typedef. (struct bfd <_bfd_check_format>): Return a bfd_cleanup. * libbfd-in.h (_bfd_no_cleanup): Define. * format.c (bfd_reinit): Add cleanup parameter, call it. (bfd_check_format_matches): Set cleanup from _bfd_check_format call and pass to bfd_reinit. Delete temp, use abfd->xvec instead. * aout-target.h (callback, object_p): Return bfd_cleanup. * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise. * archive.c (bfd_generic_archive_p): Likewise. * binary.c (binary_object_p): Likewise. * coff-alpha.c (alpha_ecoff_object_p): Likewise. * coff-ia64.c (ia64coff_object_p): Likewise. * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise. * coff-sh.c (coff_small_object_p): Likewise. * coff-stgo32.c (go32_check_format): Likewise. * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p), (xcoff64_core_p): Likewise. * coffgen.c (coff_real_object_p, coff_object_p): Likewise. * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p), (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise. * elfcode.h (elf_object_p): Likewise. * elfcore.h (elf_core_file_p): Likewise. * i386msdos.c (msdos_object_p): Likewise. * ihex.c (ihex_object_p): Likewise. * libaout.h (some_aout_object_p): Likewise. * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target), (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise. * libbfd.c (_bfd_dummy_target): Likewise. * libcoff-in.h (coff_object_p): Likewise. * mach-o-aarch64.c (bfd_mach_o_arm64_object_p), (bfd_mach_o_arm64_core_p): Likewise. * mach-o-arm.c (bfd_mach_o_arm_object_p), (bfd_mach_o_arm_core_p): Likewise. * mach-o-i386.c (bfd_mach_o_i386_object_p), (bfd_mach_o_i386_core_p): Likewise. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p), (bfd_mach_o_x86_64_core_p): Likewise. * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p), (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise. * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p), (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise. * mmo.c (mmo_object_p): Likewise. * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise. * peicode.h (coff_real_object_p, pe_ILF_object_p), (pe_bfd_object_p): Likewise. * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise. * ppcboot.c (ppcboot_object_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * som.c (som_object_setup, som_object_p): Likewise. * srec.c (srec_object_p, symbolsrec_object_p): Likewise. * tekhex.c (tekhex_object_p): Likewise. * vms-alpha.c (alpha_vms_object_p): Likewise. * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p), (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise. * wasm-module.c (wasm_object_p): Likewise. * xsym.c (bfd_sym_object_p): Likewise. * xsym.h (bfd_sym_object_p): Likewise. * aoutx.h (some_aout_object_p): Likewise, and callback parameter return type. * pdp11.c (some_aout_object_p): Likewise. * plugin.c (register_ld_plugin_object_p): Update object_p parameter type. * plugin.h (register_ld_plugin_object_p): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * plugin.c (plugin_object_p): Return a bfd_cleanup. (plugin_cleanup): New function.
2020-03-02 05:51:09 +01:00
cleanup = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
1999-05-03 09:29:11 +02:00
#ifdef ENTRY_CAN_BE_ZERO
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
2005-04-11 10:23:05 +02:00
means that it isn't obvious if EXEC_P should be set.
All of the following must be true for an executable:
There must be no relocations, the bfd can be neither an
archive nor an archive element, and the file must be executable. */
1999-05-03 09:29:11 +02:00
if (exec.a_trsize + exec.a_drsize == 0
&& bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
{
struct stat buf;
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
Use bfd_get_filename throughout bfd * aix5ppc-core.c (xcoff64_core_file_matches_executable_p): Use bfd_get_filename rather than accessing bfd->filename directly. * aout-target.h (MY (object_p)): Likewise. * aoutx.h (aout_find_nearest_line, aout_link_write_symbols): Likewise. * archive.c (find_nested_archive, _bfd_generic_read_ar_hdr_mag), (_bfd_construct_extended_name_table, _bfd_bsd44_write_ar_hdr), (_bfd_archive_bsd44_construct_extended_name_table), (_bfd_write_archive_contents, _bfd_compute_and_write_armap), (_bfd_bsd_write_armap): Likewise. * bfd.c (bfd_errmsg, _bfd_doprnt): Likewise. * cache.c (bfd_open_file): Likewise. * ecoff.c (_bfd_ecoff_write_armap): Likewise. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Likewise. * elf32-bfin.c (bfinfdpic_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_final_link): Likewise. * elf32-nds32.c (nds32_elf_output_symbol_hook), (patch_tls_desc_to_ie): Likewise. * elf32-spu.c (sort_bfds, print_one_overlay_section), (spu_elf_auto_overlay): Likewise. * elf64-hppa.c (elf_hppa_final_link): Likewise. * elf64-ia64-vms.c (elf64_ia64_size_dynamic_sections): Likewise. * elfcore.h (elf_core_file_matches_executable_p): Likewise. * elflink.c (bfd_elf_size_dynamic_sections), (elf_link_input_bfd): Likewise. * linker.c (_bfd_generic_link_output_symbols): Likewise. * mach-o.c (bfd_mach_o_follow_dsym), (bfd_mach_o_close_and_cleanup): Likewise. * opncls.c (_bfd_delete_bfd, _maybe_make_executable), (find_separate_debug_file, get_build_id_name): Likewise. * pdp11.c (aout_find_nearest_line, aout_link_write_symbols): Likewise. * plugin.c (bfd_plugin_open_input): Likewise. * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Likewise. * som.c (som_write_armap): Likewise. * srec.c (srec_write_record, srec_write_symbols): Likewise. * vms-lib.c (_bfd_vms_lib_get_imagelib_file), (_bfd_vms_lib_write_archive_contents): Likewise. * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
2020-05-19 05:05:03 +02:00
if (stat (bfd_get_filename (abfd), &buf) == 0
&& (buf.st_mode & S_IXUSR) != 0)
1999-05-03 09:29:11 +02:00
abfd->flags |= EXEC_P;
}
#endif /* ENTRY_CAN_BE_ZERO */
bfd_cleanup for object_p The object_p (and archive_p, core_file_p) functions are not supposed to have any target specific malloc'd memory attached to the bfd on their return. This should be obvious on a failure return, but it's also true for a successful return. The reason is that even though the object_p recognises the file, that particular target may not be used and thus the bfd won't be closed calling close_and_cleanup for the target that allocated the memory. It turns out that the object_p bfd_target* return value isn't needed. In all cases except ld/plugin.c the target is abfd->xvec and with ld/plugin.c the target isn't used. So this patch returns a cleanup function from object_p instead, called in bfd_check_format_matches to tidy the bfd before trying a different target match. The only cleanup that does anything at this stage is the alpha-vms one. bfd/ * targets.c (bfd_cleanup): New typedef. (struct bfd <_bfd_check_format>): Return a bfd_cleanup. * libbfd-in.h (_bfd_no_cleanup): Define. * format.c (bfd_reinit): Add cleanup parameter, call it. (bfd_check_format_matches): Set cleanup from _bfd_check_format call and pass to bfd_reinit. Delete temp, use abfd->xvec instead. * aout-target.h (callback, object_p): Return bfd_cleanup. * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise. * archive.c (bfd_generic_archive_p): Likewise. * binary.c (binary_object_p): Likewise. * coff-alpha.c (alpha_ecoff_object_p): Likewise. * coff-ia64.c (ia64coff_object_p): Likewise. * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise. * coff-sh.c (coff_small_object_p): Likewise. * coff-stgo32.c (go32_check_format): Likewise. * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p), (xcoff64_core_p): Likewise. * coffgen.c (coff_real_object_p, coff_object_p): Likewise. * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p), (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise. * elfcode.h (elf_object_p): Likewise. * elfcore.h (elf_core_file_p): Likewise. * i386msdos.c (msdos_object_p): Likewise. * ihex.c (ihex_object_p): Likewise. * libaout.h (some_aout_object_p): Likewise. * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target), (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise. * libbfd.c (_bfd_dummy_target): Likewise. * libcoff-in.h (coff_object_p): Likewise. * mach-o-aarch64.c (bfd_mach_o_arm64_object_p), (bfd_mach_o_arm64_core_p): Likewise. * mach-o-arm.c (bfd_mach_o_arm_object_p), (bfd_mach_o_arm_core_p): Likewise. * mach-o-i386.c (bfd_mach_o_i386_object_p), (bfd_mach_o_i386_core_p): Likewise. * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p), (bfd_mach_o_x86_64_core_p): Likewise. * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p), (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise. * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p), (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise. * mmo.c (mmo_object_p): Likewise. * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise. * peicode.h (coff_real_object_p, pe_ILF_object_p), (pe_bfd_object_p): Likewise. * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise. * ppcboot.c (ppcboot_object_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * som.c (som_object_setup, som_object_p): Likewise. * srec.c (srec_object_p, symbolsrec_object_p): Likewise. * tekhex.c (tekhex_object_p): Likewise. * vms-alpha.c (alpha_vms_object_p): Likewise. * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p), (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise. * wasm-module.c (wasm_object_p): Likewise. * xsym.c (bfd_sym_object_p): Likewise. * xsym.h (bfd_sym_object_p): Likewise. * aoutx.h (some_aout_object_p): Likewise, and callback parameter return type. * pdp11.c (some_aout_object_p): Likewise. * plugin.c (register_ld_plugin_object_p): Update object_p parameter type. * plugin.h (register_ld_plugin_object_p): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * plugin.c (plugin_object_p): Return a bfd_cleanup. (plugin_cleanup): New function.
2020-03-02 05:51:09 +01:00
return cleanup;
1999-05-03 09:29:11 +02:00
}
2005-04-11 10:23:05 +02:00
#define MY_object_p MY (object_p)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_mkobject
static bfd_boolean
2005-04-11 10:23:05 +02:00
MY (mkobject) (bfd *abfd)
1999-05-03 09:29:11 +02:00
{
return NAME (aout, mkobject (abfd));
1999-05-03 09:29:11 +02:00
}
2005-04-11 10:23:05 +02:00
#define MY_mkobject MY (mkobject)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_bfd_copy_private_section_data
/* Copy private section data. This actually does nothing with the
sections. It copies the subformat field. We copy it here, because
we need to know whether this is a QMAGIC file before we set the
section contents, and copy_private_bfd_data is not called until
after the section contents have been set. */
static bfd_boolean
2005-04-11 10:23:05 +02:00
MY_bfd_copy_private_section_data (bfd *ibfd,
asection *isec ATTRIBUTE_UNUSED,
bfd *obfd,
asection *osec ATTRIBUTE_UNUSED)
1999-05-03 09:29:11 +02:00
{
if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
&& bfd_get_flavour (obfd) == bfd_target_aout_flavour)
obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
return TRUE;
1999-05-03 09:29:11 +02:00
}
#endif
/* Write an object file.
Section contents have already been written. We write the
file header, symbols, and relocation. */
#ifndef MY_write_object_contents
static bfd_boolean
2005-04-11 10:23:05 +02:00
MY (write_object_contents) (bfd *abfd)
1999-05-03 09:29:11 +02:00
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
2005-04-11 10:23:05 +02:00
WRITE_HEADERS (abfd, execp);
1999-05-03 09:29:11 +02:00
return TRUE;
1999-05-03 09:29:11 +02:00
}
2005-04-11 10:23:05 +02:00
#define MY_write_object_contents MY (write_object_contents)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_set_sizes
static bfd_boolean
2005-04-11 10:23:05 +02:00
MY (set_sizes) (bfd *abfd)
1999-05-03 09:29:11 +02:00
{
adata(abfd).page_size = TARGET_PAGE_SIZE;
adata(abfd).segment_size = SEGMENT_SIZE;
#ifdef ZMAGIC_DISK_BLOCK_SIZE
adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
#else
adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
#endif
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
return TRUE;
1999-05-03 09:29:11 +02:00
}
2005-04-11 10:23:05 +02:00
#define MY_set_sizes MY (set_sizes)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_exec_hdr_flags
#define MY_exec_hdr_flags 0
#endif
#ifndef MY_backend_data
#ifndef MY_zmagic_contiguous
#define MY_zmagic_contiguous 0
#endif
#ifndef MY_text_includes_header
#define MY_text_includes_header 0
#endif
#ifndef MY_entry_is_text_address
#define MY_entry_is_text_address 0
#endif
#ifndef MY_exec_header_not_counted
#define MY_exec_header_not_counted 0
#endif
#ifndef MY_add_dynamic_symbols
#define MY_add_dynamic_symbols 0
#endif
#ifndef MY_add_one_symbol
#define MY_add_one_symbol 0
#endif
#ifndef MY_link_dynamic_object
#define MY_link_dynamic_object 0
#endif
#ifndef MY_write_dynamic_symbol
#define MY_write_dynamic_symbol 0
#endif
#ifndef MY_check_dynamic_reloc
#define MY_check_dynamic_reloc 0
#endif
#ifndef MY_finish_dynamic_link
#define MY_finish_dynamic_link 0
#endif
2005-04-11 10:23:05 +02:00
static const struct aout_backend_data MY (backend_data) =
{
1999-05-03 09:29:11 +02:00
MY_zmagic_contiguous,
MY_text_includes_header,
MY_entry_is_text_address,
MY_exec_hdr_flags,
2005-04-11 10:23:05 +02:00
0, /* Text vma? */
1999-05-03 09:29:11 +02:00
MY_set_sizes,
MY_exec_header_not_counted,
MY_add_dynamic_symbols,
MY_add_one_symbol,
MY_link_dynamic_object,
MY_write_dynamic_symbol,
MY_check_dynamic_reloc,
MY_finish_dynamic_link
};
2005-04-11 10:23:05 +02:00
#define MY_backend_data &MY (backend_data)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_final_link_callback
/* Callback for the final_link routine to set the section offsets. */
static void
2005-04-11 10:23:05 +02:00
MY_final_link_callback (bfd *abfd,
file_ptr *ptreloff,
file_ptr *pdreloff,
file_ptr *psymoff)
1999-05-03 09:29:11 +02:00
{
struct internal_exec *execp = exec_hdr (abfd);
*ptreloff = N_TRELOFF (execp);
*pdreloff = N_DRELOFF (execp);
*psymoff = N_SYMOFF (execp);
1999-05-03 09:29:11 +02:00
}
#endif
#ifndef MY_bfd_final_link
/* Final link routine. We need to use a call back to get the correct
offsets in the output file. */
static bfd_boolean
2005-04-11 10:23:05 +02:00
MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
1999-05-03 09:29:11 +02:00
{
2005-04-11 10:23:05 +02:00
return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
1999-05-03 09:29:11 +02:00
}
#endif
/* We assume BFD generic archive files. */
#ifndef MY_openr_next_archived_file
#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file
#endif
#ifndef MY_get_elt_at_index
#define MY_get_elt_at_index _bfd_generic_get_elt_at_index
#endif
#ifndef MY_generic_stat_arch_elt
#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt
#endif
#ifndef MY_slurp_armap
#define MY_slurp_armap bfd_slurp_bsd_armap
#endif
#ifndef MY_slurp_extended_name_table
#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table
#endif
#ifndef MY_construct_extended_name_table
#define MY_construct_extended_name_table \
_bfd_archive_bsd_construct_extended_name_table
#endif
#ifndef MY_write_armap
#define MY_write_armap _bfd_bsd_write_armap
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_read_ar_hdr
#define MY_read_ar_hdr _bfd_generic_read_ar_hdr
#endif
2010-01-26 Tristan Gingold <gingold@adacore.com> * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add initializer for write_ar_hdr. (bfd_target): Add _bfd_write_ar_hdr_fn field. * archive.c (is_bsd44_extended_name): New macro. (_bfd_generic_read_ar_hdr_mag): Use it. Add extra_size. (bfd_slurp_armap): Also check for "__.SYMDEF" as a BSD4.4 extended name. (_bfd_archive_bsd44_construct_extended_name_table): New function. (_bfd_generic_write_ar_hdr): Ditto. (_bfd_bsd44_write_ar_hdr): Ditto. (_bfd_write_archive_contents): Call _bfd_write_ar_hdr. (bsd_write_armap): Adjust firstreal computation. * libbfd-in.h (struct areltdata): Add extra_size field. (_bfd_generic_write_ar_hdr): Add prototype. (_bfd_bsd44_write_ar_hdr): Ditto. (_bfd_write_ar_hdr): Define. (_bfd_noarchive_write_ar_hdr): Ditto. (_bfd_archive_bsd_write_ar_hdr): Ditto. (_bfd_archive_coff_write_ar_hdr): Ditto. (_bfd_archive_bsd44_slurp_armap): Ditto. (_bfd_archive_bsd44_slurp_extended_name_table): Ditto. (_bfd_archive_bsd44_construct_extended_name_table): New prototype. (_bfd_archive_bsd44_truncate_arname): Ditto. (_bfd_archive_bsd44_write_armap): Ditto. (_bfd_archive_bsd44_read_ar_hdr): Ditto. (_bfd_archive_bsd44_write_ar_hdr): Ditto. (_bfd_archive_bsd44_openr_next_archived_file): Ditto. (_bfd_archive_bsd44_get_elt_at_index): Ditto. (_bfd_archive_bsd44_generic_stat_arch_elt): Ditto. (_bfd_archive_bsd44_update_armap_timestamp): Ditto. * libbfd.h: Regenerate. * oasys.c (oasys_write_ar_hdr): Define. * libecoff.h (_bfd_ecoff_write_ar_hdr): Define. * ieee.c (ieee_write_ar_hdr): Define. * elf64-mips.c (bfd_elf64_archive_write_ar_hdr): Define. * coff-rs6000.c (rs6000coff_vec): Adjust for write_ar_hdr field. (bfd_pmac_xcoff_backend_data): Ditto. * coff64-rs6000.c (rs6000coff64_vec): Ditto. (bfd_xcoff_aix5_backend_data): Ditto. * coff-alpha.c (alpha_ecoff_write_ar_hdr): Define. * aout-target.h (MY_write_ar_hdr): Define it if not defined. * aout-tic30.c (MY_write_ar_hdr): Ditto. * mach-o-target.c (TARGET_NAME): Use _bfd_archive_bsd44 archive. (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr) (bfd_mach_o_slurp_armap, bfd_mach_o_slurp_extended_name_table) (bfd_mach_o_construct_extended_name_table) (bfd_mach_o_truncate_arname, bfd_mach_o_write_armap) (bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt) (bfd_mach_o_update_armap_timestamp): Moved to mach-o.c * mach-o.c (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr) (bfd_mach_o_slurp_armap, bfd_mach_o_slurp_extended_name_table) (bfd_mach_o_construct_extended_name_table) (bfd_mach_o_truncate_arname, bfd_mach_o_write_armap) (bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt) (bfd_mach_o_update_armap_timestamp): Moved from mach-o-target.c * bfd-in2.h: Regenerate.
2010-01-26 14:42:26 +01:00
#ifndef MY_write_ar_hdr
#define MY_write_ar_hdr _bfd_generic_write_ar_hdr
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_truncate_arname
#define MY_truncate_arname bfd_bsd_truncate_arname
#endif
#ifndef MY_update_armap_timestamp
#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
#endif
/* No core file defined here -- configure in trad-core.c separately. */
#ifndef MY_core_file_failing_command
#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command
#endif
#ifndef MY_core_file_failing_signal
#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal
#endif
#ifndef MY_core_file_matches_executable_p
#define MY_core_file_matches_executable_p \
_bfd_nocore_core_file_matches_executable_p
#endif
2010-08-18 Pedro Alves <pedro@codesourcery.com> PR corefile/8210 bfd/ * bfd-in2.h: Regenerate. * corefile.c (bfd_core_file_pid): New. * targets.c (BFD_JUMP_TABLE_CORE): Add NAME##_core_file_pid. (struct bfd_target) <_core_file_pid>: New. * libbfd-in.h (_bfd_nocore_core_file_pid): Declare. * libbfd.c (_bfd_nocore_core_file_pid): New. * elf-bfd.h (bfd_elf32_core_file_pid, bfd_elf64_core_file_pid): Declare. * elfcode.h (elf_core_file_pid): New define. * elfcore.h (elf_core_file_pid): New function. * elf.c (elfcore_make_pid): Rewrite. (elfcore_grok_prstatus): Only set core_pid if not set yet. (elfcore_grok_prstatus) [!HAVE_PRSTATUS_T_PR_WHO]: Fallback to getting the lwpid from prstat.pr_pid. * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. (elf64_x86_64_grok_psinfo): Extract the the main process's PID, and store it in elf_tdata's core_pid field. * elf32-i386.c (elf_i386_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. (elf_i386_grok_psinfo): Extract the the main process's PID, and store it in elf_tdata's core_pid field. * elf32-am33lin.c (elf32_am33lin_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-arm.c (elf32_arm_nabi_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-cris.c (cris_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-frv.c (elf32_frv_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-hppa.c (elf32_hppa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-ppc.c (ppc_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-s390.c (elf_s390_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-score.c (s3_bfd_score_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-score7.c (s7_bfd_score_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-sh.c (elf32_shlin_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-xtensa.c (elf_xtensa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-hppa.c (elf64_hppa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-mips.c (elf64_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-ppc.c (ppc64_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elfn32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * plugin.c (bfd_plugin_core_file_pid): New function. * aout-target.h (MY_core_file_pid): Define. * aout-tic30.c (MY_core_file_pid, MY_core_file_p): New defines. * coff-rs6000.c (coff_core_file_pid): New define. (rs6000coff_vec, pmac_xcoff_vec): Use BFD_JUMP_TABLE_CORE. * coff64-rs6000.c (coff_core_file_pid): New define. (rs6000coff64_vec): Use BFD_JUMP_TABLE_CORE. (xcoff64_core_file_pid): New define. (aix5coff64_vec): Use BFD_JUMP_TABLE_CORE. * mach-o-target.c (bfd_mach_o_core_file_pid): New define. * aix386-core.c (aix386_core_file_pid): New define. * hppabsd-core.c (hppabsd_core_core_file_pid): New define. * hpux-core.c (hpux_core_core_file_pid): New define. * irix-core.c (irix_core_core_file_pid): New define. * lynx-core.c (lynx_core_file_pid): New define. * osf-core.c (osf_core_core_file_pid): New define. * ptrace-core.c (ptrace_unix_core_file_pid): New define. * sco5-core.c (sco5_core_file_pid): New define. * xcoff-target.h (coff_core_file_pid): New define. * netbsd-core.c (netbsd_core_core_file_pid): New define. gdb/ 2010-08-18 Pedro Alves <pedro@codesourcery.com> PR corefile/8210 gdb/ * corelow.c (add_to_thread_list): Don't use gdbarch_core_reg_section_encodes_pid. Use bfd_core_file_pid. (get_core_register_section): Don't use gdbarch_core_reg_section_encodes_pid. * gdbarch.sh (core_reg_section_encodes_pid): Delete. * gdbarch.h, gdbarch.c: Regenerate. * amd64-sol2-tdep.c (amd64_sol2_init_abi): Don't set gdbarch_core_reg_section_encodes_pid. * i386-sol2-tdep.c (i386_sol2_init_abi): Ditto. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Ditto. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Ditto.
2010-08-18 14:24:13 +02:00
#ifndef MY_core_file_pid
#define MY_core_file_pid _bfd_nocore_core_file_pid
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_core_file_p
#define MY_core_file_p _bfd_dummy_target
#endif
#ifndef MY_bfd_debug_info_start
Remove bfd stub function casts. This patch defines a bunch of new functions to use in the BFD target structs rather than casting bfd_false or bfd_true and similar stub functions. I've also renamed the stub functions to reflect their parameters and put "error" in the name if they set bfd_error. The latter change is important since there were quite a few uses of bfd_false where setting bfd_error was inappropriate, for example in elf_backend_allow_non_load_phdr and is_target_special_symbol. * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false. (_bfd_bool_bfd_true): Rename from bfd_true. (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr. (_bfd_int_bfd_0): Rename from bfd_0. (_bfd_uint_bfd_0): Rename from bfd_0u. (_bfd_long_bfd_0): Rename from bfd_0l. (_bfd_long_bfd_n1_error): Rename from _bfd_n1. (_bfd_void_bfd): Rename from bfd_void. (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false), (_bfd_bool_bfd_link_false_error), (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true), (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true), (_bfd_bool_bfd_asection_bfd_asection_true), (_bfd_bool_bfd_asymbol_bfd_asymbol_true), (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions. * archive.c (_bfd_noarchive_get_elt_at_index), (_bfd_noarchive_openr_next_archived_file), (_bfd_noarchive_construct_extended_name_table), (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname), (_bfd_noarchive_write_armap): New functions. * archures.c (_bfd_nowrite_set_arch_mach): New function. * coff-alpha.c (alpha_ecoff_swap_coff_aux_in), (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in), (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out), (alpha_ecoff_swap_coff_lineno_out), (alpha_ecoff_swap_coff_reloc_out): New functions. * coff-mips.c (mips_ecoff_swap_coff_aux_in), (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in), (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out), (mips_ecoff_swap_coff_lineno_out), (mips_ecoff_swap_coff_reloc_out): New functions. * coffcode.h (coff_set_alignment_hook): Replace define with new function. (symname_in_debug_hook): Likewise. * ecoff.c (_bfd_ecoff_set_alignment_hook): New function. * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0. * elf.c (assign_file_positions_except_relocs): Test elf_backend_allow_non_load_phdr for NULL. * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from _bfd_elf_link_omit_section_dynsym. Update uses. (_bfd_elf_omit_section_dynsym_all): New function. * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete. (_bfd_elf_omit_section_dynsym_default): Declare. (_bfd_elf_omit_section_dynsym_all): Declare. * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section), (_bfd_nolink_bfd_get_relocated_section_contents), (_bfd_nolink_bfd_lookup_section_flags), (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group), (_bfd_nolink_bfd_link_hash_table_create), (_bfd_nolink_bfd_link_just_syms), (_bfd_nolink_bfd_copy_link_hash_symbol_type), (_bfd_nolink_bfd_link_split_section), (_bfd_nolink_section_already_linked), (_bfd_nolink_bfd_define_common_symbol), (_bfd_nolink_bfd_define_start_stop): New functions. * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup), (_bfd_norelocs_bfd_reloc_name_lookup), (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions. * section.c (_bfd_nowrite_set_section_contents): New function. * syms.c (_bfd_nosymbols_canonicalize_symtab), (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info), (_bfd_nosymbols_get_symbol_version_string), (_bfd_nosymbols_bfd_is_local_label_name), (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line), (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info), (_bfd_nosymbols_bfd_make_debug_symbol), ( _bfd_nosymbols_read_minisymbols), ( _bfd_nosymbols_minisymbol_to_symbol), (_bfd_nodynamic_get_synthetic_symtab): New functions. * libbfd-in.h: Declare new functions. Update existing defines, removing casts. * aix386-core.c: Update to use new hooks. Formatting. * aout-adobe.c: Likewise. * aout-arm.c: Likewise. * aout-target.h: Likewise. * aout-tic30.c: Likewise. * aoutf1.h: Likewise. * binary.c: Likewise. * bout.c: Likewise. * cisco-core.c: Likewise. * coff-alpha.c: Likewise. * coff-i386.c: Likewise. * coff-i860.c: Likewise. * coff-i960.c: Likewise. * coff-ia64.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic30.c: Likewise. * coff-tic54x.c: Likewise. * coff-x86_64.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * elf-m10300.c: Likewise. * elf32-cr16.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32r.c: Likewise. * elf32-metag.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-target.h: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.h: Likewise. * hp300hpux.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386msdos.c: Likewise. * i386os9k.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * irix-core.c: Likewise. * libaout.h: Likewise. * libecoff.h: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mipsbsd.c: Likewise. * mmo.c: Likewise. * netbsd-core.c: Likewise. * nlm-target.h: Likewise. * oasys.c: Likewise. * osf-core.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * pe-x86_64.c: Likewise. * pef.c: Likewise. * plugin.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * sco5-core.c: Likewise. * som.c: Likewise. * sparclynx.c: Likewise. * srec.c: Likewise. * tekhex.c: Likewise. * trad-core.c: Likewise. * verilog.c: Likewise. * versados.c: Likewise. * vms-alpha.c: Likewise. * vms-lib.c: Likewise. * wasm-module.c: Likewise. * xsym.c: Likewise. * libbfd.h: Regenerate.
2018-02-15 01:28:06 +01:00
#define MY_bfd_debug_info_start _bfd_void_bfd
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_bfd_debug_info_end
Remove bfd stub function casts. This patch defines a bunch of new functions to use in the BFD target structs rather than casting bfd_false or bfd_true and similar stub functions. I've also renamed the stub functions to reflect their parameters and put "error" in the name if they set bfd_error. The latter change is important since there were quite a few uses of bfd_false where setting bfd_error was inappropriate, for example in elf_backend_allow_non_load_phdr and is_target_special_symbol. * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false. (_bfd_bool_bfd_true): Rename from bfd_true. (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr. (_bfd_int_bfd_0): Rename from bfd_0. (_bfd_uint_bfd_0): Rename from bfd_0u. (_bfd_long_bfd_0): Rename from bfd_0l. (_bfd_long_bfd_n1_error): Rename from _bfd_n1. (_bfd_void_bfd): Rename from bfd_void. (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false), (_bfd_bool_bfd_link_false_error), (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true), (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true), (_bfd_bool_bfd_asection_bfd_asection_true), (_bfd_bool_bfd_asymbol_bfd_asymbol_true), (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions. * archive.c (_bfd_noarchive_get_elt_at_index), (_bfd_noarchive_openr_next_archived_file), (_bfd_noarchive_construct_extended_name_table), (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname), (_bfd_noarchive_write_armap): New functions. * archures.c (_bfd_nowrite_set_arch_mach): New function. * coff-alpha.c (alpha_ecoff_swap_coff_aux_in), (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in), (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out), (alpha_ecoff_swap_coff_lineno_out), (alpha_ecoff_swap_coff_reloc_out): New functions. * coff-mips.c (mips_ecoff_swap_coff_aux_in), (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in), (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out), (mips_ecoff_swap_coff_lineno_out), (mips_ecoff_swap_coff_reloc_out): New functions. * coffcode.h (coff_set_alignment_hook): Replace define with new function. (symname_in_debug_hook): Likewise. * ecoff.c (_bfd_ecoff_set_alignment_hook): New function. * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0. * elf.c (assign_file_positions_except_relocs): Test elf_backend_allow_non_load_phdr for NULL. * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from _bfd_elf_link_omit_section_dynsym. Update uses. (_bfd_elf_omit_section_dynsym_all): New function. * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete. (_bfd_elf_omit_section_dynsym_default): Declare. (_bfd_elf_omit_section_dynsym_all): Declare. * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section), (_bfd_nolink_bfd_get_relocated_section_contents), (_bfd_nolink_bfd_lookup_section_flags), (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group), (_bfd_nolink_bfd_link_hash_table_create), (_bfd_nolink_bfd_link_just_syms), (_bfd_nolink_bfd_copy_link_hash_symbol_type), (_bfd_nolink_bfd_link_split_section), (_bfd_nolink_section_already_linked), (_bfd_nolink_bfd_define_common_symbol), (_bfd_nolink_bfd_define_start_stop): New functions. * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup), (_bfd_norelocs_bfd_reloc_name_lookup), (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions. * section.c (_bfd_nowrite_set_section_contents): New function. * syms.c (_bfd_nosymbols_canonicalize_symtab), (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info), (_bfd_nosymbols_get_symbol_version_string), (_bfd_nosymbols_bfd_is_local_label_name), (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line), (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info), (_bfd_nosymbols_bfd_make_debug_symbol), ( _bfd_nosymbols_read_minisymbols), ( _bfd_nosymbols_minisymbol_to_symbol), (_bfd_nodynamic_get_synthetic_symtab): New functions. * libbfd-in.h: Declare new functions. Update existing defines, removing casts. * aix386-core.c: Update to use new hooks. Formatting. * aout-adobe.c: Likewise. * aout-arm.c: Likewise. * aout-target.h: Likewise. * aout-tic30.c: Likewise. * aoutf1.h: Likewise. * binary.c: Likewise. * bout.c: Likewise. * cisco-core.c: Likewise. * coff-alpha.c: Likewise. * coff-i386.c: Likewise. * coff-i860.c: Likewise. * coff-i960.c: Likewise. * coff-ia64.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic30.c: Likewise. * coff-tic54x.c: Likewise. * coff-x86_64.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * elf-m10300.c: Likewise. * elf32-cr16.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32r.c: Likewise. * elf32-metag.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-target.h: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.h: Likewise. * hp300hpux.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386msdos.c: Likewise. * i386os9k.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * irix-core.c: Likewise. * libaout.h: Likewise. * libecoff.h: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mipsbsd.c: Likewise. * mmo.c: Likewise. * netbsd-core.c: Likewise. * nlm-target.h: Likewise. * oasys.c: Likewise. * osf-core.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * pe-x86_64.c: Likewise. * pef.c: Likewise. * plugin.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * sco5-core.c: Likewise. * som.c: Likewise. * sparclynx.c: Likewise. * srec.c: Likewise. * tekhex.c: Likewise. * trad-core.c: Likewise. * verilog.c: Likewise. * versados.c: Likewise. * vms-alpha.c: Likewise. * vms-lib.c: Likewise. * wasm-module.c: Likewise. * xsym.c: Likewise. * libbfd.h: Regenerate.
2018-02-15 01:28:06 +01:00
#define MY_bfd_debug_info_end _bfd_void_bfd
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_bfd_debug_info_accumulate
Remove bfd stub function casts. This patch defines a bunch of new functions to use in the BFD target structs rather than casting bfd_false or bfd_true and similar stub functions. I've also renamed the stub functions to reflect their parameters and put "error" in the name if they set bfd_error. The latter change is important since there were quite a few uses of bfd_false where setting bfd_error was inappropriate, for example in elf_backend_allow_non_load_phdr and is_target_special_symbol. * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false. (_bfd_bool_bfd_true): Rename from bfd_true. (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr. (_bfd_int_bfd_0): Rename from bfd_0. (_bfd_uint_bfd_0): Rename from bfd_0u. (_bfd_long_bfd_0): Rename from bfd_0l. (_bfd_long_bfd_n1_error): Rename from _bfd_n1. (_bfd_void_bfd): Rename from bfd_void. (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false), (_bfd_bool_bfd_link_false_error), (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true), (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true), (_bfd_bool_bfd_asection_bfd_asection_true), (_bfd_bool_bfd_asymbol_bfd_asymbol_true), (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions. * archive.c (_bfd_noarchive_get_elt_at_index), (_bfd_noarchive_openr_next_archived_file), (_bfd_noarchive_construct_extended_name_table), (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname), (_bfd_noarchive_write_armap): New functions. * archures.c (_bfd_nowrite_set_arch_mach): New function. * coff-alpha.c (alpha_ecoff_swap_coff_aux_in), (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in), (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out), (alpha_ecoff_swap_coff_lineno_out), (alpha_ecoff_swap_coff_reloc_out): New functions. * coff-mips.c (mips_ecoff_swap_coff_aux_in), (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in), (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out), (mips_ecoff_swap_coff_lineno_out), (mips_ecoff_swap_coff_reloc_out): New functions. * coffcode.h (coff_set_alignment_hook): Replace define with new function. (symname_in_debug_hook): Likewise. * ecoff.c (_bfd_ecoff_set_alignment_hook): New function. * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0. * elf.c (assign_file_positions_except_relocs): Test elf_backend_allow_non_load_phdr for NULL. * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from _bfd_elf_link_omit_section_dynsym. Update uses. (_bfd_elf_omit_section_dynsym_all): New function. * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete. (_bfd_elf_omit_section_dynsym_default): Declare. (_bfd_elf_omit_section_dynsym_all): Declare. * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section), (_bfd_nolink_bfd_get_relocated_section_contents), (_bfd_nolink_bfd_lookup_section_flags), (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group), (_bfd_nolink_bfd_link_hash_table_create), (_bfd_nolink_bfd_link_just_syms), (_bfd_nolink_bfd_copy_link_hash_symbol_type), (_bfd_nolink_bfd_link_split_section), (_bfd_nolink_section_already_linked), (_bfd_nolink_bfd_define_common_symbol), (_bfd_nolink_bfd_define_start_stop): New functions. * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup), (_bfd_norelocs_bfd_reloc_name_lookup), (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions. * section.c (_bfd_nowrite_set_section_contents): New function. * syms.c (_bfd_nosymbols_canonicalize_symtab), (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info), (_bfd_nosymbols_get_symbol_version_string), (_bfd_nosymbols_bfd_is_local_label_name), (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line), (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info), (_bfd_nosymbols_bfd_make_debug_symbol), ( _bfd_nosymbols_read_minisymbols), ( _bfd_nosymbols_minisymbol_to_symbol), (_bfd_nodynamic_get_synthetic_symtab): New functions. * libbfd-in.h: Declare new functions. Update existing defines, removing casts. * aix386-core.c: Update to use new hooks. Formatting. * aout-adobe.c: Likewise. * aout-arm.c: Likewise. * aout-target.h: Likewise. * aout-tic30.c: Likewise. * aoutf1.h: Likewise. * binary.c: Likewise. * bout.c: Likewise. * cisco-core.c: Likewise. * coff-alpha.c: Likewise. * coff-i386.c: Likewise. * coff-i860.c: Likewise. * coff-i960.c: Likewise. * coff-ia64.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic30.c: Likewise. * coff-tic54x.c: Likewise. * coff-x86_64.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * elf-m10300.c: Likewise. * elf32-cr16.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32r.c: Likewise. * elf32-metag.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-target.h: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.h: Likewise. * hp300hpux.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386msdos.c: Likewise. * i386os9k.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * irix-core.c: Likewise. * libaout.h: Likewise. * libecoff.h: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mipsbsd.c: Likewise. * mmo.c: Likewise. * netbsd-core.c: Likewise. * nlm-target.h: Likewise. * oasys.c: Likewise. * osf-core.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * pe-x86_64.c: Likewise. * pef.c: Likewise. * plugin.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * sco5-core.c: Likewise. * som.c: Likewise. * sparclynx.c: Likewise. * srec.c: Likewise. * tekhex.c: Likewise. * trad-core.c: Likewise. * verilog.c: Likewise. * versados.c: Likewise. * vms-alpha.c: Likewise. * vms-lib.c: Likewise. * wasm-module.c: Likewise. * xsym.c: Likewise. * libbfd.h: Regenerate.
2018-02-15 01:28:06 +01:00
#define MY_bfd_debug_info_accumulate _bfd_void_bfd_asection
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_core_file_failing_command
2005-04-11 10:23:05 +02:00
#define MY_core_file_failing_command NAME (aout, core_file_failing_command)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_core_file_failing_signal
2005-04-11 10:23:05 +02:00
#define MY_core_file_failing_signal NAME (aout, core_file_failing_signal)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_core_file_matches_executable_p
2005-04-11 10:23:05 +02:00
#define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_set_section_contents
2005-04-11 10:23:05 +02:00
#define MY_set_section_contents NAME (aout, set_section_contents)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_get_section_contents
2005-04-11 10:23:05 +02:00
#define MY_get_section_contents NAME (aout, get_section_contents)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_get_section_contents_in_window
#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#endif
#ifndef MY_new_section_hook
2005-04-11 10:23:05 +02:00
#define MY_new_section_hook NAME (aout, new_section_hook)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_get_symtab_upper_bound
2005-04-11 10:23:05 +02:00
#define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound)
1999-05-03 09:29:11 +02:00
#endif
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 06:11:10 +02:00
#ifndef MY_canonicalize_symtab
2005-04-11 10:23:05 +02:00
#define MY_canonicalize_symtab NAME (aout, canonicalize_symtab)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_get_reloc_upper_bound
2005-04-11 10:23:05 +02:00
#define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_canonicalize_reloc
2005-04-11 10:23:05 +02:00
#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
1999-05-03 09:29:11 +02:00
#endif
bfd: new BFD target entry point _bfd_set_reloc. This patch adds a new entry point to the BFD_JUMP_TABLE_RELOCS. The previous common implementation `bfd_set_reloc', in bfd/bfd.c, has been moved to bfd/reloc.c with the name `_bfd_generic_set_reloc', and all BFD targets has been adapted to use it. This patch doesn't introduce any change on functionality, but prepares the ground for further work. bfd/ChangeLog: 2017-05-10 Jose E. Marchesi <jose.marchesi@oracle.com> * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc. (struct bfd_target): New field _bfd_set_reloc. * bfd.c (bfd_set_reloc): Call backend _set_bfd. * reloc.c (_bfd_generic_set_reloc): New function. * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc. * nlm-target.h (nlm_set_reloc): Likewise. * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise. * aout-tic30.c (MY_set_reloc): Likewise. * aout-target.h (MY_set_reloc): Likewise. * elfxx-target.h (bfd_elfNN_set_reloc): Likewise. * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise. * mach-o-target.c (bfd_mach_o_set_reloc): Likewise. * vms-alpha.c (alpha_vms_set_reloc): Likewise. * aout-adobe.c (aout_32_set_reloc): Likewise. * bout.c (b_out_set_reloc): Likewise. * coff-mips.c (_bfd_ecoff_set_reloc): Likewise. * i386os9k.c (aout_32_set_reloc): Likewise. * ieee.c (ieee_set_reloc): Likewise. * oasys.c (oasys_set_reloc): Likewise. * som.c (som_set_reloc): Likewise. * versados.c (versados_set_reloc): Likewise. * coff64-rs6000.c (rs6000_xcoff64_vec): Add _bfd_generic_set_reloc. (rs6000_xcoff64_aix_vec): LIkewise. * libbfd.c (_bfd_norelocs_set_reloc): New function. * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc. * i386msdos.c (msdos_set_reloc): Define to _bfd_norelocs_set_reloc. * elfcode.h (elf_set_reloc): Define. * bfd-in2.h: Regenerated.
2017-05-10 18:40:04 +02:00
#ifndef MY_set_reloc
#define MY_set_reloc _bfd_generic_set_reloc
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_make_empty_symbol
2005-04-11 10:23:05 +02:00
#define MY_make_empty_symbol NAME (aout, make_empty_symbol)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_print_symbol
2005-04-11 10:23:05 +02:00
#define MY_print_symbol NAME (aout, print_symbol)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_get_symbol_info
2005-04-11 10:23:05 +02:00
#define MY_get_symbol_info NAME (aout, get_symbol_info)
1999-05-03 09:29:11 +02:00
#endif
Use get_symbol_version_string in BFD_JUMP_TABLE_SYMBOLS This patch adds get_symbol_version_string to BFD_JUMP_TABLE_SYMBOLS so that we can use bfd_get_symbol_version_string in objdump for non-ELF targets. bfd/ * targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_get_symbol_version_string. (bfd_get_symbol_version_string): New. * aout-adobe.c (aout_32_get_symbol_version_string): Define using _bfd_nosymbols define. * aout-target.h (MY_get_symbol_version_string): Likewise. * aout-tic30.c (MY_get_symbol_version_string): Likewise. * binary.c (binary_get_symbol_version_string): Likewise. * bout.c (aout_32_get_symbol_version_string): Likewise. * coff-rs6000.c (_bfd_xcoff_get_symbol_version_string): Likewise. * i386msdos.c (msdos_get_symbol_version_string): Likewise. * i386os9k.c (aout_32_get_symbol_version_string): Likewise. * ieee.c (ieee_get_symbol_version_string): Likewise. * ihex.c (ihex_get_symbol_version_string): Likewise. * libecoff.h (_bfd_ecoff_get_symbol_version_string): Likewise. * mach-o-target.c (bfd_mach_o_get_symbol_version_string): Likewise. * mmo.c (mmo_get_symbol_version_string): Likewise. * nlm-target.h (nlm_get_symbol_version_string): Likewise. * oasys.c (oasys_get_symbol_version_string): Likewise. * pef.c (bfd_pef_get_symbol_version_string): Likewise. * plugin.c (bfd_plugin_get_symbol_version_string): Likewise. * ppcboot.c (ppcboot_get_symbol_version_string): Likewise. * som.c (som_get_symbol_version_string): Likewise. * srec.c (srec_get_symbol_version_string): Likewise. * tekhex.c (tekhex_get_symbol_version_string): Likewise. * versados.c (versados_get_symbol_version_string): Likewise. * vms-alpha.c (alpha_vms_get_symbol_version_string): Likewise. * xsym.c (bfd_sym_get_symbol_version_string): Likewise. * coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_get_symbol_version_string. (rs6000_xcoff64_aix_vec): Likewise. * elf-bfd.h (bfd_elf_get_symbol_version_string): Renamed to ... (_bfd_elf_get_symbol_version_string): This. * elf.c: Likewise. (bfd_elf_print_symbol): Updated. * elfxx-target.h (bfd_elfNN_get_symbol_version_string): Define. * libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Define. * libcoff-in.h (coff_get_symbol_version_string): Likewise. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. * libcoff.h: Likewise. binutils/ * objdump.c (objdump_print_symname): Replace bfd_elf_get_symbol_version_string with bfd_get_symbol_version_string.
2014-11-25 18:28:32 +01:00
#ifndef MY_get_symbol_version_string
#define MY_get_symbol_version_string \
_bfd_nosymbols_get_symbol_version_string
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_get_lineno
2005-04-11 10:23:05 +02:00
#define MY_get_lineno NAME (aout, get_lineno)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_set_arch_mach
2005-04-11 10:23:05 +02:00
#define MY_set_arch_mach NAME (aout, set_arch_mach)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_find_nearest_line
2005-04-11 10:23:05 +02:00
#define MY_find_nearest_line NAME (aout, find_nearest_line)
1999-05-03 09:29:11 +02:00
#endif
Define bfd_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME. In https://www.sourceware.org/ml/binutils/2005-06/msg00082.html HJ implemented bfd_find_line for DWARF2, but cheated a little in not using the usual NAME##_find_line, saving quite a lot of boring editing. However that shortcut probably contributed to bfd_find_nearest_line_discriminator being implemented the same way, and missing support for some targets. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_find_line. * aout-adobe.c (aout_32_find_line): Define. (aout_32_bfd_make_debug_symbol, aout_32_bfd_reloc_type_lookup, aout_32_bfd_reloc_name_lookup): Define using _bfd_nosymbols define. * aout-target.h (MY_find_line): Define. * aout-tic30.c (MY_find_line): Define. * binary.c (binary_find_line): Define. * bout.c (aout_32_find_line): Define. * coff-rs6000.c (_bfd_xcoff_find_line): Define. * coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_find_line. (rs6000_xcoff64_aix_vec): Likewise. * elf-bfd.h (_bfd_generic_find_line): Don't define. * elfxx-target.h (bfd_elfNN_find_line): Define. * i386msdos.c (msdos_find_line): Define. * i386os9k.c (aout_32_find_line): Define. * ieee.c (ieee_find_nearest_line, ieee_find_inliner_info): Delete func. (ieee_find_nearest_line, ieee_find_line, ieee_find_inliner_info): Define. * ihex.c (ihex_find_line): Define. * libbfd-in.h (_bfd_nosymbols_find_line): Define. (_bfd_generic_find_line): Don't define. * libbfd.c (_bfd_generic_find_line): Delete. * libcoff-in.h (coff_find_line): Define. * libecoff.h (_bfd_ecoff_find_line): Define. * mach-o.h (bfd_mach_o_find_line): Define. * mmo.c (mmo_find_line): Define. * nlm-target.h (nlm_find_line): Define. * oasys.c (oasys_find_nearest_line, oasys_find_inliner_info): Delete. (oasys_find_nearest_line, oasys_find_line, oasys_find_inliner_info): Define. * pef.c (bfd_pef_find_line): Define. * plugin.c (bfd_plugin_find_line): Define. * ppcboot.c (ppcboot_find_line): Define. * som.c (som_find_line): Define. * srec.c (srec_find_line): Define. * tekhex.c (tekhex_find_line): Define. * versados.c (versados_find_line): Define. * vms-alpha.c (alpha_vms_find_line): Define. * xsym.c (bfd_sym_find_line): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-10-15 07:10:45 +02:00
#ifndef MY_find_line
#define MY_find_line _bfd_nosymbols_find_line
#endif
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 19:44:55 +02:00
#ifndef MY_find_inliner_info
#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_sizeof_headers
2005-04-11 10:23:05 +02:00
#define MY_sizeof_headers NAME (aout, sizeof_headers)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_bfd_get_relocated_section_contents
#define MY_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
#endif
#ifndef MY_bfd_relax_section
#define MY_bfd_relax_section bfd_generic_relax_section
#endif
#ifndef MY_bfd_gc_sections
#define MY_bfd_gc_sections bfd_generic_gc_sections
#endif
include/ChangeLog 2011-07-11 Catherine Moore <clm@codesourcery.com> * bfdlink.h (flag_type): New enumeration. (flag_info_list): New structure. (flag_info): New structure. bfd/ChangeLog 2011-07-11 Catherine Moore <clm@codesourcery.com> * aout-adobe.c (aout_32_bfd_lookup_section_flags): New definition. * aout-target.h (MY_bfd_lookup_section_flags): New definition. * aout-tic30.c (MY_bfd_lookup_section_flags): New definition. * bfd-in2.h: Regenerated. * bfd.c (bfd_lookup_section_flags): New definition. * binary.c (binary_bfd_lookup_section_flags): New definition. * bout.c (b_out_bfd_lookup_section_flags): New definition. * coff-alpha.c (_bfd_ecoff_bfd_lookup_section_flags): New definition. * coff-mips.c (_bfd_ecoff_bfd_lookup_section_flags): New definition. * coff-rs6000.c (rs6000coff_vec): Include bfd_generic_lookup_section_flags. (pmac_xcoff_vec): Likewise. * coffcode.h (coff_bfd_lookup_section_flags): New definition. * coff64-rs6000.c (rs6000coff64_vec): Include bfd_generic_lookup_section_flags. (aix5coff64_vec): Likewise. * ecoff.c (bfd_debug_section): Initialize flag_info field. * elf-bfd.h (elf_backend_lookup_section_flags_hook): Declare. (bfd_elf_lookup_section_flags): Declare. * elflink.c (bfd_elf_lookup_section_flags): New function. * elfxx-target.h (bfd_elfNN_bfd_lookup_section_flags): Define. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_data): Add elf_backend_lookup_section_flags_hook. * i386msdos.c (msdos_bfd_lookup_section_flags): New define. * i386os9k.c (os9k_bfd_lookup_section_flags): New define. * ieee.c (ieee_bfd_lookup_section_flags): New define. * ihex.c (ihex_bfd_lookup_section_flags): New define. * libbfd-in.h (_bfd_nolink_bfd_lookup_section_flags): Declare. (bfd_generic_lookup_section_flags): Declare. * libbfd.h: Regenerated. * mach-o-target.c (bfd_mach_o_bfd_lookup_section_flags): New. * mmo.c (mmo_bfd_lookup_section_flags): New definition. * nlm-target.h (nlm_bfd_lookup_section_flags): New definition. * oasys.c (oasys_bfd_lookup_section_flags): New definition. * pef.c (bfd_pef_bfd_lookup_section_flags): New definition. * plugin.c (bfd_plugin_bfd_lookup_section_flags): New definition. * ppcboot.c (ppcboot_bfd_lookup_section_flags): New definition. * reloc.c (bfd_generic_lookup_section_flags): New function. * som.c (som_bfd_lookup_section_flags): New definition. * srec.c (srec_bfd_lookup_section_flags): New definition. * targets.c (flag_info): Declare. (NAME##_bfd_lookup_section_flags): Add to LINK jump table. (_bfd_lookup_section_flags): New. * tekhex.c (tekhex_bfd_lookup_section_flags): New definition. * versados.c (versados_bfd_lookup_section_flags): New definition. * vms-alpha.c (alpha_vms_bfd_lookup_section_flag): New definition. * xsym.c (bfd_sym_bfd_lookup_section_flags): New definition. ld/ChangeLog 2011-07-11 Catherine Moore <clm@codesourcery.com> * ld.h (section_flag_list): Add field to struct wildcard_spec. * ld.texinfo (INPUT_SECTION_FLAGS): Document. * ldgram.y (flag_info_list, flag_info): Add to union. (INPUT_SECTION_FLAGS): New token. (wildcard_spec): Initialize section_flag_list to NULL for each alternative. (sect_flag_list, sect_flags): New rules. (input_section_spec_no_keep): Add alternatives to recognize sect_flags. * ldlang.c (walk_wild_consider_section): Initialize section_flag_info field of the section struct. (lang_add_section): Check input section flags. (lang_add_wild): Initialize section_flag_list field of the statement struct. * ldlang.h (lang_input_statement_struct): Add section_flag_list field. (lang_wild_statement_struct): Likewise. * ldlex.l (INPUT_SECTION_FLAGS): New token. * mri.c (mri_draw_tree): Initialize section_flag_list to NULL. * NEWS: Announce INPUT_SECTION_FLAGS enhancement. ld/testsuite/ChangeLog 2011-07-11 Catherine Moore <clm@cm00re.com> * ld-scripts/section-flags-1.s: New. * ld-scripts/section-flags-1.t: New. * ld-scripts/section-flags-2.s: New. * ld-scripts/section-flags-2.t: New. * ld-scripts/section-flags.exp: New.
2011-07-11 17:03:09 +02:00
#ifndef MY_bfd_lookup_section_flags
#define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags
#endif
* merge.c (struct sec_merge_hash_entry): Add u.entsize and u.suffix fields, change sec into secinfo. (struct sec_merge_info): Add chain, remove last fields. (struct sec_merge_sec_info): Add next, sec, psecinfo fields. (sec_merge_hash_lookup): If lookup could not use a string only because it has bad alignment, mark the old string for deletion. (sec_merge_add): Add secinfo argument. Don't compute entry's position, instead record the section. (sec_merge_emit): Update for the sec into secinfo change in struct sec_merge_hash_entry. (_bfd_merge_section): Only record the section for merging, defer putting strings into the hash table. (cmplengthentry, last4_eq, last_eq, record_section, merge_strings, _bfd_merge_sections): New functions. (_bfd_merged_section_offset): Update for the sec_merge_hash_entry changes. * libbfd-in.h (_bfd_merge_sections): Add prototype. (_bfd_nolink_bfd_merge_sections): Define. * libbfd.h: Likewise. (bfd_generic_merge_sections): Add prototype. * targets.c (BFD_JUMP_TABLE_LINK): Add _bfd_merge_sections. (struct bfd_target): Likewise. * bfd.c (bfd_merge_sections): Define. * bfd-in2.h: Rebuilt. * elf.c (_bfd_elf_merge_sections): New function. * elf-bfd.h (_bfd_elf_merge_sections): Add prototype. * elfxx-target.h (bfd_elfNN_bfd_merge_sections): Define. * reloc.c (bfd_generic_merge_sections): New function. * vms.c (vms_bfd_merge_sections): New function. * aout-adobe.c (aout_32_bfd_merge_sections): Define. * aout-target.h (MY_bfd_merge_sections): Define. * aout-tic30.c (MY_bfd_merge_sections): Define. * binary.c (binary_bfd_merge_sections): Define. * bout.c (b_out_bfd_merge_sections): Define. * coff-alpha.c (_bfd_ecoff_bfd_merge_sections): Define. * coffcode.c (coff_bfd_merge_sections): Define. * coff-mips.c (_bfd_ecoff_bfd_merge_sections): Define. * i386msdos.c (msdos_bfd_merge_sections): Define. * i386os9k.c (os9k_bfd_merge_sections): Define. * ieee.c (ieee_bfd_merge_sections): Define. * ihex.c (ihex_bfd_merge_sections): Define. * nlm-target.h (nlm_bfd_merge_sections): Define. * oasys.c (oasys_bfd_merge_sections): Define. * ppcboot.c (ppcboot_bfd_merge_sections): Define. * som.c (som_bfd_merge_sections): Define. * srec.c (srec_bfd_merge_sections): Define. * tekhex.c (tekhex_bfd_merge_sections): Define. * versados.c (versados_bfd_merge_sections): Define. * xcoff-target.h (_bfd_xcoff_bfd_merge_sections): Define. * ldlang.c (lang_process): Call bfd_merge_sections.
2001-05-11 14:23:48 +02:00
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
* section.c (bfd_make_section_anyway): Add all sections to hash tab. * elf-bfd.h (bfd_elf_is_group_section): Declare. * elf.c (bfd_elf_is_group_section): New function. * elfxx-target.h (bfd_elfNN_bfd_is_group_section * section.c (bfd_generic_is_group_section): New function. * targets.c (struct bfd_target): Add _bfd_is_group_section field. (BFD_JUMP_TABLE_LINK): Adjust. * aout-adobe.c (aout_32_bfd_is_group_section): Define. * aout-target.h (MY_bfd_is_group_section): Define. * aout-tic30.c (MY_bfd_is_group_section): Define. * bfd.c (bfd_is_group_section): Define. * binary.c (binary_bfd_is_group_section): Define. * bout.c (b_out_bfd_is_group_section): Define. * coff-alpha.c (_bfd_ecoff_bfd_is_group_section): Define. * coff-mips.c (_bfd_ecoff_bfd_is_group_section): Define. * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Adjust. * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Adjust. * coffcode.h (coff_bfd_is_group_section): Define. * i386msdos.c (msdos_bfd_is_group_section): Define. * i386os9k.c (os9k_bfd_is_group_section): Define. * ieee.c (ieee_bfd_is_group_section): Define. * ihex.c (ihex_bfd_is_group_section): Define. * libbfd-in.h (_bfd_nolink_bfd_is_group_section): Define. * mach-o.c (bfd_mach_o_bfd_is_group_section): Define. * mmo.c (mmo_bfd_is_group_section): Define. * nlm-target.h (nlm_bfd_is_group_section): Define. * oasys.c (oasys_bfd_is_group_section): Define. * pef.c (bfd_pef_bfd_is_group_section): Define. * ppcboot.c (ppcboot_bfd_is_group_section): Define. * srec.c (srec_bfd_is_group_section): Define. * tekhex.c (tekhex_bfd_is_group_section): Define. * versados.c (versados_bfd_is_group_section): Define. * vms.c (vms_bfd_is_group_section): Define. * xsym.c (bfd_sym_bfd_is_group_section): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2004-04-30 16:23:40 +02:00
#ifndef MY_bfd_is_group_section
#define MY_bfd_is_group_section bfd_generic_is_group_section
#endif
Tidy ld/ldmisc.c The idea here is to not use elf-bfd.h and coff-bfd.h in generic linker code. bfd/ * targets.c (struct bfd_target): Add _bfd_group_name. (BFD_JUMP_TABLE): Likewise. * coffgen.c (bfd_coff_group_name): New function. * elf.c (bfd_elf_group_name): New function. * linker.c (_bfd_nolink_bfd_group_name): New function. * section.c (bfd_generic_group_name): New function. * elf-bfd.h (bfd_elf_group_name): Declare. * libbfd-in.h (_bfd_nolink_bfd_group_name): Declare. * libcoff-in.h (bfd_coff_group_name): Declare. * aout-target.h (MY_bfd_group_name): Define. * aout-tic30.c (MY_bfd_group_name): Define. * bfd.c (bfd_group_name): Define. * binary.c (binary_bfd_group_name): Define. * coff-alpha.c (_bfd_ecoff_bfd_group_name): Define. * coff-mips.c (_bfd_ecoff_bfd_group_name): Define. * coff-rs6000.c (_bfd_xcoff_bfd_group_name): Define. * coffcode.h (coff_bfd_group_name): Define. * elfxx-target.h (bfd_elfNN_bfd_group_name): Define. * i386msdos.c (msdos_bfd_group_name): Define. * ihex.c (ihex_bfd_group_name): Define. * mach-o-target.c (bfd_mach_o_bfd_group_name): Define. * mmo.c (mmo_bfd_group_name): Define. * pef.c (bfd_pef_bfd_group_name): Define. * plugin.c (bfd_plugin_bfd_group_name): Define. * ppcboot.c (ppcboot_bfd_group_name): Define. * som.c (som_bfd_group_name): Define. * srec.c (srec_bfd_group_name): Define. * tekhex.c (tekhex_bfd_group_name): Define. * verilog.c (verilog_bfd_group_name): Define. * vms-alpha.c (vms_bfd_group_name, alpha_vms_bfd_group_name): Define. * xsym.c (bfd_sym_bfd_group_name): Define. * coff64-rs6000.c (rs6000_xcoff64_vec): Init new field. (rs6000_xcoff64_aix_vec): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * ldmisc.c: Don't #include elf-bfd.h or coff-bfd.h. (vfinfo): Use bfd_group_name.
2019-09-09 07:53:27 +02:00
#ifndef MY_bfd_group_name
#define MY_bfd_group_name bfd_generic_group_name
#endif
* bfd-in.h: Remove "taken from the source" comment. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. * elf.c (bfd_elf_discard_group): Return true. * elf-bfd.h (bfd_elf_discard_group): Declare. * bfd-in.h (bfd_elf_discard_group): Don't declare here. * section.c (bfd_discard_group): Rename to bfd_generic_discard_group. * bfd.c (bfd_discard_group): Define. * targets.c (struct bfd_target): Add _bfd_discard_group. (BFD_JUMP_TABLE_LINK): Here too. * libbfd-in.h (_bfd_nolink_bfd_discard_group): Define. * aout-adobe.c (aout_32_bfd_discard_group): Define. * aout-target.h (MY_bfd_discard_group): Define. * aout-tic30.c (MY_bfd_discard_group): Define. * binary.c (binary_bfd_discard_group): Define. * bout.c (b_out_bfd_discard_group): Define. * coff-alpha.c (_bfd_ecoff_bfd_discard_group): Define. * coffcode.h (coff_bfd_discard_group): Define. * coff-mips.c (_bfd_ecoff_bfd_discard_group): Define. * elfxx-target.h (bfd_elfNN_bfd_discard_group): Define. * i386msdos.c (msdos_bfd_discard_group): Define. * i386os9k.c (os9k_bfd_discard_group): Define. * ieee.c (ieee_bfd_discard_group): Define. * ihex.c (ihex_bfd_discard_group): Define. * mmo.c (mmo_bfd_discard_group): Define. * nlm-target.h (nlm_bfd_discard_group): Define. * oasys.c (oasys_bfd_discard_group): Define. * ppcboot.c (ppcboot_bfd_discard_group): Define. * som.c (som_bfd_discard_group): Define. * srec.c (srec_bfd_discard_group): Define. * tekhex.c (tekhex_bfd_discard_group): Define. * versados.c (versados_bfd_discard_group): Define. * vms.c (vms_bfd_discard_group): Define. * xcoff-target.h (_bfd_xcoff_bfd_discard_group): Define. * coff64-rs6000.c (rs6000coff64_vec): Update initialiser. (aix5coff64_vec): Likewise. * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Likewise.
2002-06-05 05:43:11 +02:00
#ifndef MY_bfd_discard_group
#define MY_bfd_discard_group bfd_generic_discard_group
#endif
bfd/ 2004-07-21 H.J. Lu <hongjiu.lu@intel.com> * aout-adobe.c (aout_32_section_already_linked): Defined. * aout-target.h (MY_section_already_linked): Likewise. * aout-tic30.c (MY_section_already_linked): Likewise. * binary.c (binary_section_already_linked): Likewise. * bout.c (b_out_section_already_linked): Likewise. * coff-alpha.c (_bfd_ecoff_section_already_linked): Likewise. * coff-mips.c (_bfd_ecoff_section_already_linked): Likewise. * coffcode.h (coff_section_already_linked): Likewise. * i386msdos.c (msdos_section_already_linked): Likewise. * i386os9k.c (os9k_section_already_linked): Likewise. * ieee.c (ieee_section_already_linked): Likewise. * ihex.c (ihex_section_already_linked): Likewise. * mach-o.c (bfd_mach_o_section_already_linked): Likewise. * mmo.c (mmo_section_already_linked): Likewise. * nlm-target.h (nlm_section_already_linked): Likewise. * oasys.c (oasys_section_already_linked): Likewise. * pef.c (bfd_pef_section_already_linked): Likewise. * ppcboot.c (ppcboot_section_already_linked): Likewise. * som.c (som_bfd_discard_group): Likewise. * srec.c (srec_section_already_linked): Likewise. * tekhex.c (tekhex_section_already_linked): Likewise. * versados.c (versados_section_already_linked): Likewise. * vms.c (vms_section_already_linked): Likewise. * coff-target.h (_bfd_xcoff_section_already_linked): Likewise. * xsym.c (bfd_sym_section_already_linked): Likewise. * bfd-in.h (bfd_section_already_linked_table_init): New. (bfd_section_already_linked_table_free): Likewise. * coff-rs6000.c (rs6000coff_vec): Add _bfd_generic_section_already_linked. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * elf-bfd.h (_bfd_elf_section_already_linked): New prototype. * elflink.c (_bfd_elf_section_already_linked): New function. * elfxx-target.h (bfd_elfNN_section_already_linked): Defined. * libbfd-in.h (_bfd_nolink_section_already_linked): Defined. (_bfd_generic_section_already_linked): New. (bfd_section_already_linked_hash_entry): Likewise. (bfd_section_already_linked): Likewise. (bfd_section_already_linked_table_lookup): Likewise. (bfd_section_already_linked_table_insert): Likewise. * linker.c (bfd_section_already_linked): New. (_bfd_section_already_linked_table): Likewise. (bfd_section_already_linked_table_lookup): Likewise. (bfd_section_already_linked_table_insert): Likewise. (already_linked_newfunc): Likewise. (bfd_section_already_linked_table_init): Likewise. (bfd_section_already_linked_table_free): Likewise. (_bfd_generic_section_already_linked): Likewise. * section.c (bfd_section): Remove comdat. (bfd_comdat_info): Moved to ... * bfd-in.h (coff_comdat_info): Here. (bfd_coff_get_comdat_section): New. * coffgen.c (bfd_coff_get_comdat_section): Likewise. * libcoff-in.h (coff_section_tdata): Add comdat. * coffcode.h (handle_COMDAT): Updated. * cofflink.c (coff_link_add_symbols): Likewise. * ecoff.c (bfd_debug_section): Likewise. * targets.c (bfd_target): Add _section_already_linked. (BFD_JUMP_TABLE_LINK): Updated. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. * libcoff.h: Likewise. binutils/ 2004-07-21 H.J. Lu <hongjiu.lu@intel.com> * objcopy.c (filter_symbols): Use bfd_coff_get_comdat_section to access comdat. * objdump.c (dump_section_header): Likewise. ld/ 2004-07-21 H.J. Lu <hongjiu.lu@intel.com> * ldlang.c (already_linked_hash_entry): Removed. (already_linked): Likewise. (already_linked_table): Likewise. (section_already_linked): Call bfd_section_already_linked. (lang_process): Replace already_linked_table_init with bfd_section_already_linked_table_init and check return. Replace already_linked_table_free with bfd_section_already_linked_table_free.
2004-07-21 17:42:58 +02:00
#ifndef MY_section_already_linked
#define MY_section_already_linked \
_bfd_generic_section_already_linked
#endif
bfd/ * aout-adobe.c (aout_32_bfd_define_common_symbol): Define. * aout-target.h (MY_bfd_define_common_symbol): Likewise. * aout-tic30.c (MY_bfd_define_common_symbol): Likewise. * binary.c (binary_bfd_define_common_symbol): Likewise. * bout.c (b_out_bfd_define_common_symbol): Likewise. * coff-alpha.c (_bfd_ecoff_bfd_define_common_symbol): Likewise. * coff-mips.c (_bfd_ecoff_bfd_define_common_symbol): Likewise. * coffcode.h (coff_bfd_define_common_symbol): Likewise. * elfxx-target.h (bfd_elfNN_bfd_define_common_symbol): Likewise. * i386msdos.c (msdos_bfd_define_common_symbol): Likewise. * i386os9k.c (os9k_bfd_define_common_symbol): Likewise. * ieee.c (ieee_bfd_define_common_symbol): Likewise. * ihex.c (ihex_bfd_define_common_symbol): Likewise. * libbfd-in.h (_bfd_nolink_bfd_define_common_symbol): Likewise. * mach-o.c (bfd_mach_o_bfd_define_common_symbol): Likewise. * mmo.c (mmo_bfd_define_common_symbol): Likewise. * nlm-target.h (nlm_bfd_define_common_symbol): Likewise. * oasys.c (oasys_bfd_define_common_symbol): Likewise. * pef.c (bfd_pef_bfd_define_common_symbol): Likewise. * ppcboot.c (ppcboot_bfd_define_common_symbol): Likewise. * som.c (som_bfd_define_common_symbol): Likewise. * srec.c (srec_bfd_define_common_symbol): Likewise. * tekhex.c (tekhex_bfd_define_common_symbol): Likewise. * versados.c (versados_bfd_define_common_symbol): Likewise. * vms.c (vms_bfd_define_common_symbol): Likewise. * xcoff-target.h (_bfd_xcoff_bfd_define_common_symbol): Likewise. * xsym.c (bfd_sym_bfd_define_common_symbol): Likewise. * coff-rs6000.c (rs6000coff_vec): Add _bfd_xcoff_define_common_symbol. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * linker.c (bfd_generic_define_common_symbol): New function. * targets.c (BFD_JUMP_TABLE_LINK): Add NAME##_bfd_define_common_symbol. (_bfd_define_common_symbol): New field. * libcoff-in.h (_bfd_xcoff_define_common_symbol): Declare. * xcofflink.c (_bfd_xcoff_define_common_symbol): New function. (xcoff_build_ldsyms): Don't set XCOFF_DEF_REGULAR for common symbols here. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. * libcoff.h: Likewise. ld/ * ldlang.c (lang_one_common): Use bfd_define_common_symbol. ld/testsuite/ * ld-powerpc/aix-export-2.s, ld-powerpc/aix-export-2.nd: New test. * ld-powerpc/aix52.exp: Run it.
2009-04-17 01:07:00 +02:00
#ifndef MY_bfd_define_common_symbol
#define MY_bfd_define_common_symbol bfd_generic_define_common_symbol
#endif
ld: Hide symbols defined by HIDDEN/PROVIDE_HIDDEN There should be no difference in output for symbols defined by HIDDEN or PROVIDE_HIDDEN assignments whether they are explicitly marked as hidden or not. This patch adds a new BFD function, bfd_link_hide_symbol, to hide symbols defined by HIDDEN and PROVIDE_HIDDEN assignments. bfd PR ld/23201 * aout-target.h (MY_bfd_link_hide_symbol): New. * aout-tic30.c (MY_bfd_link_hide_symbol): Likewise. * binary.c (binary_bfd_link_hide_symbol): Likewise. * coff-alpha.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise. * coff-mips.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise. * coff-rs6000.c (_bfd_xcoff_bfd_link_hide_symbol): Likewise. * coffcode.h (coff_bfd_link_hide_symbol): Likewise. * elf-bfd.h (_bfd_elf_link_hide_symbol): Likewise. * elfxx-target.h (bfd_elfNN_bfd_link_hide_symbol): Likewise. * i386msdos.c (msdos_bfd_link_hide_symbol): Likewise. * ihex.c (ihex_bfd_link_hide_symbol): Likewise. * libbfd-in.h (_bfd_nolink_bfd_link_hide_symbol): Likewise. * linker.c (_bfd_generic_link_hide_symbol): Likewise. (bfd_link_hide_symbol): Likewise. * mach-o-target.c (bfd_mach_o_bfd_link_hide_symbol): Likewise. * mmo.c (mmo_bfd_link_hide_symbol): Likewise. * pef.c (bfd_pef_bfd_link_hide_symbol): Likewise. * plugin.c (bfd_plugin_bfd_link_hide_symbol): Likewise. * ppcboot.c (ppcboot_bfd_link_hide_symbol): Likewise. * som.c (som_bfd_link_hide_symbol): Likewise. * srec.c (srec_bfd_link_hide_symbol): Likewise. * tekhex.c (tekhex_bfd_link_hide_symbol): Likewise. * vms-alpha.c (vms_bfd_link_hide_symbol): Likewise. (alpha_vms_bfd_link_hide_symbol): Likewise. * xsym.c (bfd_sym_bfd_link_hide_symbol): Likewise. * coff64-rs6000.c (rs6000_xcoff64_vec): Add _bfd_generic_link_hide_symbol. (rs6000_xcoff64_aix_vec): Likewise. * elflink.c (bfd_elf_record_link_assignment): Don't make forced local symbol dynamic. (_bfd_elf_link_hide_symbol): New function. * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't check root.ldscript_def. * targets.c (bfd_target): Add _bfd_link_hide_symbol. (BFD_JUMP_TABLE_LINK): Add NAME##_bfd_link_hide_symbol. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. ld/ PR ld/23201 * ldexp.c (exp_fold_tree_1): Call bfd_link_hide_symbol to hide a symbol. * testsuite/ld-elf/provide-hidden-dynabs.nd: Removed. * testsuite/ld-elf/provide-hidden-dynsec.nd: Likewise. * testsuite/ld-elf/provide-hidden.exp: Replace provide-hidden-dynsec.nd with provide-hidden-sec.nd and provide-hidden-dyn.nd. Replace provide-hidden-dynabs.nd with provide-hidden-abs.nd and provide-hidden-dyn.nd. * testsuite/ld-i386/pr23189.d: Expect no dynamic relocation. * testsuite/ld-x86-64/pr23189.d: Likewise.
2018-05-22 05:39:09 +02:00
#ifndef MY_bfd_link_hide_symbol
#define MY_bfd_link_hide_symbol _bfd_generic_link_hide_symbol
#endif
Rewrite __start and __stop symbol handling This arranges for __start and __stop symbols to be defined before garbage collection, for all target formats. That should allow the COFF and PE --gc-sections to keep a singleton orphan input section, a feature lost by 2017-06-13 commit cbd0eecf26. The fancier ELF treatment of keeping all input sections associated with a __start or __stop symbol, from 2015-10-23 commit 1cce69b9dc, is retained. .startof. and .sizeof. symbols are deliberately not defined before garbage collection, so these won't affect garbage collection of sections. The patch also ensures __start, __stop, .startof. and .sizeof. symbols are defined before target size_dynamic_sections is called, albeit with a preliminary value, so that target code doesn't need to cope with a symbol changing from undefined at size_dynamic_sections to defined at relocate_section. Also, a number of problems with the testcases have been fixed. PR ld/20022 PR ld/21557 PR ld/21562 PR ld/21571 include/ * bfdlink.h (struct bfd_link_hash_entry): Delete undef.section. bfd/ * targets.c (struct bfd_target): Add _bfd_define_start_stop. (BFD_JUMP_TABLE_LINK): Likewise. * elf-bfd.h (bfd_elf_define_start_stop): Declare. * elflink.c (_bfd_elf_gc_mark_rsec): Update comment. (bfd_elf_define_start_stop): New function. * linker.c (bfd_generic_define_start_stop): New function. * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init new field. * aout-adobe.c (aout_32_bfd_define_start_stop): Define. * aout-target.h (MY_bfd_define_start_stop): Define. * aout-tic30.c (MY_bfd_define_start_stop): Define. * binary.c (binary_bfd_define_start_stop): Define. * bout.c (b_out_bfd_define_start_stop): Define. * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define. * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define. * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define. * coffcode.h (coff_bfd_define_start_stop): Define. * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define. * i386msdos.c (msdos_bfd_define_start_stop): Define. * i386os9k.c (os9k_bfd_define_start_stop): Define. * ieee.c (ieee_bfd_define_start_stop): Define. * ihex.c (ihex_bfd_define_start_stop): Define. * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define. * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define. * mmo.c (mmo_bfd_define_start_stop): Define. * nlm-target.h (nlm_bfd_define_start_stop): Define. * oasys.c (oasys_bfd_define_start_stop): Define. * pef.c (bfd_pef_bfd_define_start_stop): Define. * plugin.c (bfd_plugin_bfd_define_start_stop): Define. * ppcboot.c (ppcboot_bfd_define_start_stop): Define. * som.c (som_bfd_define_start_stop): Define. * srec.c (srec_bfd_define_start_stop): Define. * tekhex.c (tekhex_bfd_define_start_stop): Define. * versados.c (versados_bfd_define_start_stop): Define. * vms-alpha.c (vms_bfd_define_start_stop): Define. (alpha_vms_bfd_define_start_stop): Define. * xsym.c (bfd_sym_bfd_define_start_stop): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't set __start/__stop syms here. * ldlang.c (lang_set_startof): Delete. (start_stop_syms, start_stop_count, start_stop_alloc): New vars. (lang_define_start_stop, lang_init_start_stop, foreach_start_stop, undef_start_stop, lang_undef_start_stop, lang_init_startof_sizeof, set_start_stop, lang_finalize_start_stop): New functions. (lang_process): Call _start_stop functions. * testsuite/ld-elf/pr21562a.d: Use xfail rather than notarget. Correct typos and list of xfail targets. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/sizeofa.d: Likewise. Adjust to pass for generic ELF. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise.
2017-06-16 12:11:41 +02:00
#ifndef MY_bfd_define_start_stop
#define MY_bfd_define_start_stop bfd_generic_define_start_stop
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_bfd_reloc_type_lookup
2005-04-11 10:23:05 +02:00
#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
1999-05-03 09:29:11 +02:00
#endif
* 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 14:23:03 +02:00
#ifndef MY_bfd_reloc_name_lookup
#define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup)
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_bfd_make_debug_symbol
#define MY_bfd_make_debug_symbol 0
#endif
#ifndef MY_read_minisymbols
2005-04-11 10:23:05 +02:00
#define MY_read_minisymbols NAME (aout, read_minisymbols)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_minisymbol_to_symbol
2005-04-11 10:23:05 +02:00
#define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_bfd_link_hash_table_create
2005-04-11 10:23:05 +02:00
#define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_bfd_link_add_symbols
2005-04-11 10:23:05 +02:00
#define MY_bfd_link_add_symbols NAME (aout, link_add_symbols)
1999-05-03 09:29:11 +02:00
#endif
Fix ld --just-symbols * aix5ppc-core.c: Warning fixes. * aout-adobe.c (aout_32_bfd_link_just_syms): Define. * aout-target.h (MY_bfd_link_just_syms): Define. * aout-tic30.c (MY_bfd_link_just_syms): Define. * bfd.c (bfd_link_just_syms): Define. * binary.c (binary_bfd_link_just_syms): Define. * bout.c (b_out_bfd_link_just_syms): Define. * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update initializer. * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_link_just_syms): Define. * elf-bfd.h (enum elf_link_info_type): Add ELF_INFO_TYPE_JUST_SYMS. (elf_discarded_section): Check for ELF_INFO_TYPE_JUST_SYMS. (_bfd_elf_link_just_syms): Declare. * elf.c (_bfd_elf_link_just_syms): New function. * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Check that sections haven't already been discarded by the linker. * elflink.h (elf_link_add_object_symbols): Likewise for stab sections and SEC_MERGE sections. (elf_bfd_discard_info): Similarly here. * elfxx-target.h (bfd_elfNN_bfd_link_just_syms): Define. * i386msdos.c (msdos_bfd_link_just_syms): Define. * i386os9k.c (os9k_bfd_link_just_syms): Define. * ieee.c (ieee_bfd_link_just_syms): Define. * ihex.c (ihex_bfd_link_just_syms): Define. * libbfd-in.h (_bfd_nolink_bfd_link_just_syms): Define. (_bfd_generic_link_just_syms): Declare. * libecoff.h (_bfd_ecoff_bfd_link_just_syms): Define. * linker.c (_bfd_generic_link_just_syms): New function. * mmo.c (mmo_bfd_link_just_syms): Define. * nlm-target.h (nlm_bfd_link_just_syms): Define. * oasys.c (oasys_bfd_link_just_syms): Define. * ppcboot.c (ppcboot_bfd_link_just_syms): Define. * som.c (som_bfd_link_just_syms): Define. * srec.c (srec_bfd_link_just_syms): Define. * targets.c (struct bfd_target): Add _bfd_link_just_syms. (BFD_JUMP_TABLE_LINK): And here. * tekhex.c (tekhex_bfd_link_just_syms): Define. * versados.c (versados_bfd_link_just_syms): Define. * vms.c (vms_bfd_link_just_syms): Define. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate.
2002-05-15 02:18:58 +02:00
#ifndef MY_bfd_link_just_syms
#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
#endif
2009-11-23 Paul Brook <paul@codesourcery.com> ld/ * ldexp.c: Copy symbol type for simple assignments. bfd/ * libbfd-in.h (_bfd_generic_copy_link_hash_symbol_type): Add prototype. * elf-bfd.h (_bfd_elf_copy_link_hash_symbol_type): Add prototype. * linker.c (_bfd_generic_copy_link_hash_symbol_type): New function. * elflink.c (_bfd_elf_copy_link_hash_symbol_type): New function. * targets.c (BFD_JUMP_TABLE_LINK, struct bfd_target): Add _copy_link_hash_symbol_type. * bfd/coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Add _bfd_generic_copy_link_hash_symbol_type. * bfd/coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add _bfd_generic_copy_link_hash_symbol_type. * aout-adobe.c (aout_32_bfd_copy_link_hash_symbol_type): Define. * aout-target.h (MY_bfd_copy_link_hash_symbol_type): Define. * aout-tic30.c (MY_bfd_copy_link_hash_symbol_type): Define. * binary.c (binary_bfd_copy_link_hash_symbol_type): Define. * bout.c (b_out_bfd_copy_link_hash_symbol_type): Define. * coffcode.h (coff_bfd_copy_link_hash_symbol_type): Define. * elfxx-target.h (bfd_elfNN_bfd_copy_link_hash_symbol_type): Define. * i386msdos.c (msdos_bfd_copy_link_hash_symbol_type): Define. * i386os9k.c (os9k_bfd_copy_link_hash_symbol_type): Define. * ieee.c (ieee_bfd_copy_link_hash_symbol_type): Define. * ihex.c (ihex_bfd_copy_link_hash_symbol_type): Define. * libecoff.h (_bfd_ecoff_bfd_copy_link_hash_symbol_type): Define. * mach-o.c (bfd_mach_o_bfd_copy_link_hash_symbol_type): Define. * mmo.c (mmo_bfd_copy_link_hash_symbol_type): Define. * nlm-target.h (nlm_bfd_copy_link_hash_symbol_type): Define. * oasys.c (oasys_bfd_copy_link_hash_symbol_type): Define. * pef.c (bfd_pef_bfd_copy_link_hash_symbol_type): Define. * ppcboot.c (ppcboot_bfd_copy_link_hash_symbol_type): Define. * som.c (som_bfd_copy_link_hash_symbol_type): Define. * srec.c (srec_bfd_copy_link_hash_symbol_type): Define. * tekhex.c (tekhex_bfd_copy_link_hash_symbol_type): Define. * versados.c (versados_bfd_copy_link_hash_symbol_type): Define. * vms.c (vms_bfd_copy_link_hash_symbol_type): Define. * xsym.c (bfd_sym_bfd_copy_link_hash_symbol_type): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/testsuite * ld-arm/script-type.sym: New test. * ld-arm/script-type.s: New test. * ld-arm/script-type.s: New test.
2009-11-23 15:41:33 +01:00
#ifndef MY_bfd_copy_link_hash_symbol_type
#define MY_bfd_copy_link_hash_symbol_type \
_bfd_generic_copy_link_hash_symbol_type
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_bfd_link_split_section
#define MY_bfd_link_split_section _bfd_generic_link_split_section
#endif
#ifndef MY_bfd_link_check_relocs
#define MY_bfd_link_check_relocs _bfd_generic_link_check_relocs
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_bfd_copy_private_bfd_data
#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#endif
#ifndef MY_bfd_merge_private_bfd_data
#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
#endif
#ifndef MY_bfd_copy_private_symbol_data
#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
#endif
#ifndef MY_bfd_copy_private_header_data
#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_bfd_print_private_bfd_data
#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
#endif
#ifndef MY_bfd_set_private_flags
#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
#endif
#ifndef MY_bfd_is_local_label_name
#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
#endif
#ifndef MY_bfd_is_target_special_symbol
Remove bfd stub function casts. This patch defines a bunch of new functions to use in the BFD target structs rather than casting bfd_false or bfd_true and similar stub functions. I've also renamed the stub functions to reflect their parameters and put "error" in the name if they set bfd_error. The latter change is important since there were quite a few uses of bfd_false where setting bfd_error was inappropriate, for example in elf_backend_allow_non_load_phdr and is_target_special_symbol. * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false. (_bfd_bool_bfd_true): Rename from bfd_true. (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr. (_bfd_int_bfd_0): Rename from bfd_0. (_bfd_uint_bfd_0): Rename from bfd_0u. (_bfd_long_bfd_0): Rename from bfd_0l. (_bfd_long_bfd_n1_error): Rename from _bfd_n1. (_bfd_void_bfd): Rename from bfd_void. (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false), (_bfd_bool_bfd_link_false_error), (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true), (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true), (_bfd_bool_bfd_asection_bfd_asection_true), (_bfd_bool_bfd_asymbol_bfd_asymbol_true), (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions. * archive.c (_bfd_noarchive_get_elt_at_index), (_bfd_noarchive_openr_next_archived_file), (_bfd_noarchive_construct_extended_name_table), (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname), (_bfd_noarchive_write_armap): New functions. * archures.c (_bfd_nowrite_set_arch_mach): New function. * coff-alpha.c (alpha_ecoff_swap_coff_aux_in), (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in), (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out), (alpha_ecoff_swap_coff_lineno_out), (alpha_ecoff_swap_coff_reloc_out): New functions. * coff-mips.c (mips_ecoff_swap_coff_aux_in), (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in), (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out), (mips_ecoff_swap_coff_lineno_out), (mips_ecoff_swap_coff_reloc_out): New functions. * coffcode.h (coff_set_alignment_hook): Replace define with new function. (symname_in_debug_hook): Likewise. * ecoff.c (_bfd_ecoff_set_alignment_hook): New function. * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0. * elf.c (assign_file_positions_except_relocs): Test elf_backend_allow_non_load_phdr for NULL. * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from _bfd_elf_link_omit_section_dynsym. Update uses. (_bfd_elf_omit_section_dynsym_all): New function. * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete. (_bfd_elf_omit_section_dynsym_default): Declare. (_bfd_elf_omit_section_dynsym_all): Declare. * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section), (_bfd_nolink_bfd_get_relocated_section_contents), (_bfd_nolink_bfd_lookup_section_flags), (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group), (_bfd_nolink_bfd_link_hash_table_create), (_bfd_nolink_bfd_link_just_syms), (_bfd_nolink_bfd_copy_link_hash_symbol_type), (_bfd_nolink_bfd_link_split_section), (_bfd_nolink_section_already_linked), (_bfd_nolink_bfd_define_common_symbol), (_bfd_nolink_bfd_define_start_stop): New functions. * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup), (_bfd_norelocs_bfd_reloc_name_lookup), (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions. * section.c (_bfd_nowrite_set_section_contents): New function. * syms.c (_bfd_nosymbols_canonicalize_symtab), (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info), (_bfd_nosymbols_get_symbol_version_string), (_bfd_nosymbols_bfd_is_local_label_name), (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line), (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info), (_bfd_nosymbols_bfd_make_debug_symbol), ( _bfd_nosymbols_read_minisymbols), ( _bfd_nosymbols_minisymbol_to_symbol), (_bfd_nodynamic_get_synthetic_symtab): New functions. * libbfd-in.h: Declare new functions. Update existing defines, removing casts. * aix386-core.c: Update to use new hooks. Formatting. * aout-adobe.c: Likewise. * aout-arm.c: Likewise. * aout-target.h: Likewise. * aout-tic30.c: Likewise. * aoutf1.h: Likewise. * binary.c: Likewise. * bout.c: Likewise. * cisco-core.c: Likewise. * coff-alpha.c: Likewise. * coff-i386.c: Likewise. * coff-i860.c: Likewise. * coff-i960.c: Likewise. * coff-ia64.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic30.c: Likewise. * coff-tic54x.c: Likewise. * coff-x86_64.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * elf-m10300.c: Likewise. * elf32-cr16.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32r.c: Likewise. * elf32-metag.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-target.h: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.h: Likewise. * hp300hpux.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386msdos.c: Likewise. * i386os9k.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * irix-core.c: Likewise. * libaout.h: Likewise. * libecoff.h: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mipsbsd.c: Likewise. * mmo.c: Likewise. * netbsd-core.c: Likewise. * nlm-target.h: Likewise. * oasys.c: Likewise. * osf-core.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * pe-x86_64.c: Likewise. * pef.c: Likewise. * plugin.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * sco5-core.c: Likewise. * som.c: Likewise. * sparclynx.c: Likewise. * srec.c: Likewise. * tekhex.c: Likewise. * trad-core.c: Likewise. * verilog.c: Likewise. * versados.c: Likewise. * vms-alpha.c: Likewise. * vms-lib.c: Likewise. * wasm-module.c: Likewise. * xsym.c: Likewise. * libbfd.h: Regenerate.
2018-02-15 01:28:06 +01:00
#define MY_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_bfd_free_cached_info
2005-04-11 10:23:05 +02:00
#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info)
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_close_and_cleanup
/* Handle closing of a BFD including the resource-releasing parts. */
static bfd_boolean
MY_close_and_cleanup (bfd *abfd)
{
if (!MY_bfd_free_cached_info (abfd))
return FALSE;
return _bfd_generic_close_and_cleanup (abfd);
}
1999-05-03 09:29:11 +02:00
#endif
#ifndef MY_get_dynamic_symtab_upper_bound
#define MY_get_dynamic_symtab_upper_bound \
_bfd_nodynamic_get_dynamic_symtab_upper_bound
#endif
#ifndef MY_canonicalize_dynamic_symtab
#define MY_canonicalize_dynamic_symtab \
_bfd_nodynamic_canonicalize_dynamic_symtab
#endif
bfd/ * bfd.c (bfd_get_synthetic_symtab): Define. * targets.c (BFD_JUMP_TABLE_DYNAMIC): Add NAME##_get_synthetic_symtab. (struct bfd_target): Add _bfd_get_synthetic_symtab. * libbfd-in.h (_bfd_nodynamic_get_synthetic_symtab): Define. * elf-bfd.h (struct elf_backend_data): Add plt_sym_val and relplt_name fields. (_bfd_elf_get_synthetic_symtab): New prototype. * elfcode.h (elf_get_synthetic_symtab): Define. * elf.c (_bfd_elf_get_synthetic_symtab): New function. * elfxx-target.h (bfd_elfNN_get_synthetic_symtab): Define. (elf_backend_plt_sym_val, elf_backend_relplt_name): Define. (elfNN_bed): Add elf_backend_plt_sym_val and elf_backend_relplt_name. * bfd-in2.h: Rebuilt. * libbfd.h: Rebuilt. * elf32-i386.c (elf_i386_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-x86-64.c (elf64_x86_64_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-s390.c (elf_s390_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-s390.c (elf_s390_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-sparc (elf32_sparc_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-sparc.c (sparc64_elf_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-ppc.c (ppc_elf_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * aout-target.h (MY_get_synthetic_symtab): Define. * aout-tic30.c (MY_get_synthetic_symtab): Define. * coff-rs6000.c (rs6000coff_vec): Add _bfd_nodynamic_get_synthetic_symtab. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Add _bfd_nodynamic_get_synthetic_symtab. (aix5coff64_vec): Likewise. * sunos.c (MY_get_synthetic_symtab): Define. * vms.c (vms_get_synthetic_symtab): Define. binutils/ * objdump.c (synthsyms, synthcount): New variables. (disassemble_data): Use dynsyms for stripped binaries or libraries. Add synthetized symbols. (dump_bfd): For disassemble, initialize dynsyms always and also synthsyms. Free synthsyms and clear {sym,dynsym,synth}count before returning.
2004-04-22 16:45:32 +02:00
#ifndef MY_get_synthetic_symtab
#define MY_get_synthetic_symtab \
_bfd_nodynamic_get_synthetic_symtab
#endif
1999-05-03 09:29:11 +02:00
#ifndef MY_get_dynamic_reloc_upper_bound
#define MY_get_dynamic_reloc_upper_bound \
_bfd_nodynamic_get_dynamic_reloc_upper_bound
#endif
#ifndef MY_canonicalize_dynamic_reloc
#define MY_canonicalize_dynamic_reloc \
_bfd_nodynamic_canonicalize_dynamic_reloc
#endif
2005-04-11 10:23:05 +02:00
/* Aout symbols normally have leading underscores. */
#ifndef MY_symbol_leading_char
1999-05-03 09:29:11 +02:00
#define MY_symbol_leading_char '_'
#endif
2005-04-11 10:23:05 +02:00
/* Aout archives normally use spaces for padding. */
1999-05-03 09:29:11 +02:00
#ifndef AR_PAD_CHAR
#define AR_PAD_CHAR ' '
#endif
#ifndef MY_BFD_TARGET
2005-04-11 10:23:05 +02:00
const bfd_target MY (vec) =
1999-05-03 09:29:11 +02:00
{
2005-04-11 10:23:05 +02:00
TARGETNAME, /* Name. */
1999-05-03 09:29:11 +02:00
bfd_target_aout_flavour,
#ifdef TARGET_IS_BIG_ENDIAN_P
2005-04-11 10:23:05 +02:00
BFD_ENDIAN_BIG, /* Target byte order (big). */
BFD_ENDIAN_BIG, /* Target headers byte order (big). */
1999-05-03 09:29:11 +02:00
#else
2005-04-11 10:23:05 +02:00
BFD_ENDIAN_LITTLE, /* Target byte order (little). */
BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */
1999-05-03 09:29:11 +02:00
#endif
2005-04-11 10:23:05 +02:00
(HAS_RELOC | EXEC_P | /* Object flags. */
1999-05-03 09:29:11 +02:00
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
MY_symbol_leading_char,
2005-04-11 10:23:05 +02:00
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
0, /* match priority. */
1999-05-03 09:29:11 +02:00
#ifdef TARGET_IS_BIG_ENDIAN_P
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
2005-04-11 10:23:05 +02:00
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
1999-05-03 09:29:11 +02:00
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
2005-04-11 10:23:05 +02:00
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
1999-05-03 09:29:11 +02:00
#else
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
2005-04-11 10:23:05 +02:00
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
1999-05-03 09:29:11 +02:00
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
2005-04-11 10:23:05 +02:00
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
1999-05-03 09:29:11 +02:00
#endif
Remove bfd stub function casts. This patch defines a bunch of new functions to use in the BFD target structs rather than casting bfd_false or bfd_true and similar stub functions. I've also renamed the stub functions to reflect their parameters and put "error" in the name if they set bfd_error. The latter change is important since there were quite a few uses of bfd_false where setting bfd_error was inappropriate, for example in elf_backend_allow_non_load_phdr and is_target_special_symbol. * libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false. (_bfd_bool_bfd_true): Rename from bfd_true. (_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr. (_bfd_int_bfd_0): Rename from bfd_0. (_bfd_uint_bfd_0): Rename from bfd_0u. (_bfd_long_bfd_0): Rename from bfd_0l. (_bfd_long_bfd_n1_error): Rename from _bfd_n1. (_bfd_void_bfd): Rename from bfd_void. (_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false), (_bfd_bool_bfd_link_false_error), (_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true), (_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true), (_bfd_bool_bfd_asection_bfd_asection_true), (_bfd_bool_bfd_asymbol_bfd_asymbol_true), (_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions. * archive.c (_bfd_noarchive_get_elt_at_index), (_bfd_noarchive_openr_next_archived_file), (_bfd_noarchive_construct_extended_name_table), (_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname), (_bfd_noarchive_write_armap): New functions. * archures.c (_bfd_nowrite_set_arch_mach): New function. * coff-alpha.c (alpha_ecoff_swap_coff_aux_in), (alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in), (alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out), (alpha_ecoff_swap_coff_lineno_out), (alpha_ecoff_swap_coff_reloc_out): New functions. * coff-mips.c (mips_ecoff_swap_coff_aux_in), (mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in), (mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out), (mips_ecoff_swap_coff_lineno_out), (mips_ecoff_swap_coff_reloc_out): New functions. * coffcode.h (coff_set_alignment_hook): Replace define with new function. (symname_in_debug_hook): Likewise. * ecoff.c (_bfd_ecoff_set_alignment_hook): New function. * elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0. * elf.c (assign_file_positions_except_relocs): Test elf_backend_allow_non_load_phdr for NULL. * elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from _bfd_elf_link_omit_section_dynsym. Update uses. (_bfd_elf_omit_section_dynsym_all): New function. * elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete. (_bfd_elf_omit_section_dynsym_default): Declare. (_bfd_elf_omit_section_dynsym_all): Declare. * linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section), (_bfd_nolink_bfd_get_relocated_section_contents), (_bfd_nolink_bfd_lookup_section_flags), (_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group), (_bfd_nolink_bfd_link_hash_table_create), (_bfd_nolink_bfd_link_just_syms), (_bfd_nolink_bfd_copy_link_hash_symbol_type), (_bfd_nolink_bfd_link_split_section), (_bfd_nolink_section_already_linked), (_bfd_nolink_bfd_define_common_symbol), (_bfd_nolink_bfd_define_start_stop): New functions. * reloc.c (_bfd_norelocs_bfd_reloc_type_lookup), (_bfd_norelocs_bfd_reloc_name_lookup), (_bfd_nodynamic_canonicalize_dynamic_reloc): New functions. * section.c (_bfd_nowrite_set_section_contents): New function. * syms.c (_bfd_nosymbols_canonicalize_symtab), (_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info), (_bfd_nosymbols_get_symbol_version_string), (_bfd_nosymbols_bfd_is_local_label_name), (_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line), (_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info), (_bfd_nosymbols_bfd_make_debug_symbol), ( _bfd_nosymbols_read_minisymbols), ( _bfd_nosymbols_minisymbol_to_symbol), (_bfd_nodynamic_get_synthetic_symtab): New functions. * libbfd-in.h: Declare new functions. Update existing defines, removing casts. * aix386-core.c: Update to use new hooks. Formatting. * aout-adobe.c: Likewise. * aout-arm.c: Likewise. * aout-target.h: Likewise. * aout-tic30.c: Likewise. * aoutf1.h: Likewise. * binary.c: Likewise. * bout.c: Likewise. * cisco-core.c: Likewise. * coff-alpha.c: Likewise. * coff-i386.c: Likewise. * coff-i860.c: Likewise. * coff-i960.c: Likewise. * coff-ia64.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-rs6000.c: Likewise. * coff-sh.c: Likewise. * coff-tic30.c: Likewise. * coff-tic54x.c: Likewise. * coff-x86_64.c: Likewise. * coff64-rs6000.c: Likewise. * coffcode.h: Likewise. * elf-m10300.c: Likewise. * elf32-cr16.c: Likewise. * elf32-lm32.c: Likewise. * elf32-m32r.c: Likewise. * elf32-metag.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-tilepro.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfnn-ia64.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-target.h: Likewise. * elfxx-tilegx.c: Likewise. * elfxx-x86.h: Likewise. * hp300hpux.c: Likewise. * hppabsd-core.c: Likewise. * hpux-core.c: Likewise. * i386msdos.c: Likewise. * i386os9k.c: Likewise. * ieee.c: Likewise. * ihex.c: Likewise. * irix-core.c: Likewise. * libaout.h: Likewise. * libecoff.h: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mipsbsd.c: Likewise. * mmo.c: Likewise. * netbsd-core.c: Likewise. * nlm-target.h: Likewise. * oasys.c: Likewise. * osf-core.c: Likewise. * pdp11.c: Likewise. * pe-mips.c: Likewise. * pe-x86_64.c: Likewise. * pef.c: Likewise. * plugin.c: Likewise. * ppcboot.c: Likewise. * ptrace-core.c: Likewise. * sco5-core.c: Likewise. * som.c: Likewise. * sparclynx.c: Likewise. * srec.c: Likewise. * tekhex.c: Likewise. * trad-core.c: Likewise. * verilog.c: Likewise. * versados.c: Likewise. * vms-alpha.c: Likewise. * vms-lib.c: Likewise. * wasm-module.c: Likewise. * xsym.c: Likewise. * libbfd.h: Regenerate.
2018-02-15 01:28:06 +01:00
{ /* bfd_check_format. */
_bfd_dummy_target,
MY_object_p,
bfd_generic_archive_p,
MY_core_file_p
},
{ /* bfd_set_format. */
_bfd_bool_bfd_false_error,
MY_mkobject,
_bfd_generic_mkarchive,
_bfd_bool_bfd_false_error
},
{ /* bfd_write_contents. */
_bfd_bool_bfd_false_error,
MY_write_object_contents,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
},
1999-05-03 09:29:11 +02:00
BFD_JUMP_TABLE_GENERIC (MY),
BFD_JUMP_TABLE_COPY (MY),
BFD_JUMP_TABLE_CORE (MY),
BFD_JUMP_TABLE_ARCHIVE (MY),
BFD_JUMP_TABLE_SYMBOLS (MY),
BFD_JUMP_TABLE_RELOCS (MY),
BFD_JUMP_TABLE_WRITE (MY),
BFD_JUMP_TABLE_LINK (MY),
BFD_JUMP_TABLE_DYNAMIC (MY),
2005-04-11 10:23:05 +02:00
/* Alternative_target. */
NULL,
2005-04-11 10:23:05 +02:00
MY_backend_data
1999-05-03 09:29:11 +02:00
};
#endif /* MY_BFD_TARGET */