binutils-gdb/bfd/elflink.c

13705 lines
393 KiB
C
Raw Normal View History

1999-05-03 09:29:11 +02:00
/* ELF linking support for BFD.
2016-01-01 12:25:12 +01:00
Copyright (C) 1995-2016 Free Software Foundation, Inc.
1999-05-03 09:29:11 +02:00
This file is part of BFD, the Binary File Descriptor library.
1999-05-03 09:29:11 +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
(at your option) any later version.
1999-05-03 09:29:11 +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
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 "sysdep.h"
#include "bfd.h"
#include "bfd_stdint.h"
1999-05-03 09:29:11 +02:00
#include "bfdlink.h"
#include "libbfd.h"
#define ARCH_SIZE 0
#include "elf-bfd.h"
#include "safe-ctype.h"
#include "libiberty.h"
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
#include "objalloc.h"
1999-05-03 09:29:11 +02:00
/* This struct is used to pass information to routines called via
elf_link_hash_traverse which must return failure. */
struct elf_info_failed
{
struct bfd_link_info *info;
bfd_boolean failed;
};
/* This structure is used to pass information to
_bfd_elf_link_find_version_dependencies. */
struct elf_find_verdep_info
{
/* General link information. */
struct bfd_link_info *info;
/* The number of dependencies. */
unsigned int vers;
/* Whether we had a failure. */
bfd_boolean failed;
};
static bfd_boolean _bfd_elf_fix_symbol_flags
(struct elf_link_hash_entry *, struct elf_info_failed *);
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
asection *
_bfd_elf_section_for_symbol (struct elf_reloc_cookie *cookie,
unsigned long r_symndx,
bfd_boolean discard)
{
if (r_symndx >= cookie->locsymcount
|| ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
{
struct elf_link_hash_entry *h;
h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& discarded_section (h->root.u.def.section))
return h->root.u.def.section;
else
return NULL;
}
else
{
/* It's not a relocation against a global symbol,
but it could be a relocation against a local
symbol for a discarded section. */
asection *isec;
Elf_Internal_Sym *isym;
/* Need to: get the symbol; get the section. */
isym = &cookie->locsyms[r_symndx];
isec = bfd_section_from_elf_index (cookie->abfd, isym->st_shndx);
if (isec != NULL
&& discard ? discarded_section (isec) : 1)
return isec;
}
return NULL;
}
/* Define a symbol in a dynamic linkage section. */
struct elf_link_hash_entry *
_bfd_elf_define_linkage_sym (bfd *abfd,
struct bfd_link_info *info,
asection *sec,
const char *name)
{
struct elf_link_hash_entry *h;
struct bfd_link_hash_entry *bh;
const struct elf_backend_data *bed;
h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE);
if (h != NULL)
{
/* Zap symbol defined in an as-needed lib that wasn't linked.
This is a symptom of a larger problem: Absolute symbols
defined in shared libraries can't be overridden, because we
lose the link to the bfd which is via the symbol section. */
h->root.type = bfd_link_hash_new;
}
bh = &h->root;
bed = get_elf_backend_data (abfd);
if (!_bfd_generic_link_add_one_symbol (info, abfd, name, BSF_GLOBAL,
sec, 0, NULL, FALSE, bed->collect,
&bh))
return NULL;
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
h->non_elf = 0;
h->root.linker_def = 1;
h->type = STT_OBJECT;
if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
return h;
}
bfd_boolean
_bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
1999-05-03 09:29:11 +02:00
{
flagword flags;
asection *s;
1999-05-03 09:29:11 +02:00
struct elf_link_hash_entry *h;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
2009-06-16 H.J. Lu <hongjiu.lu@intel.com> * configure.in (elf): Add elf-ifunc.lo. * configure: Regenerated. * Makefile.in: Likewise. * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. * elf32-i386.c (elf_i386_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf_i386_link_hash_table_create): Likewise. (elf_i386_create_dynamic_sections): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_create_got_section): Removed. * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf64_x86_64_compute_jump_table_size): Updated. (elf64_x86_64_link_hash_table_create): Likewise. (elf64_x86_64_create_dynamic_sections): Likewise. (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_finish_dynamic_sections): Likewise. (elf64_x86_64_create_got_section): Removed. * elflink.c (_bfd_elf_create_got_section): Use log_file_align for pointer alignment. Set up section pointers. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_create_ifunc_sections): Moved to ... * elf-ifunc.c: Here. New. * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo. (BFD32_BACKENDS_CFILES): Add elf-ifunc.c. Run "make dep-am".
2009-06-16 15:41:10 +02:00
struct elf_link_hash_table *htab = elf_hash_table (info);
1999-05-03 09:29:11 +02:00
/* This function may be called more than once. */
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (abfd, ".got");
if (s != NULL)
return TRUE;
1999-05-03 09:29:11 +02:00
* config.bfd (arm*-*-symbianelf*): Use OS-specific target vectors. * configure.in (bfd_elf32_bigarm_symbian_vec): Add it. (bfd_elf32_littlearm_symbian_vec): Likewise. * configure: Regenerated. * elf-bfd.h (elf_backend_data): Add dynamic_sec_flags. * elf32-arm.h (PLT_HEADER_SIZE): Do not define. (PLT_ENTRY_SIZE): Likewise. (bfd_vma_elf32_arm_symbian_plt_entry): New variable. (elf32_arm_link_hash_table): Add plt_header_size, plt_entry_size, and symbian_p. (create_got_section): Don't create sections when generating BPABI objects. (elf32_arm_create_dynamic_sections): Tidy. (elf32_arm_link_hash_table_create): Set plt_header_size, plt_entry_size, and symbian_p. (elf32_arm_check_relocs): Do not mark .rel.dyn as loadable when generating BPABI objects. (allocate_dynrelocs): Use htab->plt_header_size, not PLT_HEADER_SIZE. Do not add to .got.plt when generating BPABI objects. (elf32_arm_finish_dynamic_symbol): Generate Symbian OS PLTs. * elfarm-nabi.c: Add SymbianOS target vectors. * elflink.c (_bfd_elf_create_got_section): Use dynamic_sec_flags. (_bfd_elf_link_create_dynamic_sections): Likewise. * elfxx-target.h (ELF_DYNAMIC_SEC_FLAGS): New macro. (elfNN_bed): Use it. * targets.c (bfd_elf32_bigarm_symbian_vec): New variable. (bfd_elf32_littlearm_symbian_vec): Likewise. (_bfd_target_vector): Add them. * Makefile.am (TARG_ENV_HFILES): Add te-symbian.h. * Makefile.in: Regenerated. * configure.in: Set em for arm*-*-symbianelf*. * configure: Regenerated. * config/tc-arm.c (elf32_arm_target_format): Use Symbian target vectors when appropriate. * config/te-symbian.h: New file. * Makefile.am (ALL_EMULATIONS): Add earmsymbian.o. (earmsymbian.c): New target. * configure.tgt: Use armsymbian emulation for arm*-*-symbianelf*. * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. * emulparams/armsymbian.sh: New file.
2004-09-03 19:15:44 +02:00
flags = bed->dynamic_sec_flags;
1999-05-03 09:29:11 +02:00
s = bfd_make_section_anyway_with_flags (abfd,
(bed->rela_plts_and_copies_p
? ".rela.got" : ".rel.got"),
(bed->dynamic_sec_flags
| SEC_READONLY));
2009-06-16 H.J. Lu <hongjiu.lu@intel.com> * configure.in (elf): Add elf-ifunc.lo. * configure: Regenerated. * Makefile.in: Likewise. * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. * elf32-i386.c (elf_i386_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf_i386_link_hash_table_create): Likewise. (elf_i386_create_dynamic_sections): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_create_got_section): Removed. * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf64_x86_64_compute_jump_table_size): Updated. (elf64_x86_64_link_hash_table_create): Likewise. (elf64_x86_64_create_dynamic_sections): Likewise. (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_finish_dynamic_sections): Likewise. (elf64_x86_64_create_got_section): Removed. * elflink.c (_bfd_elf_create_got_section): Use log_file_align for pointer alignment. Set up section pointers. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_create_ifunc_sections): Moved to ... * elf-ifunc.c: Here. New. * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo. (BFD32_BACKENDS_CFILES): Add elf-ifunc.c. Run "make dep-am".
2009-06-16 15:41:10 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
htab->srelgot = s;
1999-05-03 09:29:11 +02:00
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
htab->sgot = s;
1999-05-03 09:29:11 +02:00
if (bed->want_got_plt)
{
s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
1999-05-03 09:29:11 +02:00
if (s == NULL
2009-06-16 H.J. Lu <hongjiu.lu@intel.com> * configure.in (elf): Add elf-ifunc.lo. * configure: Regenerated. * Makefile.in: Likewise. * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. * elf32-i386.c (elf_i386_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf_i386_link_hash_table_create): Likewise. (elf_i386_create_dynamic_sections): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_create_got_section): Removed. * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf64_x86_64_compute_jump_table_size): Updated. (elf64_x86_64_link_hash_table_create): Likewise. (elf64_x86_64_create_dynamic_sections): Likewise. (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_finish_dynamic_sections): Likewise. (elf64_x86_64_create_got_section): Removed. * elflink.c (_bfd_elf_create_got_section): Use log_file_align for pointer alignment. Set up section pointers. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_create_ifunc_sections): Moved to ... * elf-ifunc.c: Here. New. * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo. (BFD32_BACKENDS_CFILES): Add elf-ifunc.c. Run "make dep-am".
2009-06-16 15:41:10 +02:00
|| !bfd_set_section_alignment (abfd, s,
bed->s->log_file_align))
return FALSE;
2009-06-16 H.J. Lu <hongjiu.lu@intel.com> * configure.in (elf): Add elf-ifunc.lo. * configure: Regenerated. * Makefile.in: Likewise. * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. * elf32-i386.c (elf_i386_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf_i386_link_hash_table_create): Likewise. (elf_i386_create_dynamic_sections): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_create_got_section): Removed. * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf64_x86_64_compute_jump_table_size): Updated. (elf64_x86_64_link_hash_table_create): Likewise. (elf64_x86_64_create_dynamic_sections): Likewise. (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_finish_dynamic_sections): Likewise. (elf64_x86_64_create_got_section): Removed. * elflink.c (_bfd_elf_create_got_section): Use log_file_align for pointer alignment. Set up section pointers. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_create_ifunc_sections): Moved to ... * elf-ifunc.c: Here. New. * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo. (BFD32_BACKENDS_CFILES): Add elf-ifunc.c. Run "make dep-am".
2009-06-16 15:41:10 +02:00
htab->sgotplt = s;
1999-05-03 09:29:11 +02:00
}
/* The first bit of the global offset table is the header. */
s->size += bed->got_header_size;
if (bed->want_got_sym)
{
/* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
(or .got.plt) section. We don't do this in the linker script
because we don't want to define the symbol if we are not creating
a global offset table. */
2009-06-16 H.J. Lu <hongjiu.lu@intel.com> * configure.in (elf): Add elf-ifunc.lo. * configure: Regenerated. * Makefile.in: Likewise. * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. * elf32-i386.c (elf_i386_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf_i386_link_hash_table_create): Likewise. (elf_i386_create_dynamic_sections): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_create_got_section): Removed. * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf64_x86_64_compute_jump_table_size): Updated. (elf64_x86_64_link_hash_table_create): Likewise. (elf64_x86_64_create_dynamic_sections): Likewise. (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_finish_dynamic_sections): Likewise. (elf64_x86_64_create_got_section): Removed. * elflink.c (_bfd_elf_create_got_section): Use log_file_align for pointer alignment. Set up section pointers. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_create_ifunc_sections): Moved to ... * elf-ifunc.c: Here. New. * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo. (BFD32_BACKENDS_CFILES): Add elf-ifunc.c. Run "make dep-am".
2009-06-16 15:41:10 +02:00
h = _bfd_elf_define_linkage_sym (abfd, info, s,
"_GLOBAL_OFFSET_TABLE_");
elf_hash_table (info)->hgot = h;
if (h == NULL)
return FALSE;
}
1999-05-03 09:29:11 +02:00
return TRUE;
1999-05-03 09:29:11 +02:00
}
/* Create a strtab to hold the dynamic symbol names. */
static bfd_boolean
_bfd_elf_link_create_dynstrtab (bfd *abfd, struct bfd_link_info *info)
{
struct elf_link_hash_table *hash_table;
hash_table = elf_hash_table (info);
if (hash_table->dynobj == NULL)
hash_table->dynobj = abfd;
if (hash_table->dynstr == NULL)
{
hash_table->dynstr = _bfd_elf_strtab_init ();
if (hash_table->dynstr == NULL)
return FALSE;
}
return TRUE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Create some sections which will be filled in with dynamic linking
information. ABFD is an input file which requires dynamic sections
to be created. The dynamic sections take up virtual memory space
when the final executable is run, so we need to create them before
addresses are assigned to the output sections. We work out the
actual contents and size of these sections later. */
1999-05-03 09:29:11 +02:00
bfd_boolean
_bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
1999-05-03 09:29:11 +02:00
{
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
flagword flags;
asection *s;
const struct elf_backend_data *bed;
Add hdynamic to elf_link_hash_table for _DYNAMIC * elf-bfd.h (elf_link_hash_table): Add hdynamic for the _DYNAMIC symbol. * elflink.c (_bfd_elf_link_create_dynamic_sections): Set hdynamic. * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Check hdynamic instead of "_DYNAMIC". * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise. * elf32-cr16.c (elf32_arm_finish_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_convert_mov_to_lea): Likewise. * elf32-lm32.c (lm32_elf_finish_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise. * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise. * elf64-aarch64.c elf64_aarch64_finish_dynamic_symbol(): Likewise. * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise. * elf64-ia64-vms.c (elf64_ia64_finish_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise. * elfnn-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise. * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Check hdynamic, hgot, hplt instead of _DYNAMIC, _GLOBAL_OFFSET_TABLE_, _PROCEDURE_LINKAGE_TABLE_. * elf32-score.c (s3_bfd_score_elf_finish_dynamic_symbol): Likewise. * elf32-score7.c (s7_bfd_score_elf_finish_dynamic_symbol): Likewise.
2012-09-02 14:17:27 +02:00
struct elf_link_hash_entry *h;
1999-05-03 09:29:11 +02:00
* elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg. * elf.c (_bfd_elf_merge_sections): Adjust to suit. (_bfd_elf_link_just_syms): Likewise. (bfd_elf_get_needed_list): Likewise. (bfd_elf_get_runpath_list): Likewise. (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens. * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab creator flavour. (elf32_hppa_set_gp): Look up output sections rather than using htab. * elf32-i960.c: Comment fix. Formatting. * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table rather than testing creator flavour. * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise. * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for is_elf_hash_table change. Remove redundant test. (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than testing creator flavour. (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant checks. Use is_elf_hash_table rather than testing creator flavour. Use hash_table throughout in place of info->hash. (elf_add_dynamic_entry): Adjust for is_elf_hash_table change. (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant check. (elf_bfd_final_link): Adjust for is_elf_hash_table change. (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than testing creator flavour. (elf_gc_sections): Add is_elf_hash_table check. (elf_gc_common_finalize_got_offsets): Likewise. (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove redundant check. * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table rather than testing creator flavour.
2003-12-01 07:28:24 +01:00
if (! is_elf_hash_table (info->hash))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
if (elf_hash_table (info)->dynamic_sections_created)
return TRUE;
if (!_bfd_elf_link_create_dynstrtab (abfd, info))
return FALSE;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
abfd = elf_hash_table (info)->dynobj;
* config.bfd (arm*-*-symbianelf*): Use OS-specific target vectors. * configure.in (bfd_elf32_bigarm_symbian_vec): Add it. (bfd_elf32_littlearm_symbian_vec): Likewise. * configure: Regenerated. * elf-bfd.h (elf_backend_data): Add dynamic_sec_flags. * elf32-arm.h (PLT_HEADER_SIZE): Do not define. (PLT_ENTRY_SIZE): Likewise. (bfd_vma_elf32_arm_symbian_plt_entry): New variable. (elf32_arm_link_hash_table): Add plt_header_size, plt_entry_size, and symbian_p. (create_got_section): Don't create sections when generating BPABI objects. (elf32_arm_create_dynamic_sections): Tidy. (elf32_arm_link_hash_table_create): Set plt_header_size, plt_entry_size, and symbian_p. (elf32_arm_check_relocs): Do not mark .rel.dyn as loadable when generating BPABI objects. (allocate_dynrelocs): Use htab->plt_header_size, not PLT_HEADER_SIZE. Do not add to .got.plt when generating BPABI objects. (elf32_arm_finish_dynamic_symbol): Generate Symbian OS PLTs. * elfarm-nabi.c: Add SymbianOS target vectors. * elflink.c (_bfd_elf_create_got_section): Use dynamic_sec_flags. (_bfd_elf_link_create_dynamic_sections): Likewise. * elfxx-target.h (ELF_DYNAMIC_SEC_FLAGS): New macro. (elfNN_bed): Use it. * targets.c (bfd_elf32_bigarm_symbian_vec): New variable. (bfd_elf32_littlearm_symbian_vec): Likewise. (_bfd_target_vector): Add them. * Makefile.am (TARG_ENV_HFILES): Add te-symbian.h. * Makefile.in: Regenerated. * configure.in: Set em for arm*-*-symbianelf*. * configure: Regenerated. * config/tc-arm.c (elf32_arm_target_format): Use Symbian target vectors when appropriate. * config/te-symbian.h: New file. * Makefile.am (ALL_EMULATIONS): Add earmsymbian.o. (earmsymbian.c): New target. * configure.tgt: Use armsymbian emulation for arm*-*-symbianelf*. * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. * emulparams/armsymbian.sh: New file.
2004-09-03 19:15:44 +02:00
bed = get_elf_backend_data (abfd);
flags = bed->dynamic_sec_flags;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* A dynamically linked executable has a .interp section, but a
shared library does not. */
Add --no-dynamic-linker option to ld, for static PIE use Inhibits output of .interp section in ELF executables. include/ * bfdlink.h (struct bfd_link_info): Add "nointerp" field. bfd/ * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create .interp when info->nointerp. (bfd_elf_size_dynamic_sections): Adjust assert. * elf32-arm.c (elf32_arm_size_dynamic_sections): Don't size .interp when info->nointerp. * elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise. * elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise. * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise. * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise. * elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise. * elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise. * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise. * elf32-metag.c (elf_metag_size_dynamic_sections): Likewise. * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise. * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise. * elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise. * elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Likewise. * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise. * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise. * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise. * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise. * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise. * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise. * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise. * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise. * elfnn-ia64.c (elfNN_ia64_size_dynamic_sections): Likewise. * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise. ld/ * ld.texinfo (--no-dynamic-linker): Document. * ldlex.h (enum option_values): Add OPTION_NO_DYNAMIC_LINKER. * lexsup.c (ld_options, parse_args): Handle --no-dynamic-linker.
2015-09-20 04:50:19 +02:00
if (bfd_link_executable (info) && !info->nointerp)
1999-05-03 09:29:11 +02:00
{
s = bfd_make_section_anyway_with_flags (abfd, ".interp",
flags | SEC_READONLY);
2005-05-05 H.J. Lu <hongjiu.lu@intel.com> * section.c (bfd_make_section_anyway_with_flags): New. (bfd_make_section_anyway): Call bfd_make_section_anyway_with_flags, (bfd_make_section_with_flags): New. (bfd_make_section): Call bfd_make_section_with_flags. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Call bfd_make_section_with_flags/bfd_make_section_anyway_with_flags instead of bfd_make_section/bfd_make_section and don't call bfd_set_section_flags. (mn10300_elf_check_relocs): Likewise. (_bfd_mn10300_elf_create_dynamic_sections): Likewise. * elf32-arm.c (create_got_section): Likewise. (bfd_elf32_arm_add_glue_sections_to_bfd): Likewise. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_add_symbol_hook): Likewise. (_frv_create_got_section): Likewise. (elf32_frvfdpic_create_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_create_dynamic_sections): Likewise. (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_create_dynamic_sections): Likewise. (i370_elf_check_relocs): Likewise. * elf32-i386.c (create_got_section): Likewise. (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise. (create_got_section): Likewise. (m32r_elf_create_dynamic_sections): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_create_got): Likewise. (ppc_elf_create_dynamic_sections): Likewise. (ppc_elf_add_symbol_hook): Likewise. (ppc_elf_check_relocs): Likewise. * elf32-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf32-sh.c (create_got_section): Likewise. (sh_elf_create_dynamic_sections): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Likewise. (add_extra_plt_sections): Likewise. * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise. (elf64_alpha_create_got_section): Likewise. (elf64_alpha_create_dynamic_sections): Likewise. (elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. (get_opd): Likewise. (get_plt): Likewise. (get_dlt): Likewise. (get_stub): Likewise. (elf64_hppa_create_dynamic_sectionso): Likewise. * elf64-mmix.c (mmix_elf_check_common_relocs): Likewise. * elf64-ppc.c (create_linkage_sections): Likewise. (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_check_relocs): Likewise. (sh64_elf64_create_dynamic_sections): Likewise. * elf64-x86-64.c (create_got_section): Likewise. (elf64_x86_64_check_relocs): Likewise. * elflink.c (_bfd_elf_create_got_section): Likewise. (_bfd_elf_link_create_dynamic_sections): Likewise. (elf_link_add_object_symbols): Likewise. * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise. (elfNN_ia64_create_dynamic_sections): Likewise. (get_fptr): Likewise. (get_pltoff): Likewise. (get_reloc_section): Likewise. (elfNN_ia64_object_p): Likewise. * elfxx-mips.c (mips_elf_rel_dyn_section): Likewise. (mips_elf_create_compact_rel_section): Likewise. (mips_elf_create_got_section): Likewise. (_bfd_mips_elf_create_dynamic_sections): Likewise. * elfxx-sparc.c (create_got_section): Likewise. (_bfd_sparc_elf_check_relocs): Likewise. * elf.c (_bfd_elf_new_section_hook): Call _bfd_elf_get_sec_type_attr on linker created sections.
2005-05-05 16:34:04 +02:00
if (s == NULL)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Create sections to hold version informations. These are removed
if they are not needed. */
s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_d",
flags | SEC_READONLY);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version",
flags | SEC_READONLY);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 1))
return FALSE;
s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_r",
flags | SEC_READONLY);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
s = bfd_make_section_anyway_with_flags (abfd, ".dynsym",
flags | SEC_READONLY);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
elf_hash_table (info)->dynsym = s;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
s = bfd_make_section_anyway_with_flags (abfd, ".dynstr",
flags | SEC_READONLY);
2005-05-05 H.J. Lu <hongjiu.lu@intel.com> * section.c (bfd_make_section_anyway_with_flags): New. (bfd_make_section_anyway): Call bfd_make_section_anyway_with_flags, (bfd_make_section_with_flags): New. (bfd_make_section): Call bfd_make_section_with_flags. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Call bfd_make_section_with_flags/bfd_make_section_anyway_with_flags instead of bfd_make_section/bfd_make_section and don't call bfd_set_section_flags. (mn10300_elf_check_relocs): Likewise. (_bfd_mn10300_elf_create_dynamic_sections): Likewise. * elf32-arm.c (create_got_section): Likewise. (bfd_elf32_arm_add_glue_sections_to_bfd): Likewise. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_add_symbol_hook): Likewise. (_frv_create_got_section): Likewise. (elf32_frvfdpic_create_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_create_dynamic_sections): Likewise. (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_create_dynamic_sections): Likewise. (i370_elf_check_relocs): Likewise. * elf32-i386.c (create_got_section): Likewise. (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise. (create_got_section): Likewise. (m32r_elf_create_dynamic_sections): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_create_got): Likewise. (ppc_elf_create_dynamic_sections): Likewise. (ppc_elf_add_symbol_hook): Likewise. (ppc_elf_check_relocs): Likewise. * elf32-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf32-sh.c (create_got_section): Likewise. (sh_elf_create_dynamic_sections): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Likewise. (add_extra_plt_sections): Likewise. * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise. (elf64_alpha_create_got_section): Likewise. (elf64_alpha_create_dynamic_sections): Likewise. (elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. (get_opd): Likewise. (get_plt): Likewise. (get_dlt): Likewise. (get_stub): Likewise. (elf64_hppa_create_dynamic_sectionso): Likewise. * elf64-mmix.c (mmix_elf_check_common_relocs): Likewise. * elf64-ppc.c (create_linkage_sections): Likewise. (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_check_relocs): Likewise. (sh64_elf64_create_dynamic_sections): Likewise. * elf64-x86-64.c (create_got_section): Likewise. (elf64_x86_64_check_relocs): Likewise. * elflink.c (_bfd_elf_create_got_section): Likewise. (_bfd_elf_link_create_dynamic_sections): Likewise. (elf_link_add_object_symbols): Likewise. * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise. (elfNN_ia64_create_dynamic_sections): Likewise. (get_fptr): Likewise. (get_pltoff): Likewise. (get_reloc_section): Likewise. (elfNN_ia64_object_p): Likewise. * elfxx-mips.c (mips_elf_rel_dyn_section): Likewise. (mips_elf_create_compact_rel_section): Likewise. (mips_elf_create_got_section): Likewise. (_bfd_mips_elf_create_dynamic_sections): Likewise. * elfxx-sparc.c (create_got_section): Likewise. (_bfd_sparc_elf_check_relocs): Likewise. * elf.c (_bfd_elf_new_section_hook): Call _bfd_elf_get_sec_type_attr on linker created sections.
2005-05-05 16:34:04 +02:00
if (s == NULL)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
s = bfd_make_section_anyway_with_flags (abfd, ".dynamic", flags);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
/* The special symbol _DYNAMIC is always set to the start of the
.dynamic section. We could set _DYNAMIC in a linker script, but we
only want to define it if we are, in fact, creating a .dynamic
section. We don't want to define it if there is no .dynamic
section, since on some ELF platforms the start up code examines it
to decide how to initialize the process. */
Add hdynamic to elf_link_hash_table for _DYNAMIC * elf-bfd.h (elf_link_hash_table): Add hdynamic for the _DYNAMIC symbol. * elflink.c (_bfd_elf_link_create_dynamic_sections): Set hdynamic. * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Check hdynamic instead of "_DYNAMIC". * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise. * elf32-cr16.c (elf32_arm_finish_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_convert_mov_to_lea): Likewise. * elf32-lm32.c (lm32_elf_finish_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise. * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise. * elf64-aarch64.c elf64_aarch64_finish_dynamic_symbol(): Likewise. * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise. * elf64-ia64-vms.c (elf64_ia64_finish_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise. * elfnn-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise. * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Check hdynamic, hgot, hplt instead of _DYNAMIC, _GLOBAL_OFFSET_TABLE_, _PROCEDURE_LINKAGE_TABLE_. * elf32-score.c (s3_bfd_score_elf_finish_dynamic_symbol): Likewise. * elf32-score7.c (s7_bfd_score_elf_finish_dynamic_symbol): Likewise.
2012-09-02 14:17:27 +02:00
h = _bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC");
elf_hash_table (info)->hdynamic = h;
if (h == NULL)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (info->emit_hash)
{
s = bfd_make_section_anyway_with_flags (abfd, ".hash",
flags | SEC_READONLY);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
}
if (info->emit_gnu_hash)
{
s = bfd_make_section_anyway_with_flags (abfd, ".gnu.hash",
flags | SEC_READONLY);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
/* For 64-bit ELF, .gnu.hash is a non-uniform entity size section:
4 32-bit words followed by variable count of 64-bit words, then
variable count of 32-bit words. */
if (bed->s->arch_size == 64)
elf_section_data (s)->this_hdr.sh_entsize = 0;
else
elf_section_data (s)->this_hdr.sh_entsize = 4;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Let the backend create the rest of the sections. This lets the
backend set the right flags. The backend will normally create
the .got and .plt sections. */
if (bed->elf_backend_create_dynamic_sections == NULL
|| ! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
elf_hash_table (info)->dynamic_sections_created = TRUE;
return TRUE;
}
/* Create dynamic sections when linking against a dynamic object. */
bfd_boolean
_bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
flagword flags, pltflags;
struct elf_link_hash_entry *h;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
asection *s;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
2009-06-16 H.J. Lu <hongjiu.lu@intel.com> * configure.in (elf): Add elf-ifunc.lo. * configure: Regenerated. * Makefile.in: Likewise. * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. * elf32-i386.c (elf_i386_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf_i386_link_hash_table_create): Likewise. (elf_i386_create_dynamic_sections): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_create_got_section): Removed. * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf64_x86_64_compute_jump_table_size): Updated. (elf64_x86_64_link_hash_table_create): Likewise. (elf64_x86_64_create_dynamic_sections): Likewise. (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_finish_dynamic_sections): Likewise. (elf64_x86_64_create_got_section): Removed. * elflink.c (_bfd_elf_create_got_section): Use log_file_align for pointer alignment. Set up section pointers. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_create_ifunc_sections): Moved to ... * elf-ifunc.c: Here. New. * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo. (BFD32_BACKENDS_CFILES): Add elf-ifunc.c. Run "make dep-am".
2009-06-16 15:41:10 +02:00
struct elf_link_hash_table *htab = elf_hash_table (info);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
1999-05-03 09:29:11 +02:00
/* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
.rel[a].bss sections. */
* config.bfd (arm*-*-symbianelf*): Use OS-specific target vectors. * configure.in (bfd_elf32_bigarm_symbian_vec): Add it. (bfd_elf32_littlearm_symbian_vec): Likewise. * configure: Regenerated. * elf-bfd.h (elf_backend_data): Add dynamic_sec_flags. * elf32-arm.h (PLT_HEADER_SIZE): Do not define. (PLT_ENTRY_SIZE): Likewise. (bfd_vma_elf32_arm_symbian_plt_entry): New variable. (elf32_arm_link_hash_table): Add plt_header_size, plt_entry_size, and symbian_p. (create_got_section): Don't create sections when generating BPABI objects. (elf32_arm_create_dynamic_sections): Tidy. (elf32_arm_link_hash_table_create): Set plt_header_size, plt_entry_size, and symbian_p. (elf32_arm_check_relocs): Do not mark .rel.dyn as loadable when generating BPABI objects. (allocate_dynrelocs): Use htab->plt_header_size, not PLT_HEADER_SIZE. Do not add to .got.plt when generating BPABI objects. (elf32_arm_finish_dynamic_symbol): Generate Symbian OS PLTs. * elfarm-nabi.c: Add SymbianOS target vectors. * elflink.c (_bfd_elf_create_got_section): Use dynamic_sec_flags. (_bfd_elf_link_create_dynamic_sections): Likewise. * elfxx-target.h (ELF_DYNAMIC_SEC_FLAGS): New macro. (elfNN_bed): Use it. * targets.c (bfd_elf32_bigarm_symbian_vec): New variable. (bfd_elf32_littlearm_symbian_vec): Likewise. (_bfd_target_vector): Add them. * Makefile.am (TARG_ENV_HFILES): Add te-symbian.h. * Makefile.in: Regenerated. * configure.in: Set em for arm*-*-symbianelf*. * configure: Regenerated. * config/tc-arm.c (elf32_arm_target_format): Use Symbian target vectors when appropriate. * config/te-symbian.h: New file. * Makefile.am (ALL_EMULATIONS): Add earmsymbian.o. (earmsymbian.c): New target. * configure.tgt: Use armsymbian emulation for arm*-*-symbianelf*. * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. * emulparams/armsymbian.sh: New file.
2004-09-03 19:15:44 +02:00
flags = bed->dynamic_sec_flags;
1999-05-03 09:29:11 +02:00
pltflags = flags;
if (bed->plt_not_loaded)
/* We do not clear SEC_ALLOC here because we still want the OS to
allocate space for the section; it's just that there's nothing
to read in from the object file. */
* elflink.c (_bfd_elf_create_dynamic_sections): Don't set SEC_CODE when plt_not_loaded. * elf64-ppc.c (ppc64_elf_create_dynamic_sections): No need to clear .plt SEC_CODE here. Create .stub and correct .glink flags. (PLT_INITIAL_ENTRY_SIZE): Set to 24. (ppc64_elf_glink_code): Delete. (PPC64_ELF_GLINK_SIZE): Delete. (ADDIS_R12_R2, STD_R2_40R1, LD_R11_0R12, LD_R2_0R12, MTCTR_R11, BCTR, ADDIS_R12_R12_1, LD_R2_40R1, NOP, LI_R0_0, B_DOT, LIS_R0_0, ORI_R0_R0_0): Define. (PLT_CALL_STUB_SIZE, GLINK_CALL_STUB_SIZE): Define. (struct ppc_link_hash_table): Add sstub and plt_overflow. (ppc64_elf_link_hash_table_create): Init them. (ppc64_elf_check_relocs <R_PPC64_REL24>): Refcount .plt entry. Don't copy to shared lib. (ppc64_elf_check_relocs): Call bfd_set_error on errors. (ppc64_elf_gc_sweep_hook <R_PPC64_REL24>): Sweep plt refcount. (allocate_dynrelocs <plt>): Don't change function sym here. Make room for .stub and .glink code. (ppc64_elf_size_dynamic_sections): Handle .stub. Make entry for DT_PPC64_GLINK. (ppc64_elf_final_link): Rename to ppc64_elf_set_toc. Don't call bfd_elf64_bfd_final_link. (bfd_elf64_bfd_final_link): Don't define. (ppc64_elf_size_stubs): New. (build_plt_stub): New. (build_one_stub): New. (ppc64_elf_build_stubs): New. (ppc64_elf_relocate_section <toc relocs>): Remove assert. (ppc64_elf_relocate_section): Don't copy R_PPC64_REL24 relocs. (ppc64_elf_finish_dynamic_symbol): Don't build stubs here. Set DT_PPC64_GLINK entry. Tweak DT_PLTGOT, DT_JMPREL, DT_PLTRELSZ in case output sections not separate. Adjust DT_RELASZ to not include plt relocs. Set reserved got entry. Set got and plt entry size. (elf_backend_got_header_size): Set to 8. * elf64-ppc.h: New file.
2002-01-16 06:50:03 +01:00
pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
else
pltflags |= SEC_ALLOC | SEC_CODE | SEC_LOAD;
1999-05-03 09:29:11 +02:00
if (bed->plt_readonly)
pltflags |= SEC_READONLY;
s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
1999-05-03 09:29:11 +02:00
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE;
2009-06-16 H.J. Lu <hongjiu.lu@intel.com> * configure.in (elf): Add elf-ifunc.lo. * configure: Regenerated. * Makefile.in: Likewise. * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. * elf32-i386.c (elf_i386_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf_i386_link_hash_table_create): Likewise. (elf_i386_create_dynamic_sections): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_create_got_section): Removed. * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf64_x86_64_compute_jump_table_size): Updated. (elf64_x86_64_link_hash_table_create): Likewise. (elf64_x86_64_create_dynamic_sections): Likewise. (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_finish_dynamic_sections): Likewise. (elf64_x86_64_create_got_section): Removed. * elflink.c (_bfd_elf_create_got_section): Use log_file_align for pointer alignment. Set up section pointers. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_create_ifunc_sections): Moved to ... * elf-ifunc.c: Here. New. * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo. (BFD32_BACKENDS_CFILES): Add elf-ifunc.c. Run "make dep-am".
2009-06-16 15:41:10 +02:00
htab->splt = s;
1999-05-03 09:29:11 +02:00
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
.plt section. */
if (bed->want_plt_sym)
{
h = _bfd_elf_define_linkage_sym (abfd, info, s,
"_PROCEDURE_LINKAGE_TABLE_");
elf_hash_table (info)->hplt = h;
if (h == NULL)
return FALSE;
}
1999-05-03 09:29:11 +02:00
s = bfd_make_section_anyway_with_flags (abfd,
(bed->rela_plts_and_copies_p
? ".rela.plt" : ".rel.plt"),
flags | SEC_READONLY);
1999-05-03 09:29:11 +02:00
if (s == NULL
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
2009-06-16 H.J. Lu <hongjiu.lu@intel.com> * configure.in (elf): Add elf-ifunc.lo. * configure: Regenerated. * Makefile.in: Likewise. * elf-bfd.h (elf_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. * elf32-i386.c (elf_i386_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf_i386_link_hash_table_create): Likewise. (elf_i386_create_dynamic_sections): Likewise. (elf_i386_check_relocs): Likewise. (elf_i386_allocate_dynrelocs): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. (elf_i386_finish_dynamic_sections): Likewise. (elf_i386_create_got_section): Removed. * elf64-x86-64.c (elf64_x86_64_link_hash_table): Remove sgot, sgotplt, srelgot, splt, srelplt, igotplt, iplt, irelplt and irelifunc. (elf64_x86_64_compute_jump_table_size): Updated. (elf64_x86_64_link_hash_table_create): Likewise. (elf64_x86_64_create_dynamic_sections): Likewise. (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_finish_dynamic_sections): Likewise. (elf64_x86_64_create_got_section): Removed. * elflink.c (_bfd_elf_create_got_section): Use log_file_align for pointer alignment. Set up section pointers. (_bfd_elf_create_dynamic_sections): Likewise. (_bfd_elf_create_ifunc_sections): Moved to ... * elf-ifunc.c: Here. New. * Makefile.am (BFD32_BACKENDS): Add elf-ifunc.lo. (BFD32_BACKENDS_CFILES): Add elf-ifunc.c. Run "make dep-am".
2009-06-16 15:41:10 +02:00
htab->srelplt = s;
1999-05-03 09:29:11 +02:00
if (! _bfd_elf_create_got_section (abfd, info))
return FALSE;
1999-05-03 09:29:11 +02:00
if (bed->want_dynbss)
{
/* The .dynbss section is a place to put symbols which are defined
by dynamic objects, are referenced by regular objects, and are
not functions. We must allocate space for them in the process
image and use a R_*_COPY reloc to tell the dynamic linker to
initialize them at run time. The linker script puts the .dynbss
section into the .bss section of the final image. */
s = bfd_make_section_anyway_with_flags (abfd, ".dynbss",
(SEC_ALLOC | SEC_LINKER_CREATED));
2005-05-05 H.J. Lu <hongjiu.lu@intel.com> * section.c (bfd_make_section_anyway_with_flags): New. (bfd_make_section_anyway): Call bfd_make_section_anyway_with_flags, (bfd_make_section_with_flags): New. (bfd_make_section): Call bfd_make_section_with_flags. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Call bfd_make_section_with_flags/bfd_make_section_anyway_with_flags instead of bfd_make_section/bfd_make_section and don't call bfd_set_section_flags. (mn10300_elf_check_relocs): Likewise. (_bfd_mn10300_elf_create_dynamic_sections): Likewise. * elf32-arm.c (create_got_section): Likewise. (bfd_elf32_arm_add_glue_sections_to_bfd): Likewise. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_add_symbol_hook): Likewise. (_frv_create_got_section): Likewise. (elf32_frvfdpic_create_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_create_dynamic_sections): Likewise. (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_create_dynamic_sections): Likewise. (i370_elf_check_relocs): Likewise. * elf32-i386.c (create_got_section): Likewise. (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise. (create_got_section): Likewise. (m32r_elf_create_dynamic_sections): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_create_got): Likewise. (ppc_elf_create_dynamic_sections): Likewise. (ppc_elf_add_symbol_hook): Likewise. (ppc_elf_check_relocs): Likewise. * elf32-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf32-sh.c (create_got_section): Likewise. (sh_elf_create_dynamic_sections): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Likewise. (add_extra_plt_sections): Likewise. * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise. (elf64_alpha_create_got_section): Likewise. (elf64_alpha_create_dynamic_sections): Likewise. (elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. (get_opd): Likewise. (get_plt): Likewise. (get_dlt): Likewise. (get_stub): Likewise. (elf64_hppa_create_dynamic_sectionso): Likewise. * elf64-mmix.c (mmix_elf_check_common_relocs): Likewise. * elf64-ppc.c (create_linkage_sections): Likewise. (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_check_relocs): Likewise. (sh64_elf64_create_dynamic_sections): Likewise. * elf64-x86-64.c (create_got_section): Likewise. (elf64_x86_64_check_relocs): Likewise. * elflink.c (_bfd_elf_create_got_section): Likewise. (_bfd_elf_link_create_dynamic_sections): Likewise. (elf_link_add_object_symbols): Likewise. * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise. (elfNN_ia64_create_dynamic_sections): Likewise. (get_fptr): Likewise. (get_pltoff): Likewise. (get_reloc_section): Likewise. (elfNN_ia64_object_p): Likewise. * elfxx-mips.c (mips_elf_rel_dyn_section): Likewise. (mips_elf_create_compact_rel_section): Likewise. (mips_elf_create_got_section): Likewise. (_bfd_mips_elf_create_dynamic_sections): Likewise. * elfxx-sparc.c (create_got_section): Likewise. (_bfd_sparc_elf_check_relocs): Likewise. * elf.c (_bfd_elf_new_section_hook): Call _bfd_elf_get_sec_type_attr on linker created sections.
2005-05-05 16:34:04 +02:00
if (s == NULL)
return FALSE;
1999-05-03 09:29:11 +02:00
/* The .rel[a].bss section holds copy relocs. This section is not
normally needed. We need to create it here, though, so that the
linker will map it to an output section. We can't just create it
only if we need it, because we will not know whether we need it
until we have seen all the input files, and the first time the
main linker code calls BFD after examining all the input files
(size_dynamic_sections) the input sections have already been
mapped to the output sections. If the section turns out not to
be needed, we can discard it later. We will never need this
section when generating a shared object, since they do not use
copy relocs. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (! bfd_link_pic (info))
{
s = bfd_make_section_anyway_with_flags (abfd,
(bed->rela_plts_and_copies_p
? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY);
if (s == NULL
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
}
1999-05-03 09:29:11 +02:00
}
return TRUE;
1999-05-03 09:29:11 +02:00
}
/* Record a new dynamic symbol. We record the dynamic symbols as we
read the input files, since we need to have a list of all of them
before we can determine the final sizes of the output sections.
Note that we may actually call this function even though we are not
going to output any dynamic symbols; in some cases we know that a
symbol should be in the dynamic symbol table, but only if there is
one. */
bfd_boolean
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *h)
1999-05-03 09:29:11 +02:00
{
if (h->dynindx == -1)
{
* Makefile.am (BFD32_BACKENDS): Add elf-strtab.lo. (BFD32_BACKENDS_CFILES): Add elf-strtab.c. (elf-strtab.lo): Add rule. * Makefile.in: Rebuilt. * configure.in (elf): Add elf-strtab.lo. * configure: Rebuilt. * elf-bfd.h (elf_strtab_hash): Forward declare. (struct elf_link_hash_table): Change dynstr type to struct elf_strtab_hash *. (struct elf_obj_tdata): Change strtab_ptr type to struct elf_strtab_hash *. (_bfd_elf_strtab_init, _bfd_elf_strtab_free, _bfd_elf_strtab_add, _bfd_elf_strtab_addref, _bfd_elf_strtab_delref, _bfd_elf_strtab_clear_all_refs, _bfd_elf_strtab_size, _bfd_elf_strtab_offset, _bfd_elf_strtab_emit, _bfd_elf_strtab_finalize): New prototypes. * elf-strtab.c: New file. * elflink.h (elf_link_add_object_symbols): Use _bfd_elf_strtab_add and _bfd_elf_strtab_size instead of _bfd_stringtab calls. Call _bfd_elf_strtab_delref if DT_NEEDED entry is not needed or when forcing dynamic symbol to local. (elf_link_create_dynamic_sections): Call _bfd_elf_strtab_init instead of elf_stringtab_init. (elf_link_record_local_dynamic_symbol): Likewise, change dynstr type. Use _bfd_elf_strtab functions instead of _bfd_stringtab calls. (size_dynamic_sections): Use _bfd_elf_strtab functions instead of _bfd_stringtab calls. For DT_RUNPATH and Verdaux vda_name fields, call _bfd_elf_strtab_addref. Call elf_finalize_dynstr. (elf_adjust_dynstr_offsets, elf_finalize_dynstr): New functions. (elf_fix_symbol_flags): Call _bfd_elf_strtab_delref when forcing dynamic symbol to local. (elf_link_assign_sym_version): Likewise. (elf_bfd_final_link): Call _bfd_elf_strtab_emit instead of _bfd_stringtab_emit. * elflink.c (_bfd_elf_link_record_dynamic_symbol): Change dynstr type. Call _bfd_elf_strtab functions instead of _bfd_stringtab functions. * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise. * elf.c (_bfd_elf_init_reloc_shdr): Likewise. (elf_fake_sections): Likewise. (assign_section_numbers): Call _bfd_elf_strtab_clear_all_refs on shstrtab hash table, call _bfd_elf_strtab_addref on each section name in the output. Call _bfd_elf_strtab_finalize and use _bfd_elf_strtab_offset to finalize sh_name section header fields. (_bfd_elf_compute_section_file_positions): Use _bfd_elf_strtab_size instead of _bfd_stringtab_size. (prep_headers): Change shstrtab type. Use _bfd_elf_strtab calls instead of _bfd_stringtab calls.
2001-11-07 17:50:38 +01:00
struct elf_strtab_hash *dynstr;
char *p;
1999-05-03 09:29:11 +02:00
const char *name;
bfd_size_type indx;
/* XXX: The ABI draft says the linker must turn hidden and
internal symbols into STB_LOCAL symbols when producing the
DSO. However, if ld.so honors st_other in the dynamic table,
this would not be necessary. */
switch (ELF_ST_VISIBILITY (h->other))
{
case STV_INTERNAL:
case STV_HIDDEN:
if (h->root.type != bfd_link_hash_undefined
&& h->root.type != bfd_link_hash_undefweak)
{
2004-09-16 16:52:12 +02:00
h->forced_local = 1;
if (!elf_hash_table (info)->is_relocatable_executable)
return TRUE;
}
default:
break;
}
1999-05-03 09:29:11 +02:00
h->dynindx = elf_hash_table (info)->dynsymcount;
++elf_hash_table (info)->dynsymcount;
dynstr = elf_hash_table (info)->dynstr;
if (dynstr == NULL)
{
/* Create a strtab to hold the dynamic symbol names. */
* Makefile.am (BFD32_BACKENDS): Add elf-strtab.lo. (BFD32_BACKENDS_CFILES): Add elf-strtab.c. (elf-strtab.lo): Add rule. * Makefile.in: Rebuilt. * configure.in (elf): Add elf-strtab.lo. * configure: Rebuilt. * elf-bfd.h (elf_strtab_hash): Forward declare. (struct elf_link_hash_table): Change dynstr type to struct elf_strtab_hash *. (struct elf_obj_tdata): Change strtab_ptr type to struct elf_strtab_hash *. (_bfd_elf_strtab_init, _bfd_elf_strtab_free, _bfd_elf_strtab_add, _bfd_elf_strtab_addref, _bfd_elf_strtab_delref, _bfd_elf_strtab_clear_all_refs, _bfd_elf_strtab_size, _bfd_elf_strtab_offset, _bfd_elf_strtab_emit, _bfd_elf_strtab_finalize): New prototypes. * elf-strtab.c: New file. * elflink.h (elf_link_add_object_symbols): Use _bfd_elf_strtab_add and _bfd_elf_strtab_size instead of _bfd_stringtab calls. Call _bfd_elf_strtab_delref if DT_NEEDED entry is not needed or when forcing dynamic symbol to local. (elf_link_create_dynamic_sections): Call _bfd_elf_strtab_init instead of elf_stringtab_init. (elf_link_record_local_dynamic_symbol): Likewise, change dynstr type. Use _bfd_elf_strtab functions instead of _bfd_stringtab calls. (size_dynamic_sections): Use _bfd_elf_strtab functions instead of _bfd_stringtab calls. For DT_RUNPATH and Verdaux vda_name fields, call _bfd_elf_strtab_addref. Call elf_finalize_dynstr. (elf_adjust_dynstr_offsets, elf_finalize_dynstr): New functions. (elf_fix_symbol_flags): Call _bfd_elf_strtab_delref when forcing dynamic symbol to local. (elf_link_assign_sym_version): Likewise. (elf_bfd_final_link): Call _bfd_elf_strtab_emit instead of _bfd_stringtab_emit. * elflink.c (_bfd_elf_link_record_dynamic_symbol): Change dynstr type. Call _bfd_elf_strtab functions instead of _bfd_stringtab functions. * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise. * elf.c (_bfd_elf_init_reloc_shdr): Likewise. (elf_fake_sections): Likewise. (assign_section_numbers): Call _bfd_elf_strtab_clear_all_refs on shstrtab hash table, call _bfd_elf_strtab_addref on each section name in the output. Call _bfd_elf_strtab_finalize and use _bfd_elf_strtab_offset to finalize sh_name section header fields. (_bfd_elf_compute_section_file_positions): Use _bfd_elf_strtab_size instead of _bfd_stringtab_size. (prep_headers): Change shstrtab type. Use _bfd_elf_strtab calls instead of _bfd_stringtab calls.
2001-11-07 17:50:38 +01:00
elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
1999-05-03 09:29:11 +02:00
if (dynstr == NULL)
return FALSE;
1999-05-03 09:29:11 +02:00
}
/* We don't put any version information in the dynamic string
table. */
1999-05-03 09:29:11 +02:00
name = h->root.root.string;
p = strchr (name, ELF_VER_CHR);
if (p != NULL)
/* We know that the p points into writable memory. In fact,
there are only a few symbols that have read-only names, being
those like _GLOBAL_OFFSET_TABLE_ that are created specially
by the backends. Most symbols will have names pointing into
an ELF string table read from a file, or to objalloc memory. */
*p = 0;
indx = _bfd_elf_strtab_add (dynstr, name, p != NULL);
if (p != NULL)
*p = ELF_VER_CHR;
1999-05-03 09:29:11 +02:00
if (indx == (bfd_size_type) -1)
return FALSE;
1999-05-03 09:29:11 +02:00
h->dynstr_index = indx;
}
return TRUE;
1999-05-03 09:29:11 +02:00
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
/* Mark a symbol dynamic. */
static void
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info,
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
{
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
struct bfd_elf_dynamic_list *d = info->dynamic_list;
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
/* It may be called more than once on the same H. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if(h->dynamic || bfd_link_relocatable (info))
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
return;
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
if ((info->dynamic_data
&& (h->type == STT_OBJECT
Properly implement STT_COMMON The BFD configure option, --enable-elf-stt-common, can't be to used to verify STT_COMMON implementation with the normal binutils build. Instead, this patch removes it from BFD. It adds --elf-stt-common=[no|yes] to ELF assembler/objcopy and adds -z common/-z nocommon to ld. A configure option, --enable-elf-stt-common, is added to gas to specify whether ELF assembler should generate common symbols with the STT_COMMON type by default. Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF common symbols. bfd/ PR ld/19645 * bfd.c (bfd): Change flags to 20 bits. (BFD_CONVERT_ELF_COMMON): New. (BFD_USE_ELF_STT_COMMON): Likewise. (BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * configure.ac: Remove --enable-elf-stt-common. * elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. * elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for STT_COMMON. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check STT_COMMON. (elf_link_convert_common_type): New function. (elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. Set sym.st_info after sym.st_shndx. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON to object_flags. (TARGET_LITTLE_SYM): Likewise. * syms.c (BSF_KEEP_G): Renamed to ... (BSF_ELF_COMMON): This. * bfd-in2.h: Regenerated. * config.in: Likewise. * configure: Likewise. binutils/ PR ld/19645 * NEWS: Mention --elf-stt-common= for objcopy. * doc/binutils.texi: Document --elf-stt-common= for objcopy. * objcopy.c (do_elf_stt_common): New. (command_line_switch): Add OPTION_ELF_STT_COMMON. (copy_options): Add --elf-stt-common=. (copy_usage): Add --elf-stt-common=. (copy_object): Also check do_elf_stt_common for ELF targets. (copy_file): Handle do_elf_stt_common. (copy_main): Handle OPTION_ELF_STT_COMMON. * readelf.c (apply_relocations): Support STT_COMMON. * testsuite/binutils-all/common-1.s: New file. * testsuite/binutils-all/common-1a.d: Likewise. * testsuite/binutils-all/common-1b.d: Likewise. * testsuite/binutils-all/common-1c.d: Likewise. * testsuite/binutils-all/common-1d.d: Likewise. * testsuite/binutils-all/common-1e.d: Likewise. * testsuite/binutils-all/common-1f.d: Likewise. * testsuite/binutils-all/common-2.s: Likewise. * testsuite/binutils-all/common-2a.d: Likewise. * testsuite/binutils-all/common-2b.d: Likewise. * testsuite/binutils-all/common-2c.d: Likewise. * testsuite/binutils-all/common-2d.d: Likewise. * testsuite/binutils-all/common-2e.d: Likewise. * testsuite/binutils-all/common-2f.d: Likewise. * testsuite/binutils-all/objcopy.exp (objcopy_test_elf_common_symbols): New proc. Run objcopy_test_elf_common_symbols for ELF targets gas/ PR ld/19645 * NEWS: Mention --enable-elf-stt-common and --elf-stt-common= for ELF assemblers. * as.c (flag_use_elf_stt_common): New. (show_usage): Add --elf-stt-common=. (option_values): Add OPTION_ELF_STT_COMMON. (std_longopts): Add --elf-stt-common=. (parse_args): Handle --elf-stt-common=. * as.h (flag_use_elf_stt_common): New. * config.in: Regenerated. * configure: Likewise. * configure.ac: Add --enable-elf-stt-common and define DEFAULT_GENERATE_ELF_STT_COMMON. * gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set. * doc/as.texinfo: Document --elf-stt-common=. * testsuite/gas/elf/common3.s: New file. * testsuite/gas/elf/common3a.d: Likewise. * testsuite/gas/elf/common3b.d: Likewise. * testsuite/gas/elf/common4.s: Likewise. * testsuite/gas/elf/common4a.d: Likewise. * testsuite/gas/elf/common4b.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a and common4b. * testsuite/gas/i386/dw2-compress-3.d: Renamed to ... * testsuite/gas/i386/dw2-compress-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/dw2-compressed-3.d: Renamed to ... * testsuite/gas/i386/dw2-compressed-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/i386.exp: Run dw2-compress-3a, dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead of dw2-compress-3 and dw2-compressed-3. include/ PR ld/19645 * bfdlink.h (bfd_link_elf_stt_common): New enum. (bfd_link_info): Add elf_stt_common. ld/ PR ld/19645 * NEWS: Mention -z common/-z nocommon for ELF targets. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z common and -z nocommon. * ld.texinfo: Document -z common/-z nocommon. * lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon. * testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and --elf-stt-common=yes with assembler. * testsuite/ld-elfcomm/common-1.s: New file. * testsuite/ld-elfcomm/common-1a.d: Likewise. * testsuite/ld-elfcomm/common-1b.d: Likewise. * testsuite/ld-elfcomm/common-1c.d: Likewise. * testsuite/ld-elfcomm/common-1d.d: Likewise. * testsuite/ld-elfcomm/common-1e.d: Likewise. * testsuite/ld-elfcomm/common-1f.d: Likewise. * testsuite/ld-elfcomm/common-2.s: Likewise. * testsuite/ld-elfcomm/common-2a.d: Likewise. * testsuite/ld-elfcomm/common-2b.d: Likewise. * testsuite/ld-elfcomm/common-2c.d: Likewise. * testsuite/ld-elfcomm/common-2d.d: Likewise. * testsuite/ld-elfcomm/common-2e.d: Likewise. * testsuite/ld-elfcomm/common-2f.d: Likewise. * testsuite/ld-elfcomm/common-3a.rd: Likewise. * testsuite/ld-elfcomm/common-3b.rd: Likewise. * testsuite/ld-i386/pr19645.d: Likewise. * testsuite/ld-i386/pr19645.s: Likewise. * testsuite/ld-x86-64/largecomm-1.s: Likewise. * testsuite/ld-x86-64/largecomm-1a.d: Likewise. * testsuite/ld-x86-64/largecomm-1b.d: Likewise. * testsuite/ld-x86-64/largecomm-1c.d: Likewise. * testsuite/ld-x86-64/largecomm-1d.d: Likewise. * testsuite/ld-x86-64/largecomm-1e.d: Likewise. * testsuite/ld-x86-64/largecomm-1f.d: Likewise. * testsuite/ld-x86-64/pr19645.d: Likewise. * testsuite/ld-x86-64/pr19645.s: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes with assembler. (assembler_generates_commons): Removed. Run -z common/-z nocommon tests. Run *.d tests. * testsuite/ld-i386/i386.exp: Run pr19645. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with assembler. Test STT_COMMON with readelf.
2016-02-22 18:18:52 +01:00
|| h->type == STT_COMMON
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
|| (sym != NULL
Properly implement STT_COMMON The BFD configure option, --enable-elf-stt-common, can't be to used to verify STT_COMMON implementation with the normal binutils build. Instead, this patch removes it from BFD. It adds --elf-stt-common=[no|yes] to ELF assembler/objcopy and adds -z common/-z nocommon to ld. A configure option, --enable-elf-stt-common, is added to gas to specify whether ELF assembler should generate common symbols with the STT_COMMON type by default. Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF common symbols. bfd/ PR ld/19645 * bfd.c (bfd): Change flags to 20 bits. (BFD_CONVERT_ELF_COMMON): New. (BFD_USE_ELF_STT_COMMON): Likewise. (BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * configure.ac: Remove --enable-elf-stt-common. * elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. * elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for STT_COMMON. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check STT_COMMON. (elf_link_convert_common_type): New function. (elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. Set sym.st_info after sym.st_shndx. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON to object_flags. (TARGET_LITTLE_SYM): Likewise. * syms.c (BSF_KEEP_G): Renamed to ... (BSF_ELF_COMMON): This. * bfd-in2.h: Regenerated. * config.in: Likewise. * configure: Likewise. binutils/ PR ld/19645 * NEWS: Mention --elf-stt-common= for objcopy. * doc/binutils.texi: Document --elf-stt-common= for objcopy. * objcopy.c (do_elf_stt_common): New. (command_line_switch): Add OPTION_ELF_STT_COMMON. (copy_options): Add --elf-stt-common=. (copy_usage): Add --elf-stt-common=. (copy_object): Also check do_elf_stt_common for ELF targets. (copy_file): Handle do_elf_stt_common. (copy_main): Handle OPTION_ELF_STT_COMMON. * readelf.c (apply_relocations): Support STT_COMMON. * testsuite/binutils-all/common-1.s: New file. * testsuite/binutils-all/common-1a.d: Likewise. * testsuite/binutils-all/common-1b.d: Likewise. * testsuite/binutils-all/common-1c.d: Likewise. * testsuite/binutils-all/common-1d.d: Likewise. * testsuite/binutils-all/common-1e.d: Likewise. * testsuite/binutils-all/common-1f.d: Likewise. * testsuite/binutils-all/common-2.s: Likewise. * testsuite/binutils-all/common-2a.d: Likewise. * testsuite/binutils-all/common-2b.d: Likewise. * testsuite/binutils-all/common-2c.d: Likewise. * testsuite/binutils-all/common-2d.d: Likewise. * testsuite/binutils-all/common-2e.d: Likewise. * testsuite/binutils-all/common-2f.d: Likewise. * testsuite/binutils-all/objcopy.exp (objcopy_test_elf_common_symbols): New proc. Run objcopy_test_elf_common_symbols for ELF targets gas/ PR ld/19645 * NEWS: Mention --enable-elf-stt-common and --elf-stt-common= for ELF assemblers. * as.c (flag_use_elf_stt_common): New. (show_usage): Add --elf-stt-common=. (option_values): Add OPTION_ELF_STT_COMMON. (std_longopts): Add --elf-stt-common=. (parse_args): Handle --elf-stt-common=. * as.h (flag_use_elf_stt_common): New. * config.in: Regenerated. * configure: Likewise. * configure.ac: Add --enable-elf-stt-common and define DEFAULT_GENERATE_ELF_STT_COMMON. * gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set. * doc/as.texinfo: Document --elf-stt-common=. * testsuite/gas/elf/common3.s: New file. * testsuite/gas/elf/common3a.d: Likewise. * testsuite/gas/elf/common3b.d: Likewise. * testsuite/gas/elf/common4.s: Likewise. * testsuite/gas/elf/common4a.d: Likewise. * testsuite/gas/elf/common4b.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a and common4b. * testsuite/gas/i386/dw2-compress-3.d: Renamed to ... * testsuite/gas/i386/dw2-compress-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/dw2-compressed-3.d: Renamed to ... * testsuite/gas/i386/dw2-compressed-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/i386.exp: Run dw2-compress-3a, dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead of dw2-compress-3 and dw2-compressed-3. include/ PR ld/19645 * bfdlink.h (bfd_link_elf_stt_common): New enum. (bfd_link_info): Add elf_stt_common. ld/ PR ld/19645 * NEWS: Mention -z common/-z nocommon for ELF targets. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z common and -z nocommon. * ld.texinfo: Document -z common/-z nocommon. * lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon. * testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and --elf-stt-common=yes with assembler. * testsuite/ld-elfcomm/common-1.s: New file. * testsuite/ld-elfcomm/common-1a.d: Likewise. * testsuite/ld-elfcomm/common-1b.d: Likewise. * testsuite/ld-elfcomm/common-1c.d: Likewise. * testsuite/ld-elfcomm/common-1d.d: Likewise. * testsuite/ld-elfcomm/common-1e.d: Likewise. * testsuite/ld-elfcomm/common-1f.d: Likewise. * testsuite/ld-elfcomm/common-2.s: Likewise. * testsuite/ld-elfcomm/common-2a.d: Likewise. * testsuite/ld-elfcomm/common-2b.d: Likewise. * testsuite/ld-elfcomm/common-2c.d: Likewise. * testsuite/ld-elfcomm/common-2d.d: Likewise. * testsuite/ld-elfcomm/common-2e.d: Likewise. * testsuite/ld-elfcomm/common-2f.d: Likewise. * testsuite/ld-elfcomm/common-3a.rd: Likewise. * testsuite/ld-elfcomm/common-3b.rd: Likewise. * testsuite/ld-i386/pr19645.d: Likewise. * testsuite/ld-i386/pr19645.s: Likewise. * testsuite/ld-x86-64/largecomm-1.s: Likewise. * testsuite/ld-x86-64/largecomm-1a.d: Likewise. * testsuite/ld-x86-64/largecomm-1b.d: Likewise. * testsuite/ld-x86-64/largecomm-1c.d: Likewise. * testsuite/ld-x86-64/largecomm-1d.d: Likewise. * testsuite/ld-x86-64/largecomm-1e.d: Likewise. * testsuite/ld-x86-64/largecomm-1f.d: Likewise. * testsuite/ld-x86-64/pr19645.d: Likewise. * testsuite/ld-x86-64/pr19645.s: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes with assembler. (assembler_generates_commons): Removed. Run -z common/-z nocommon tests. Run *.d tests. * testsuite/ld-i386/i386.exp: Run pr19645. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with assembler. Test STT_COMMON with readelf.
2016-02-22 18:18:52 +01:00
&& (ELF_ST_TYPE (sym->st_info) == STT_OBJECT
|| ELF_ST_TYPE (sym->st_info) == STT_COMMON))))
2007-09-30 15:43:23 +02:00
|| (d != NULL
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
&& h->root.type == bfd_link_hash_new
&& (*d->match) (&d->head, NULL, h->root.root.string)))
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
h->dynamic = 1;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Record an assignment to a symbol made by a linker script. We need
this in case some dynamic object refers to this symbol. */
bfd_boolean
bfd_elf_record_link_assignment (bfd *output_bfd,
struct bfd_link_info *info,
const char *name,
bfd_boolean provide,
bfd_boolean hidden)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
struct elf_link_hash_entry *h, *hv;
struct elf_link_hash_table *htab;
const struct elf_backend_data *bed;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
* elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg. * elf.c (_bfd_elf_merge_sections): Adjust to suit. (_bfd_elf_link_just_syms): Likewise. (bfd_elf_get_needed_list): Likewise. (bfd_elf_get_runpath_list): Likewise. (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens. * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab creator flavour. (elf32_hppa_set_gp): Look up output sections rather than using htab. * elf32-i960.c: Comment fix. Formatting. * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table rather than testing creator flavour. * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise. * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for is_elf_hash_table change. Remove redundant test. (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than testing creator flavour. (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant checks. Use is_elf_hash_table rather than testing creator flavour. Use hash_table throughout in place of info->hash. (elf_add_dynamic_entry): Adjust for is_elf_hash_table change. (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant check. (elf_bfd_final_link): Adjust for is_elf_hash_table change. (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than testing creator flavour. (elf_gc_sections): Add is_elf_hash_table check. (elf_gc_common_finalize_got_offsets): Likewise. (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove redundant check. * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table rather than testing creator flavour.
2003-12-01 07:28:24 +01:00
if (!is_elf_hash_table (info->hash))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return TRUE;
htab = elf_hash_table (info);
h = elf_link_hash_lookup (htab, name, !provide, TRUE, FALSE);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (h == NULL)
return provide;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (h->versioned == unknown)
{
/* Set versioned if symbol version is unknown. */
char *version = strrchr (name, ELF_VER_CHR);
if (version)
{
if (version > name && version[-1] != ELF_VER_CHR)
h->versioned = versioned_hidden;
else
h->versioned = versioned;
}
}
switch (h->root.type)
{
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
case bfd_link_hash_common:
break;
case bfd_link_hash_undefweak:
case bfd_link_hash_undefined:
/* Since we're defining the symbol, don't let it seem to have not
been defined. record_dynamic_symbol and size_dynamic_sections
may depend on this. */
h->root.type = bfd_link_hash_new;
if (h->root.u.undef.next != NULL || htab->root.undefs_tail == &h->root)
bfd_link_repair_undef_list (&htab->root);
break;
case bfd_link_hash_new:
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
bfd_elf_link_mark_dynamic_symbol (info, h, NULL);
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
h->non_elf = 0;
break;
case bfd_link_hash_indirect:
/* We had a versioned symbol in a dynamic library. We make the
2007-09-30 15:43:23 +02:00
the versioned symbol point to this one. */
bed = get_elf_backend_data (output_bfd);
hv = h;
while (hv->root.type == bfd_link_hash_indirect
|| hv->root.type == bfd_link_hash_warning)
hv = (struct elf_link_hash_entry *) hv->root.u.i.link;
/* We don't need to update h->root.u since linker will set them
later. */
h->root.type = bfd_link_hash_undefined;
hv->root.type = bfd_link_hash_indirect;
hv->root.u.i.link = (struct bfd_link_hash_entry *) h;
(*bed->elf_backend_copy_indirect_symbol) (info, h, hv);
break;
case bfd_link_hash_warning:
abort ();
break;
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If this symbol is being provided by the linker script, and it is
currently defined by a dynamic object, but not by a regular
object, then mark it as undefined so that the generic linker will
force the correct value. */
if (provide
2004-09-16 16:52:12 +02:00
&& h->def_dynamic
&& !h->def_regular)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
h->root.type = bfd_link_hash_undefined;
/* If this symbol is not being provided by the linker script, and it is
currently defined by a dynamic object, but not by a regular object,
then clear out any version information because the symbol will not be
associated with the dynamic object any more. */
if (!provide
2004-09-16 16:52:12 +02:00
&& h->def_dynamic
&& !h->def_regular)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
h->verinfo.verdef = NULL;
2004-09-16 16:52:12 +02:00
h->def_regular = 1;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (hidden)
{
bed = get_elf_backend_data (output_bfd);
if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
}
/* STV_HIDDEN and STV_INTERNAL symbols must be STB_LOCAL in shared objects
and executables. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (info)
&& h->dynindx != -1
&& (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL))
h->forced_local = 1;
2004-09-16 16:52:12 +02:00
if ((h->def_dynamic
|| h->ref_dynamic
|| bfd_link_dll (info)
|| elf_hash_table (info)->is_relocatable_executable)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& h->dynindx == -1)
{
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! bfd_elf_link_record_dynamic_symbol (info, h))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
/* If this is a weak defined symbol, and we know a corresponding
real symbol from the same dynamic object, make sure the real
symbol is also made into a dynamic symbol. */
if (h->u.weakdef != NULL
&& h->u.weakdef->dynindx == -1)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
if (! bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
}
}
return TRUE;
}
/* Record a new local dynamic symbol. Returns 0 on failure, 1 on
success, and 2 on a failure caused by attempting to record a symbol
in a discarded section, eg. a discarded link-once section symbol. */
int
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *info,
bfd *input_bfd,
long input_indx)
{
bfd_size_type amt;
struct elf_link_local_dynamic_entry *entry;
struct elf_link_hash_table *eht;
struct elf_strtab_hash *dynstr;
unsigned long dynstr_index;
char *name;
Elf_External_Sym_Shndx eshndx;
char esym[sizeof (Elf64_External_Sym)];
* elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg. * elf.c (_bfd_elf_merge_sections): Adjust to suit. (_bfd_elf_link_just_syms): Likewise. (bfd_elf_get_needed_list): Likewise. (bfd_elf_get_runpath_list): Likewise. (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens. * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab creator flavour. (elf32_hppa_set_gp): Look up output sections rather than using htab. * elf32-i960.c: Comment fix. Formatting. * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table rather than testing creator flavour. * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise. * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for is_elf_hash_table change. Remove redundant test. (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than testing creator flavour. (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant checks. Use is_elf_hash_table rather than testing creator flavour. Use hash_table throughout in place of info->hash. (elf_add_dynamic_entry): Adjust for is_elf_hash_table change. (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant check. (elf_bfd_final_link): Adjust for is_elf_hash_table change. (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than testing creator flavour. (elf_gc_sections): Add is_elf_hash_table check. (elf_gc_common_finalize_got_offsets): Likewise. (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove redundant check. * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table rather than testing creator flavour.
2003-12-01 07:28:24 +01:00
if (! is_elf_hash_table (info->hash))
return 0;
/* See if the entry exists already. */
for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next)
if (entry->input_bfd == input_bfd && entry->input_indx == input_indx)
return 1;
amt = sizeof (*entry);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
entry = (struct elf_link_local_dynamic_entry *) bfd_alloc (input_bfd, amt);
if (entry == NULL)
return 0;
/* Go find the symbol, so that we can find it's name. */
if (!bfd_elf_get_elf_syms (input_bfd, &elf_tdata (input_bfd)->symtab_hdr,
1, input_indx, &entry->isym, esym, &eshndx))
{
bfd_release (input_bfd, entry);
return 0;
}
if (entry->isym.st_shndx != SHN_UNDEF
include/elf/ PR 5900 * common.h (SHN_BAD): Delete. (SHN_LORESERVE .. SHN_HIRESERVE): Move to.. * external.h: ..here. * internal.h (SHN_LORESERVE, SHN_HIRESERVE): Define. (SHN_LOPROC, SHN_HIPROC, SHN_LOOS, SHN_HIOS): Define. (SHN_ABS, SHN_COMMON, SHN_XINDEX, SHN_BAD): Define. bfd/ PR 5900 * elf-bfd.h: Include elf/internal.h after elf/external.h. * elfcode.h (elf_swap_symbol_in): Map reserved shndx range. (elf_swap_symbol_out): Adjust SHN_XINDEX test. (elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. (valid_section_index_p): Delete. (elf_object_p): Don't increment section numbers over reserved range. Simplify test for valid sh_link, sh_info and e_shstrndx fields. (elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. Don't increment section numbers over reserved range. * elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx. (bfd_section_from_shdr): Likewise. (group_signature): Range check before accessing elf_elfsections. (_bfd_elf_setup_sections): Likewise. (bfd_section_from_shdr): Likewise. (bfd_section_from_shdr): Don't increment section number over reserved sections. (assign_file_positions_for_non_load_sections): Likewise. (assign_file_positions_except_relocs): Likewise. (_bfd_elf_write_object_contents): Likewise. (assign_section_numbers): Likewise. Adjust for changed SHN_*. (prep_headers): Delete unused variable. * elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust for changed SHN_* values. (check_dynsym, elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. Don't skip over reserved section range. (elf_fixup_link_order): Check that sh_link field is valid. * elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned. * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before accesssing elf_elfsections. * elf32-avr.c (elf32_avr_size_stubs): Likewise. * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise. * elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed SHN_* defines. Test for SHN_BAD return from _bfd_elf_section_from_bfd_section binutils/ PR 5900 * readelf.c (SECTION_HEADER_INDEX, SECTION_HEADER_NUM): Delete. Remove use throughout file. (SECTION_HEADER): Likewise. (dump_relocations): Don't adjust st_shndx for reserved range. (process_file_header): Mask SHN_XINDEX to values seen in external elf structs. Simplify valid section index tests. (get_32bit_elf_symbols, get_64bit_elf_symbols): Mask SHN_XINDEX. Map reserved st_shndx to internal form. (process_section_groups): Test that group symbol st_shndx is in range, not just non-zero. Delete reserved range check. (get_symbol_index_type): Mask "type" to 16 bits when printing PRC, OS or RSV. gdb/ PR 5900 * elfread.c (elf_symtab_read): Make shndx an unsigned int. * mipsread.c: Include elf/internal.h. (read_alphacoff_dynamic_symtab): Map external reserved sym_shndx to internal range. ld/testsuite/ PR 5900 * ld-elf/sec64k.exp: Update.
2008-03-12 09:37:09 +01:00
&& entry->isym.st_shndx < SHN_LORESERVE)
{
asection *s;
s = bfd_section_from_elf_index (input_bfd, entry->isym.st_shndx);
if (s == NULL || bfd_is_abs_section (s->output_section))
{
/* We can still bfd_release here as nothing has done another
bfd_alloc. We can't do this later in this function. */
bfd_release (input_bfd, entry);
return 2;
}
}
name = (bfd_elf_string_from_elf_section
(input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link,
entry->isym.st_name));
dynstr = elf_hash_table (info)->dynstr;
if (dynstr == NULL)
{
/* Create a strtab to hold the dynamic symbol names. */
elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
if (dynstr == NULL)
return 0;
}
dynstr_index = _bfd_elf_strtab_add (dynstr, name, FALSE);
if (dynstr_index == (unsigned long) -1)
return 0;
entry->isym.st_name = dynstr_index;
eht = elf_hash_table (info);
entry->next = eht->dynlocal;
eht->dynlocal = entry;
entry->input_bfd = input_bfd;
entry->input_indx = input_indx;
eht->dynsymcount++;
/* Whatever binding the symbol had before, it's now local. */
entry->isym.st_info
= ELF_ST_INFO (STB_LOCAL, ELF_ST_TYPE (entry->isym.st_info));
/* The dynindx will be set at the end of size_dynamic_sections. */
return 1;
}
/* Return the dynindex of a local dynamic symbol. */
long
_bfd_elf_link_lookup_local_dynindx (struct bfd_link_info *info,
bfd *input_bfd,
long input_indx)
{
struct elf_link_local_dynamic_entry *e;
for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
if (e->input_bfd == input_bfd && e->input_indx == input_indx)
return e->dynindx;
return -1;
}
/* This function is used to renumber the dynamic symbols, if some of
them are removed because they are marked as local. This is called
via elf_link_hash_traverse. */
static bfd_boolean
elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
void *data)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
size_t *count = (size_t *) data;
if (h->forced_local)
return TRUE;
if (h->dynindx != -1)
h->dynindx = ++(*count);
return TRUE;
}
/* Like elf_link_renumber_hash_table_dynsyms, but just number symbols with
STB_LOCAL binding. */
static bfd_boolean
elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h,
void *data)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
size_t *count = (size_t *) data;
if (!h->forced_local)
return TRUE;
if (h->dynindx != -1)
h->dynindx = ++(*count);
return TRUE;
}
/* Return true if the dynamic symbol for a given section should be
omitted when creating a shared library. */
bfd_boolean
_bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info,
asection *p)
{
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
struct elf_link_hash_table *htab;
asection *ip;
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
switch (elf_section_data (p)->this_hdr.sh_type)
{
case SHT_PROGBITS:
case SHT_NOBITS:
/* If sh_type is yet undecided, assume it could be
SHT_PROGBITS/SHT_NOBITS. */
case SHT_NULL:
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
htab = elf_hash_table (info);
if (p == htab->tls_sec)
return FALSE;
if (htab->text_index_section != NULL)
return p != htab->text_index_section && p != htab->data_index_section;
return (htab->dynobj != NULL
2012-06-29 16:46:03 +02:00
&& (ip = bfd_get_linker_section (htab->dynobj, p->name)) != NULL
&& ip->output_section == p);
/* There shouldn't be section relative relocations
against any other section. */
default:
return TRUE;
}
}
/* Assign dynsym indices. In a shared library we generate a section
symbol for each output section, which come first. Next come symbols
which have been forced to local binding. Then all of the back-end
allocated local dynamic syms, followed by the rest of the global
symbols. */
static unsigned long
_bfd_elf_link_renumber_dynsyms (bfd *output_bfd,
struct bfd_link_info *info,
unsigned long *section_sym_count)
{
unsigned long dynsymcount = 0;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_pic (info)
|| elf_hash_table (info)->is_relocatable_executable)
{
const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
asection *p;
for (p = output_bfd->sections; p ; p = p->next)
bfd/ * elflink.c (elf_bfd_final_link): Don't output STT_SECTION symbol into .dynsym if elf_section_data (sec)->dynindx <= 0. Adjust counting of last_local. (_bfd_elf_link_renumber_dynsyms): Don't assign dynindx to sections other than SHT_PROGBITS/SHT_NOBITS and neither for .got/.got.plt/.plt created by the linker nor !SHF_ALLOC. * elf32-i386.c (elf_i386_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. Set sh_entsize for .got section in addition to .got.plt. (elf_i386_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. (elf64_x86_64_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. Set sh_entsize for .got section in addition to .got.plt. * elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_RELRO. (bfd_section_from_phdr): Likewise. (map_sections_to_segments): Likewise. (assign_file_positions_for_segments): Likewise. (get_program_header_size): Likewise. * elflink.c (bfd_elf_size_dynamic_sections): Set elf_tdata (output_bfd)->relro from info->relro. * elf-bfd.h (struct elf_obj_tdata): Add relro field. include/ * bfdlink.h (struct bfd_link_info): Add relro, relro_start and relro_end fields. * elf/common.h (PT_GNU_EH_FRAME, PT_GNU_STACK): Add comments. (PT_GNU_RELRO): Define. binutils/ * readelf.c (get_segment_type): Handle PT_GNU_RELRO. ld/ * genscripts.sh: Generate -z combreloc -z now -z relro scripts for binaries, -shared and -pie. * emulparams/elf_i386.sh (SEPARATE_GOTPLT): Set. * emulparams/elf_x86_64.sh (SEPARATE_GOTPLT): Set. * emulparams/elf32ppc.sh (OTHER_READWRITE_SECTIONS): Rename to... (OTHER_RELRO_SECTIONS): ... this. * ldlex.l (DATA_SEGMENT_RELRO_END): Add. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z relro and -z norelro. (gld${EMULATION_NAME}_list_options): Add it to usage. (gld${EMULATION_NAME}_get_script): Return -z combreloc -z now -z relro scripts when appropriate. * scripttempl/elf.sc: Unset SEPARATE_GOTPLT if RELRO_NOW is set. Create separate .got.plt section if SEPARATE_GOTPLT. Move sections which are only written during relocation handling to the beginning of RW segment. If NO_SMALL_DATA, move .got before .data. Add DATA_SEGMENT_RELRO_END directive. Include OTHER_RELRO_SECTIONS. * ldgram.y (DATA_SEGMENT_RELRO_END): Add. * ldexp.c (exp_print_token): Handle DATA_SEGMENT_RELRO_END. (fold_unary): Likewise. (fold_binary): Handle -z relro. * ldexp.h (struct exp_data_seg): Add exp_dataseg_relro_seen and exp_dataseg_relro_adjust phases. Add relro_end field. * ldmain.c (main): Initialize link_info.relro to FALSE. * ldlang.c (lang_size_sections): Handle -z relro. ld/testsuite/ * ld-i386/tlspic.rd: Adjust for section reordering changes and removal of unneeded STT_SECTION symbols from .dynsym. * ld-i386/tlspic.dd: Likewise. * ld-i386/tlspic.sd: Likewise. * ld-i386/tlsbin.rd: Likewise. * ld-i386/tlsbinpic.s: Likewise. * ld-i386/tlsbin.dd: Likewise. * ld-i386/tlsbin.sd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlsnopic1.s: Likewise. * ld-i386/combreloc.d: Likewise. * ld-i386/tlsnopic.dd: Likewise. * ld-i386/tlsnopic.sd: Likewise. * ld-x86-64/tlspic.rd: Likewise. * ld-x86-64/tlspic.dd: Likewise. * ld-x86-64/tlsbin.dd: Likewise. * ld-x86-64/tlspic.sd: Likewise. * ld-x86-64/tlsbin.sd: Likewise. * ld-x86-64/tlspic.td: Likewise. * ld-x86-64/tlsbin.td: Likewise. * ld-x86-64/tlsbin.rd: Likewise. * ld-s390/tlspic1.s: Likewise. * ld-s390/tlsbinpic.s: Likewise. * ld-s390/tlspic.rd: Likewise. * ld-s390/tlsbin.rd: Likewise. * ld-s390/tlspic.dd: Likewise. * ld-s390/tlsbin.dd: Likewise. * ld-s390/tlsbin.sd: Likewise. * ld-s390/tlsbin.td: Likewise. * ld-s390/tlspic.sd: Likewise. * ld-s390/tlspic.td: Likewise. * ld-s390/tlspic1_64.s: Likewise. * ld-s390/tlsbinpic_64.s: Likewise. * ld-s390/tlspic_64.rd: Likewise. * ld-s390/tlsbin_64.rd: Likewise. * ld-s390/tlspic_64.dd: Likewise. * ld-s390/tlsbin_64.dd: Likewise. * ld-s390/tlspic_64.sd: Likewise. * ld-s390/tlspic_64.td: Likewise. * ld-s390/tlsbin_64.td: Likewise. * ld-s390/tlsbin_64.sd: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.t: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlstocso.r: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-ia64/tlspic.rd: Likewise. * ld-ia64/tlspic.dd: Likewise. * ld-ia64/tlspic.sd: Likewise. * ld-ia64/tlspic.td: Likewise. * ld-ia64/tlsbin.rd: Likewise. * ld-ia64/tlsbin.sd: Likewise. * ld-ia64/tlsbin.td: Likewise. * ld-elfvsb/elfvsb.exp: XFAIL non-PIC load offset tests on s390x. * ld-shared/shared.exp: Likewise.
2004-05-11 19:08:38 +02:00
if ((p->flags & SEC_EXCLUDE) == 0
&& (p->flags & SEC_ALLOC) != 0
&& !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p))
elf_section_data (p)->dynindx = ++dynsymcount;
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
else
elf_section_data (p)->dynindx = 0;
}
*section_sym_count = dynsymcount;
elf_link_hash_traverse (elf_hash_table (info),
elf_link_renumber_local_hash_table_dynsyms,
&dynsymcount);
if (elf_hash_table (info)->dynlocal)
{
struct elf_link_local_dynamic_entry *p;
for (p = elf_hash_table (info)->dynlocal; p ; p = p->next)
p->dynindx = ++dynsymcount;
}
elf_link_hash_traverse (elf_hash_table (info),
elf_link_renumber_hash_table_dynsyms,
&dynsymcount);
/* There is an unused NULL entry at the head of the table which
we must account for in our count. We always create the dynsym
section, even if it is empty, with dynamic sections. */
if (elf_hash_table (info)->dynamic_sections_created)
++dynsymcount;
elf_hash_table (info)->dynsymcount = dynsymcount;
return dynsymcount;
}
1999-05-03 09:29:11 +02:00
/* Merge st_other field. */
static void
elf_merge_st_other (bfd *abfd, struct elf_link_hash_entry *h,
const Elf_Internal_Sym *isym, asection *sec,
bfd_boolean definition, bfd_boolean dynamic)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
/* If st_other has a processor-specific meaning, specific
code might be needed here. */
if (bed->elf_backend_merge_symbol_attribute)
(*bed->elf_backend_merge_symbol_attribute) (h, isym, definition,
dynamic);
if (!dynamic)
{
unsigned symvis = ELF_ST_VISIBILITY (isym->st_other);
unsigned hvis = ELF_ST_VISIBILITY (h->other);
/* Keep the most constraining visibility. Leave the remainder
of the st_other field to elf_backend_merge_symbol_attribute. */
if (symvis - 1 < hvis - 1)
h->other = symvis | (h->other & ~ELF_ST_VISIBILITY (-1));
}
else if (definition
&& ELF_ST_VISIBILITY (isym->st_other) != STV_DEFAULT
&& (sec->flags & SEC_READONLY) == 0)
Copy relocations against protected symbols Copy relocs are used in a scheme to avoid dynamic text relocations in non-PIC executables that refer to variables defined in shared libraries. The idea is to have the linker define any such variable in the executable, with a copy reloc copying the initial value, then have both the executable and shared library refer to the executable copy. If the shared library defines the variable as protected then we have two copies of the variable being used. PR 15228 * elflink.c (_bfd_elf_adjust_dynamic_copy): Add "info" param. Error on copy relocs against protected symbols. (elf_merge_st_other): Set h->protected_def. * elf-bfd.h (struct elf_link_hash_entry): Add "protected_def". (_bfd_elf_adjust_dynamic_copy): Update prototype. * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Update _bfd_elf_adjust_dynamic_copy call. * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. * elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. * elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. * elf32-metag.c (elf_metag_adjust_dynamic_symbol): Likewise. * elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Likewise. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise. * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol): Likewise.
2014-12-12 13:23:46 +01:00
h->protected_def = 1;
}
/* This function is called when we want to merge a new symbol with an
existing symbol. It handles the various cases which arise when we
find a definition in a dynamic object, or when there is already a
definition in a dynamic object. The new symbol is described by
NAME, SYM, PSEC, and PVALUE. We set SYM_HASH to the hash table
entry. We set POLDBFD to the old symbol's BFD. We set POLD_WEAK
if the old symbol was weak. We set POLD_ALIGNMENT to the alignment
of an old common symbol. We set OVERRIDE if the old symbol is
overriding a new definition. We set TYPE_CHANGE_OK if it is OK for
the type to change. We set SIZE_CHANGE_OK if it is OK for the size
to change. By OK to change, we mean that we shouldn't warn if the
type or size does change. */
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
static bfd_boolean
_bfd_elf_merge_symbol (bfd *abfd,
struct bfd_link_info *info,
const char *name,
Elf_Internal_Sym *sym,
asection **psec,
bfd_vma *pvalue,
struct elf_link_hash_entry **sym_hash,
bfd **poldbfd,
bfd_boolean *pold_weak,
unsigned int *pold_alignment,
bfd_boolean *skip,
bfd_boolean *override,
bfd_boolean *type_change_ok,
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
bfd_boolean *size_change_ok,
bfd_boolean *matched)
1999-05-03 09:29:11 +02:00
{
asection *sec, *oldsec;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
struct elf_link_hash_entry *h;
struct elf_link_hash_entry *hi;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
struct elf_link_hash_entry *flip;
int bind;
bfd *oldbfd;
bfd_boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon;
bfd_boolean newweak, oldweak, newfunc, oldfunc;
const struct elf_backend_data *bed;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
char *new_version;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
*skip = FALSE;
*override = FALSE;
sec = *psec;
bind = ELF_ST_BIND (sym->st_info);
if (! bfd_is_und_section (sec))
h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, FALSE, FALSE);
else
h = ((struct elf_link_hash_entry *)
bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, FALSE, FALSE));
if (h == NULL)
return FALSE;
*sym_hash = h;
1999-05-03 09:29:11 +02:00
bed = get_elf_backend_data (abfd);
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
/* NEW_VERSION is the symbol version of the new symbol. */
if (h->versioned != unversioned)
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
{
/* Symbol version is unknown or versioned. */
new_version = strrchr (name, ELF_VER_CHR);
if (new_version)
{
if (h->versioned == unknown)
{
if (new_version > name && new_version[-1] != ELF_VER_CHR)
h->versioned = versioned_hidden;
else
h->versioned = versioned;
}
new_version += 1;
if (new_version[0] == '\0')
new_version = NULL;
}
else
h->versioned = unversioned;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
}
else
new_version = NULL;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
/* For merging, we only care about real symbols. But we need to make
sure that indirect symbol dynamic flags are updated. */
hi = h;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
if (!*matched)
{
if (hi == h || h->root.type == bfd_link_hash_new)
*matched = TRUE;
else
{
/* OLD_HIDDEN is true if the existing symbol is only visible
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
to the symbol with the same symbol version. NEW_HIDDEN is
true if the new symbol is only visible to the symbol with
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
the same symbol version. */
bfd_boolean old_hidden = h->versioned == versioned_hidden;
bfd_boolean new_hidden = hi->versioned == versioned_hidden;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
if (!old_hidden && !new_hidden)
/* The new symbol matches the existing symbol if both
aren't hidden. */
*matched = TRUE;
else
{
/* OLD_VERSION is the symbol version of the existing
symbol. */
char *old_version;
if (h->versioned >= versioned)
old_version = strrchr (h->root.root.string,
ELF_VER_CHR) + 1;
else
old_version = NULL;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
/* The new symbol matches the existing symbol if they
have the same symbol version. */
*matched = (old_version == new_version
|| (old_version != NULL
&& new_version != NULL
&& strcmp (old_version, new_version) == 0));
}
}
}
/* OLDBFD and OLDSEC are a BFD and an ASECTION associated with the
existing symbol. */
oldbfd = NULL;
oldsec = NULL;
switch (h->root.type)
{
default:
break;
case bfd_link_hash_undefined:
case bfd_link_hash_undefweak:
oldbfd = h->root.u.undef.abfd;
break;
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
oldbfd = h->root.u.def.section->owner;
oldsec = h->root.u.def.section;
break;
case bfd_link_hash_common:
oldbfd = h->root.u.c.p->section->owner;
oldsec = h->root.u.c.p->section;
if (pold_alignment)
*pold_alignment = h->root.u.c.p->alignment_power;
break;
}
if (poldbfd && *poldbfd == NULL)
*poldbfd = oldbfd;
/* Differentiate strong and weak symbols. */
newweak = bind == STB_WEAK;
oldweak = (h->root.type == bfd_link_hash_defweak
|| h->root.type == bfd_link_hash_undefweak);
if (pold_weak)
*pold_weak = oldweak;
/* This code is for coping with dynamic objects, and is only useful
if we are doing an ELF link. */
if (!(*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
return TRUE;
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
/* We have to check it for every instance since the first few may be
references and not all compilers emit symbol type for undefined
bfd/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
2007-01-16 15:56:32 +01:00
symbols. */
bfd_elf_link_mark_dynamic_symbol (info, h, sym);
/* NEWDYN and OLDDYN indicate whether the new or old symbol,
respectively, is from a dynamic object. */
newdyn = (abfd->flags & DYNAMIC) != 0;
/* ref_dynamic_nonweak and dynamic_def flags track actual undefined
syms and defined syms in dynamic libraries respectively.
ref_dynamic on the other hand can be set for a symbol defined in
a dynamic library, and def_dynamic may not be set; When the
definition in a dynamic lib is overridden by a definition in the
executable use of the symbol in the dynamic lib becomes a
reference to the executable symbol. */
if (newdyn)
{
if (bfd_is_und_section (sec))
{
if (bind != STB_WEAK)
{
h->ref_dynamic_nonweak = 1;
hi->ref_dynamic_nonweak = 1;
}
}
else
{
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
/* Update the existing symbol only if they match. */
if (*matched)
h->dynamic_def = 1;
hi->dynamic_def = 1;
}
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If we just created the symbol, mark it as being an ELF symbol.
Other than that, there is nothing to do--there is no merge issue
with a newly defined symbol--so we just return. */
if (h->root.type == bfd_link_hash_new)
1999-05-03 09:29:11 +02:00
{
2004-09-16 16:52:12 +02:00
h->non_elf = 0;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return TRUE;
}
1999-05-03 09:29:11 +02:00
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* In cases involving weak versioned symbols, we may wind up trying
to merge a symbol with itself. Catch that here, to avoid the
confusion that results if we try to override a symbol with
itself. The additional tests catch cases like
_GLOBAL_OFFSET_TABLE_, which are regular symbols defined in a
dynamic object, which we do want to handle here. */
if (abfd == oldbfd
&& (newweak || oldweak)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& ((abfd->flags & DYNAMIC) == 0
2004-09-16 16:52:12 +02:00
|| !h->def_regular))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return TRUE;
olddyn = FALSE;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (oldbfd != NULL)
olddyn = (oldbfd->flags & DYNAMIC) != 0;
else if (oldsec != NULL)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
/* This handles the special SHN_MIPS_{TEXT,DATA} section
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
indices used by MIPS ELF. */
olddyn = (oldsec->symbol->flags & BSF_DYNAMIC) != 0;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
1999-05-03 09:29:11 +02:00
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* NEWDEF and OLDDEF indicate whether the new or old symbol,
respectively, appear to be a definition rather than reference. */
newdef = !bfd_is_und_section (sec) && !bfd_is_com_section (sec);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
olddef = (h->root.type != bfd_link_hash_undefined
&& h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_common);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* NEWFUNC and OLDFUNC indicate whether the new or old symbol,
respectively, appear to be a function. */
newfunc = (ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
&& bed->is_function_type (ELF_ST_TYPE (sym->st_info)));
oldfunc = (h->type != STT_NOTYPE
&& bed->is_function_type (h->type));
/* When we try to create a default indirect symbol from the dynamic
definition with the default version, we skip it if its type and
2014-01-21 14:37:45 +01:00
the type of existing regular definition mismatch. */
if (pold_alignment == NULL
&& newdyn
&& newdef
&& !olddyn
&& (((olddef || h->root.type == bfd_link_hash_common)
&& ELF_ST_TYPE (sym->st_info) != h->type
&& ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
&& h->type != STT_NOTYPE
&& !(newfunc && oldfunc))
|| (olddef
&& ((h->type == STT_GNU_IFUNC)
!= (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))))
{
*skip = TRUE;
return TRUE;
}
/* Check TLS symbols. We don't check undefined symbols introduced
by "ld -u" which have no type (and oldbfd NULL), and we don't
check symbols from plugins because they also have no type. */
if (oldbfd != NULL
&& (oldbfd->flags & BFD_PLUGIN) == 0
&& (abfd->flags & BFD_PLUGIN) == 0
&& ELF_ST_TYPE (sym->st_info) != h->type
&& (ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS))
{
bfd *ntbfd, *tbfd;
bfd_boolean ntdef, tdef;
asection *ntsec, *tsec;
if (h->type == STT_TLS)
{
bfd/ * elf-bfd.h (struct elf_backend_data): Remove got_symbol_offset. * elfxx-target.h (elf_backend_got_symbol_offset): Delete. * elflink.c (_bfd_elf_create_got_section): Use zero in place of got_symbol_offset. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise. * elf32-frv.c (_frv_create_got_section): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Delete ppc code. (elf_backend_got_symbol_offset): Don't define. * elf64-ppc.c (elf_backend_got_symbol_offset): Don't define. * elf32-ppc.c (struct ppc_elf_link_hash_table): Add got_header_size and got_gap. (ppc_elf_create_got): Tidy. (ppc_elf_create_dynamic_sections): Don't set SEC_IN_MEMORY for .plt. (ppc_elf_check_relocs): Reduce string comparisons by using elf.hgot. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_relocate_section): Likewise. (ppc_elf_finish_dynamic_symbol): Likewise. (allocate_got): New function. (allocate_dynrelocs): Use allocate_got. (ppc_elf_size_dynamic_sections): Likewise. Delay tlsld_got allocation so that local got can refcount it. Set got_header_size. (ppc_elf_relocate_section): Use value of elf.hgot rather than hard- coded 4. (ppc_elf_finish_dynamic_sections): Likewise. (elf_backend_got_symbol_offset): Don't define. (elf_backend_got_header_size): Ditto. ld/testsuite/ * ld-powerpc/tlsexe32.d: Update for changed got layout. * ld-powerpc/tlsexe32.g: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.r: Likewise.
2005-05-07 04:55:55 +02:00
ntbfd = abfd;
ntsec = sec;
ntdef = newdef;
tbfd = oldbfd;
tsec = oldsec;
tdef = olddef;
}
else
{
ntbfd = oldbfd;
ntsec = oldsec;
ntdef = olddef;
tbfd = abfd;
tsec = sec;
tdef = newdef;
}
if (tdef && ntdef)
(*_bfd_error_handler)
(_("%s: TLS definition in %B section %A "
"mismatches non-TLS definition in %B section %A"),
tbfd, tsec, ntbfd, ntsec, h->root.root.string);
else if (!tdef && !ntdef)
(*_bfd_error_handler)
(_("%s: TLS reference in %B "
"mismatches non-TLS reference in %B"),
tbfd, ntbfd, h->root.root.string);
else if (tdef)
(*_bfd_error_handler)
(_("%s: TLS definition in %B section %A "
"mismatches non-TLS reference in %B"),
tbfd, tsec, ntbfd, h->root.root.string);
else
(*_bfd_error_handler)
(_("%s: TLS reference in %B "
"mismatches non-TLS definition in %B section %A"),
tbfd, ntbfd, ntsec, h->root.root.string);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If the old symbol has non-default visibility, we ignore the new
definition from a dynamic object. */
if (newdyn
&& ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& !bfd_is_und_section (sec))
{
*skip = TRUE;
/* Make sure this symbol is dynamic. */
2004-09-16 16:52:12 +02:00
h->ref_dynamic = 1;
hi->ref_dynamic = 1;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* A protected symbol has external availability. Make sure it is
recorded as dynamic.
FIXME: Should we check type and size for protected symbol? */
if (ELF_ST_VISIBILITY (h->other) == STV_PROTECTED)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return bfd_elf_link_record_dynamic_symbol (info, h);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
else
return TRUE;
}
else if (!newdyn
&& ELF_ST_VISIBILITY (sym->st_other) != STV_DEFAULT
2004-09-16 16:52:12 +02:00
&& h->def_dynamic)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
/* If the new symbol with non-default visibility comes from a
relocatable file and the old definition comes from a dynamic
object, we remove the old definition. */
if (hi->root.type == bfd_link_hash_indirect)
{
/* Handle the case where the old dynamic definition is
default versioned. We need to copy the symbol info from
the symbol with default version to the normal one if it
was referenced before. */
if (h->ref_regular)
{
hi->root.type = h->root.type;
h->root.type = bfd_link_hash_indirect;
(*bed->elf_backend_copy_indirect_symbol) (info, hi, h);
h->root.u.i.link = (struct bfd_link_hash_entry *) hi;
if (ELF_ST_VISIBILITY (sym->st_other) != STV_PROTECTED)
{
/* If the new symbol is hidden or internal, completely undo
any dynamic link state. */
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
h->forced_local = 0;
h->ref_dynamic = 0;
}
else
h->ref_dynamic = 1;
h->def_dynamic = 0;
/* FIXME: Should we check type and size for protected symbol? */
h->size = 0;
h->type = 0;
h = hi;
}
else
h = hi;
}
/* If the old symbol was undefined before, then it will still be
on the undefs list. If the new symbol is undefined or
common, we can't make it bfd_link_hash_new here, because new
undefined or common symbols will be added to the undefs list
by _bfd_generic_link_add_one_symbol. Symbols may not be
added twice to the undefs list. Also, if the new symbol is
undefweak then we don't want to lose the strong undef. */
if (h->root.u.undef.next || info->hash->undefs_tail == &h->root)
{
h->root.type = bfd_link_hash_undefined;
h->root.u.undef.abfd = abfd;
}
else
{
h->root.type = bfd_link_hash_new;
h->root.u.undef.abfd = NULL;
}
if (ELF_ST_VISIBILITY (sym->st_other) != STV_PROTECTED)
1999-05-03 09:29:11 +02:00
{
/* If the new symbol is hidden or internal, completely undo
any dynamic link state. */
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
h->forced_local = 0;
h->ref_dynamic = 0;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
else
h->ref_dynamic = 1;
h->def_dynamic = 0;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* FIXME: Should we check type and size for protected symbol? */
h->size = 0;
h->type = 0;
return TRUE;
}
/* If a new weak symbol definition comes from a regular file and the
old symbol comes from a dynamic library, we treat the new one as
strong. Similarly, an old weak symbol definition from a regular
file is treated as strong when the new symbol comes from a dynamic
library. Further, an old weak symbol from a dynamic library is
treated as strong if the new symbol is from a dynamic library.
This reflects the way glibc's ld.so works.
Do this before setting *type_change_ok or *size_change_ok so that
we warn properly when dynamic library symbols are overridden. */
if (newdef && !newdyn && olddyn)
newweak = FALSE;
if (olddef && newdyn)
oldweak = FALSE;
/* Allow changes between different types of function symbol. */
if (newfunc && oldfunc)
*type_change_ok = TRUE;
/* It's OK to change the type if either the existing symbol or the
new symbol is weak. A type change is also OK if the old symbol
is undefined and the new symbol is defined. */
1999-05-03 09:29:11 +02:00
if (oldweak
|| newweak
|| (newdef
&& h->root.type == bfd_link_hash_undefined))
*type_change_ok = TRUE;
/* It's OK to change the size if either the existing symbol or the
new symbol is weak, or if the old symbol is undefined. */
if (*type_change_ok
|| h->root.type == bfd_link_hash_undefined)
*size_change_ok = TRUE;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old
symbol, respectively, appears to be a common symbol in a dynamic
object. If a symbol appears in an uninitialized section, and is
not weak, and is not a function, then it may be a common symbol
which was resolved when the dynamic object was created. We want
to treat such symbols specially, because they raise special
considerations when setting the symbol size: if the symbol
appears as a common symbol in a regular object, and the size in
the regular object is larger, we must make sure that we use the
larger size. This problematic case can always be avoided in C,
but it must be handled correctly when using Fortran shared
libraries.
Note that if NEWDYNCOMMON is set, NEWDEF will be set, and
likewise for OLDDYNCOMMON and OLDDEF.
Note that this test is just a heuristic, and that it is quite
possible to have an uninitialized symbol in a shared object which
is really a definition, rather than a common symbol. This could
lead to some minor confusion when the symbol really is a common
symbol in some regular object. However, I think it will be
harmless. */
if (newdyn
&& newdef
&& !newweak
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& (sec->flags & SEC_ALLOC) != 0
&& (sec->flags & SEC_LOAD) == 0
&& sym->st_size > 0
&& !newfunc)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
newdyncommon = TRUE;
else
newdyncommon = FALSE;
if (olddyn
&& olddef
&& h->root.type == bfd_link_hash_defined
2004-09-16 16:52:12 +02:00
&& h->def_dynamic
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& (h->root.u.def.section->flags & SEC_ALLOC) != 0
&& (h->root.u.def.section->flags & SEC_LOAD) == 0
&& h->size > 0
&& !oldfunc)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
olddyncommon = TRUE;
else
olddyncommon = FALSE;
/* We now know everything about the old and new symbols. We ask the
backend to check if we can merge them. */
if (bed->merge_symbol != NULL)
{
if (!bed->merge_symbol (h, sym, psec, newdef, olddef, oldbfd, oldsec))
return FALSE;
sec = *psec;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If both the old and the new symbols look like common symbols in a
dynamic object, set the size of the symbol to the larger of the
two. */
if (olddyncommon
&& newdyncommon
&& sym->st_size != h->size)
{
/* Since we think we have two common symbols, issue a multiple
common warning if desired. Note that we only warn if the
size is different. If the size is the same, we simply let
the old symbol override the new one as normally happens with
symbols defined in dynamic objects. */
if (! ((*info->callbacks->multiple_common)
(info, &h->root, abfd, bfd_link_hash_common, sym->st_size)))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
1999-05-03 09:29:11 +02:00
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (sym->st_size > h->size)
h->size = sym->st_size;
1999-05-03 09:29:11 +02:00
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
*size_change_ok = TRUE;
1999-05-03 09:29:11 +02:00
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If we are looking at a dynamic object, and we have found a
definition, we need to see if the symbol was already defined by
some other object. If so, we want to use the existing
definition, and we do not want to report a multiple symbol
definition error; we do this by clobbering *PSEC to be
bfd_und_section_ptr.
We treat a common symbol as a definition if the symbol in the
shared library is a function, since common symbols always
represent variables; this can cause confusion in principle, but
any such confusion would seem to indicate an erroneous program or
shared library. We also permit a common symbol in a regular
object to override a weak symbol in a shared object. A common
symbol in executable also overrides a symbol in a shared object. */
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (newdyn
&& newdef
&& (olddef
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
|| (h->root.type == bfd_link_hash_common
&& (newweak
|| newfunc
|| (!olddyn && bfd_link_executable (info))))))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
*override = TRUE;
newdef = FALSE;
newdyncommon = FALSE;
1999-05-03 09:29:11 +02:00
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
*psec = sec = bfd_und_section_ptr;
*size_change_ok = TRUE;
1999-05-03 09:29:11 +02:00
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If we get here when the old symbol is a common symbol, then
we are explicitly letting it override a weak symbol or
function in a dynamic object, and we don't want to warn about
a type change. If the old symbol is a defined symbol, a type
change warning may still be appropriate. */
1999-05-03 09:29:11 +02:00
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (h->root.type == bfd_link_hash_common)
*type_change_ok = TRUE;
}
/* Handle the special case of an old common symbol merging with a
new symbol which looks like a common symbol in a shared object.
We change *PSEC and *PVALUE to make the new symbol look like a
common symbol, and let _bfd_generic_link_add_one_symbol do the
right thing. */
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (newdyncommon
&& h->root.type == bfd_link_hash_common)
{
*override = TRUE;
newdef = FALSE;
newdyncommon = FALSE;
*pvalue = sym->st_size;
*psec = sec = bed->common_section (oldsec);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
*size_change_ok = TRUE;
}
/* Skip weak definitions of symbols that are already defined. */
if (newdef && olddef && newweak)
{
/* Don't skip new non-IR weak syms. */
if (!(oldbfd != NULL
&& (oldbfd->flags & BFD_PLUGIN) != 0
&& (abfd->flags & BFD_PLUGIN) == 0))
{
newdef = FALSE;
*skip = TRUE;
}
/* Merge st_other. If the symbol already has a dynamic index,
but visibility says it should not be visible, turn it into a
local symbol. */
elf_merge_st_other (abfd, h, sym, sec, newdef, newdyn);
if (h->dynindx != -1)
switch (ELF_ST_VISIBILITY (h->other))
{
case STV_INTERNAL:
case STV_HIDDEN:
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
break;
}
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If the old symbol is from a dynamic object, and the new symbol is
a definition which is not from a dynamic object, then the new
symbol overrides the old symbol. Symbols from regular files
always take precedence over symbols from dynamic objects, even if
they are defined after the dynamic object in the link.
As above, we again permit a common symbol in a regular object to
override a definition in a shared object if the shared object
symbol is a function or is weak. */
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
flip = NULL;
if (!newdyn
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& (newdef
|| (bfd_is_com_section (sec)
&& (oldweak || oldfunc)))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& olddyn
&& olddef
2004-09-16 16:52:12 +02:00
&& h->def_dynamic)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
/* Change the hash table entry to undefined, and let
_bfd_generic_link_add_one_symbol do the right thing with the
new definition. */
h->root.type = bfd_link_hash_undefined;
h->root.u.undef.abfd = h->root.u.def.section->owner;
*size_change_ok = TRUE;
olddef = FALSE;
olddyncommon = FALSE;
/* We again permit a type change when a common symbol may be
overriding a function. */
if (bfd_is_com_section (sec))
{
if (oldfunc)
{
/* If a common symbol overrides a function, make sure
that it isn't defined dynamically nor has type
function. */
h->def_dynamic = 0;
h->type = STT_NOTYPE;
}
*type_change_ok = TRUE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (hi->root.type == bfd_link_hash_indirect)
flip = hi;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
else
/* This union may have been set to be non-NULL when this symbol
was seen in a dynamic object. We must force the union to be
NULL, so that it is correct for a regular symbol. */
h->verinfo.vertree = NULL;
}
/* Handle the special case of a new common symbol merging with an
old symbol that looks like it might be a common symbol defined in
a shared object. Note that we have already handled the case in
which a new common symbol should simply override the definition
in the shared library. */
if (! newdyn
&& bfd_is_com_section (sec)
&& olddyncommon)
{
/* It would be best if we could set the hash table entry to a
common symbol, but we don't know what to use for the section
or the alignment. */
if (! ((*info->callbacks->multiple_common)
(info, &h->root, abfd, bfd_link_hash_common, sym->st_size)))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
/* If the presumed common symbol in the dynamic object is
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
larger, pretend that the new symbol has its size. */
if (h->size > *pvalue)
*pvalue = h->size;
/* We need to remember the alignment required by the symbol
in the dynamic object. */
BFD_ASSERT (pold_alignment);
*pold_alignment = h->root.u.def.section->alignment_power;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
olddef = FALSE;
olddyncommon = FALSE;
h->root.type = bfd_link_hash_undefined;
h->root.u.undef.abfd = h->root.u.def.section->owner;
*size_change_ok = TRUE;
*type_change_ok = TRUE;
if (hi->root.type == bfd_link_hash_indirect)
flip = hi;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
else
h->verinfo.vertree = NULL;
}
if (flip != NULL)
{
/* Handle the case where we had a versioned symbol in a dynamic
library and now find a definition in a normal object. In this
case, we make the versioned symbol point to the normal one. */
flip->root.type = h->root.type;
flip->root.u.undef.abfd = h->root.u.undef.abfd;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
h->root.type = bfd_link_hash_indirect;
h->root.u.i.link = (struct bfd_link_hash_entry *) flip;
(*bed->elf_backend_copy_indirect_symbol) (info, flip, h);
2004-09-16 16:52:12 +02:00
if (h->def_dynamic)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
2004-09-16 16:52:12 +02:00
h->def_dynamic = 0;
flip->ref_dynamic = 1;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
}
return TRUE;
}
/* This function is called to create an indirect symbol from the
default for the symbol with the default version if needed. The
symbol is described by H, NAME, SYM, SEC, and VALUE. We
set DYNSYM if the new indirect symbol is dynamic. */
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
static bfd_boolean
_bfd_elf_add_default_symbol (bfd *abfd,
struct bfd_link_info *info,
struct elf_link_hash_entry *h,
const char *name,
Elf_Internal_Sym *sym,
asection *sec,
bfd_vma value,
bfd **poldbfd,
bfd_boolean *dynsym)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
bfd_boolean type_change_ok;
bfd_boolean size_change_ok;
bfd_boolean skip;
char *shortname;
struct elf_link_hash_entry *hi;
struct bfd_link_hash_entry *bh;
const struct elf_backend_data *bed;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
bfd_boolean collect;
bfd_boolean dynamic;
bfd_boolean override;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
char *p;
size_t len, shortlen;
asection *tmp_sec;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
bfd_boolean matched;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (h->versioned == unversioned || h->versioned == versioned_hidden)
return TRUE;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If this symbol has a version, and it is the default version, we
create an indirect symbol from the default name to the fully
decorated name. This will cause external references which do not
specify a version to be bound to this version of the symbol. */
p = strchr (name, ELF_VER_CHR);
if (h->versioned == unknown)
{
if (p == NULL)
{
h->versioned = unversioned;
return TRUE;
}
else
{
if (p[1] != ELF_VER_CHR)
{
h->versioned = versioned_hidden;
return TRUE;
}
else
h->versioned = versioned;
}
}
else
{
/* PR ld/19073: We may see an unversioned definition after the
default version. */
if (p == NULL)
return TRUE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
bed = get_elf_backend_data (abfd);
collect = bed->collect;
dynamic = (abfd->flags & DYNAMIC) != 0;
shortlen = p - name;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
shortname = (char *) bfd_hash_allocate (&info->hash->table, shortlen + 1);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (shortname == NULL)
return FALSE;
memcpy (shortname, name, shortlen);
shortname[shortlen] = '\0';
/* We are going to create a new symbol. Merge it with any existing
symbol with this name. For the purposes of the merge, act as
though we were defining the symbol we just defined, although we
actually going to define an indirect symbol. */
type_change_ok = FALSE;
size_change_ok = FALSE;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
matched = TRUE;
tmp_sec = sec;
if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &tmp_sec, &value,
&hi, poldbfd, NULL, NULL, &skip, &override,
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
&type_change_ok, &size_change_ok, &matched))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
if (skip)
goto nondefault;
if (! override)
{
/* Add the default symbol if not performing a relocatable link. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (! bfd_link_relocatable (info))
{
bh = &hi->root;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, shortname, BSF_INDIRECT,
bfd_ind_section_ptr,
0, name, FALSE, collect, &bh)))
return FALSE;
hi = (struct elf_link_hash_entry *) bh;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
else
{
/* In this case the symbol named SHORTNAME is overriding the
indirect symbol we want to add. We were planning on making
SHORTNAME an indirect symbol referring to NAME. SHORTNAME
is the name without a version. NAME is the fully versioned
name, and it is the default version.
Overriding means that we already saw a definition for the
symbol SHORTNAME in a regular object, and it is overriding
the symbol defined in the dynamic object.
When this happens, we actually want to change NAME, the
symbol we just added, to refer to SHORTNAME. This will cause
references to NAME in the shared object to become references
to SHORTNAME in the regular object. This is what we expect
when we override a function in a shared object: that the
references in the shared object will be mapped to the
definition in the regular object. */
while (hi->root.type == bfd_link_hash_indirect
|| hi->root.type == bfd_link_hash_warning)
hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
h->root.type = bfd_link_hash_indirect;
h->root.u.i.link = (struct bfd_link_hash_entry *) hi;
2004-09-16 16:52:12 +02:00
if (h->def_dynamic)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
2004-09-16 16:52:12 +02:00
h->def_dynamic = 0;
hi->ref_dynamic = 1;
if (hi->ref_regular
|| hi->def_regular)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! bfd_elf_link_record_dynamic_symbol (info, hi))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
}
}
/* Now set HI to H, so that the following code will set the
other fields correctly. */
hi = h;
}
/* Check if HI is a warning symbol. */
if (hi->root.type == bfd_link_hash_warning)
hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If there is a duplicate definition somewhere, then HI may not
point to an indirect symbol. We will have reported an error to
the user in that case. */
if (hi->root.type == bfd_link_hash_indirect)
{
struct elf_link_hash_entry *ht;
ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
(*bed->elf_backend_copy_indirect_symbol) (info, ht, hi);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* A reference to the SHORTNAME symbol from a dynamic library
will be satisfied by the versioned symbol at runtime. In
effect, we have a reference to the versioned symbol. */
ht->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak;
hi->dynamic_def |= ht->dynamic_def;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* See if the new flags lead us to realize that the symbol must
be dynamic. */
if (! *dynsym)
{
if (! dynamic)
{
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (! bfd_link_executable (info)
|| hi->def_dynamic
2004-09-16 16:52:12 +02:00
|| hi->ref_dynamic)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
*dynsym = TRUE;
}
else
{
2004-09-16 16:52:12 +02:00
if (hi->ref_regular)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
*dynsym = TRUE;
}
}
}
/* We also need to define an indirection from the nondefault version
of the symbol. */
nondefault:
len = strlen (name);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
shortname = (char *) bfd_hash_allocate (&info->hash->table, len);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (shortname == NULL)
return FALSE;
memcpy (shortname, name, shortlen);
memcpy (shortname + shortlen, p + 1, len - shortlen);
/* Once again, merge with any existing symbol. */
type_change_ok = FALSE;
size_change_ok = FALSE;
tmp_sec = sec;
if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &tmp_sec, &value,
&hi, poldbfd, NULL, NULL, &skip, &override,
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
&type_change_ok, &size_change_ok, &matched))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
if (skip)
return TRUE;
if (override)
{
/* Here SHORTNAME is a versioned name, so we don't expect to see
the type of override we do in the case above unless it is
overridden by a versioned definition. */
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (hi->root.type != bfd_link_hash_defined
&& hi->root.type != bfd_link_hash_defweak)
(*_bfd_error_handler)
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
(_("%B: unexpected redefinition of indirect versioned symbol `%s'"),
abfd, shortname);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
else
{
bh = &hi->root;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, shortname, BSF_INDIRECT,
bfd_ind_section_ptr, 0, name, FALSE, collect, &bh)))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
hi = (struct elf_link_hash_entry *) bh;
/* If there is a duplicate definition somewhere, then HI may not
point to an indirect symbol. We will have reported an error
to the user in that case. */
if (hi->root.type == bfd_link_hash_indirect)
{
(*bed->elf_backend_copy_indirect_symbol) (info, h, hi);
h->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak;
hi->dynamic_def |= h->dynamic_def;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* See if the new flags lead us to realize that the symbol
must be dynamic. */
if (! *dynsym)
{
if (! dynamic)
{
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (! bfd_link_executable (info)
2004-09-16 16:52:12 +02:00
|| hi->ref_dynamic)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
*dynsym = TRUE;
}
else
{
2004-09-16 16:52:12 +02:00
if (hi->ref_regular)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
*dynsym = TRUE;
}
}
}
}
return TRUE;
}
/* This routine is used to export all defined symbols into the dynamic
symbol table. It is called via elf_link_hash_traverse. */
static bfd_boolean
_bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct elf_info_failed *eif = (struct elf_info_failed *) data;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
* linker.c (bfd_link_hash_traverse): Follow warning symbol link. (_bfd_generic_link_write_global_symbol, fix_syms): Don't handle warning symbols here. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.c (allocate_dynrelocs_for_symbol, elf32_arm_readonly_dynrelocs): Likewise. * elf32-bfin.c (bfin_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): Likewise. * elf32-hppa.c (allocate_plt_static, allocate_dynrelocs, clobber_millicode_symbols, readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-i386.c (elf_i386_allocate_dynrelocs, elf_i386_readonly_dynrelocs): Likewise. * elf32-lm32.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m32c.c (m32c_relax_plt_check, m32c_relax_plt_realloc): Likewise. * elf32-m32r.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-microblaze.c (allocate_dynrelocs): Likewise. * elf32-ppc.c (allocate_dynrelocs, maybe_set_textrel): Likewise. * elf32-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-score.c (score_elf_sort_hash_table_f): Likewise. * elf32-score7.c (score_elf_sort_hash_table_f): Likewise. * elf32-sh.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-tic6x.c (elf32_tic6x_allocate_dynrelocs, elf32_tic6x_readonly_dynrelocs): Likewise. * elf32-vax.c (elf_vax_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check, xstormy16_relax_plt_realloc): Likewise. * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_1): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions, allocate_global_data_opd, elf64_hppa_mark_milli_and_exported_functions, elf_hppa_unmark_useless_dynamic_symbols, elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref, func_desc_adjust, adjust_opd_syms, adjust_toc_syms, allocate_dynrelocs, readonly_dynrelocs, merge_global_got, reallocate_got, undo_symbol_twiddle): Likewise. * elf64-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs, elf_x86_64_readonly_dynrelocs): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms, elf_link_renumber_local_hash_table_dynsyms, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms, elf_adjust_dynstr_offsets, elf_collect_hash_codes, elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, elf_gc_sweep_symbol, elf_gc_propagate_vtable_entries_used, elf_gc_smash_unused_vtentry_relocs, bfd_elf_gc_mark_dynamic_ref_symbol, elf_gc_allocate_got_offsets): Likewise. * elfnn-ia64.c (elfNN_ia64_global_dyn_info_free, elfNN_ia64_global_dyn_sym_thunk): Likewise. * elfxx-mips.c (mips_elf_check_symbols, mips_elf_output_extsym, mips_elf_sort_hash_table_f, allocate_dynrelocs): Likewise. * elfxx-sparc.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_post_gc_symbol): Likewise. * elflink.c (elf_link_output_extsym): Make it a bfd_hash_traverse function. Update all callers. * aoutx.h (aout_link_write_other_symbol): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * ecoff.c (ecoff_link_write_external): Likewise. * xcofflink.c (xcoff_write_global_symbol): Likewise. * vms-alpha.c (alpha_vms_link_output_symbol): Likewise. Handle warning symbols. * ecoff.c (ecoff_link_hash_traverse): Delete. * coff-ppc.c (ppc_bfd_coff_final_link): Use bfd_hash_traverse for _bfd_coff_write_global_sym. * libcoff-in.h (_bfd_coff_write_global_sym): Update prototype. * libcoff.h: Regenerate.
2011-06-13 02:59:15 +02:00
/* Ignore this if we won't export it. */
if (!eif->info->export_dynamic && !h->dynamic)
return TRUE;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (h->dynindx == -1
&& (h->def_regular || h->ref_regular)
&& ! bfd_hide_sym_by_version (eif->info->version_info,
h->root.root.string))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
if (! bfd_elf_link_record_dynamic_symbol (eif->info, h))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
eif->failed = TRUE;
return FALSE;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
}
return TRUE;
}
/* Look through the symbols which are defined in other shared
libraries and referenced here. Update the list of version
dependencies. This will be put into the .gnu.version_r section.
This function is called via elf_link_hash_traverse. */
static bfd_boolean
_bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
void *data)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
Elf_Internal_Verneed *t;
Elf_Internal_Vernaux *a;
bfd_size_type amt;
/* We only care about symbols defined in shared objects with version
information. */
2004-09-16 16:52:12 +02:00
if (!h->def_dynamic
|| h->def_regular
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
|| h->dynindx == -1
|| h->verinfo.verdef == NULL
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)
& (DYN_AS_NEEDED | DYN_DT_NEEDED | DYN_NO_NEEDED)))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return TRUE;
/* See if we already know about this version. */
for (t = elf_tdata (rinfo->info->output_bfd)->verref;
t != NULL;
t = t->vn_nextref)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
if (t->vn_bfd != h->verinfo.verdef->vd_bfd)
continue;
for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
if (a->vna_nodename == h->verinfo.verdef->vd_nodename)
return TRUE;
break;
}
/* This is a new version. Add it to tree we are building. */
if (t == NULL)
{
amt = sizeof *t;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->info->output_bfd, amt);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (t == NULL)
{
rinfo->failed = TRUE;
return FALSE;
}
t->vn_bfd = h->verinfo.verdef->vd_bfd;
t->vn_nextref = elf_tdata (rinfo->info->output_bfd)->verref;
elf_tdata (rinfo->info->output_bfd)->verref = t;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
amt = sizeof *a;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->info->output_bfd, amt);
if (a == NULL)
{
rinfo->failed = TRUE;
return FALSE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Note that we are copying a string pointer here, and testing it
above. If bfd_elf_string_from_elf_section is ever changed to
discard the string data when low in memory, this will have to be
fixed. */
a->vna_nodename = h->verinfo.verdef->vd_nodename;
a->vna_flags = h->verinfo.verdef->vd_flags;
a->vna_nextptr = t->vn_auxptr;
h->verinfo.verdef->vd_exp_refno = rinfo->vers;
++rinfo->vers;
a->vna_other = h->verinfo.verdef->vd_exp_refno + 1;
t->vn_auxptr = a;
return TRUE;
}
/* Figure out appropriate versions for all the symbols. We may not
have the version number script until we have read all of the input
files, so until that point we don't know which symbols should be
local. This function is called via elf_link_hash_traverse. */
static bfd_boolean
_bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
struct elf_info_failed *sinfo;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
struct bfd_link_info *info;
const struct elf_backend_data *bed;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
struct elf_info_failed eif;
char *p;
bfd_size_type amt;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
sinfo = (struct elf_info_failed *) data;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
info = sinfo->info;
/* Fix the symbol flags. */
eif.failed = FALSE;
eif.info = info;
if (! _bfd_elf_fix_symbol_flags (h, &eif))
{
if (eif.failed)
sinfo->failed = TRUE;
return FALSE;
}
/* We only need version numbers for symbols defined in regular
objects. */
2004-09-16 16:52:12 +02:00
if (!h->def_regular)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return TRUE;
bed = get_elf_backend_data (info->output_bfd);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
p = strchr (h->root.root.string, ELF_VER_CHR);
if (p != NULL && h->verinfo.vertree == NULL)
{
struct bfd_elf_version_tree *t;
++p;
if (*p == ELF_VER_CHR)
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
++p;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If there is no version string, we can just return out. */
if (*p == '\0')
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
return TRUE;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Look for the version. If we find it, it is no longer weak. */
for (t = sinfo->info->version_info; t != NULL; t = t->next)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
if (strcmp (t->name, p) == 0)
{
size_t len;
char *alc;
struct bfd_elf_version_expr *d;
len = p - h->root.root.string;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
alc = (char *) bfd_malloc (len);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (alc == NULL)
{
sinfo->failed = TRUE;
return FALSE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
memcpy (alc, h->root.root.string, len - 1);
alc[len - 1] = '\0';
if (alc[len - 2] == ELF_VER_CHR)
alc[len - 2] = '\0';
h->verinfo.vertree = t;
t->used = TRUE;
d = NULL;
if (t->globals.list != NULL)
d = (*t->match) (&t->globals, NULL, alc);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* See if there is anything to force this symbol to
local scope. */
if (d == NULL && t->locals.list != NULL)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
d = (*t->match) (&t->locals, NULL, alc);
if (d != NULL
&& h->dynindx != -1
&& ! info->export_dynamic)
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
free (alc);
break;
}
}
/* If we are building an application, we need to create a
version node for this version. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (t == NULL && bfd_link_executable (info))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
struct bfd_elf_version_tree **pp;
int version_index;
/* If we aren't going to export this symbol, we don't need
to worry about it. */
if (h->dynindx == -1)
return TRUE;
amt = sizeof *t;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
t = (struct bfd_elf_version_tree *) bfd_zalloc (info->output_bfd, amt);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (t == NULL)
{
sinfo->failed = TRUE;
return FALSE;
}
t->name = p;
t->name_indx = (unsigned int) -1;
t->used = TRUE;
version_index = 1;
/* Don't count anonymous version tag. */
if (sinfo->info->version_info != NULL
&& sinfo->info->version_info->vernum == 0)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
version_index = 0;
for (pp = &sinfo->info->version_info;
*pp != NULL;
pp = &(*pp)->next)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
++version_index;
t->vernum = version_index;
*pp = t;
h->verinfo.vertree = t;
}
else if (t == NULL)
{
/* We could not find the version for a symbol when
generating a shared archive. Return an error. */
(*_bfd_error_handler)
(_("%B: version node not found for symbol %s"),
info->output_bfd, h->root.root.string);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
bfd_set_error (bfd_error_bad_value);
sinfo->failed = TRUE;
return FALSE;
}
}
/* If we don't have a version for this symbol, see if we can find
something. */
if (h->verinfo.vertree == NULL && sinfo->info->version_info != NULL)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
bfd_boolean hide;
h->verinfo.vertree
= bfd_find_version_for_sym (sinfo->info->version_info,
h->root.root.string, &hide);
if (h->verinfo.vertree != NULL && hide)
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
return TRUE;
}
/* Read and swap the relocs from the section indicated by SHDR. This
may be either a REL or a RELA section. The relocations are
translated into RELA relocations and stored in INTERNAL_RELOCS,
which should have already been allocated to contain enough space.
The EXTERNAL_RELOCS are a buffer where the external form of the
relocations should be stored.
Returns FALSE if something goes wrong. */
static bfd_boolean
elf_link_read_relocs_from_section (bfd *abfd,
asection *sec,
Elf_Internal_Shdr *shdr,
void *external_relocs,
Elf_Internal_Rela *internal_relocs)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
const struct elf_backend_data *bed;
void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
const bfd_byte *erela;
const bfd_byte *erelaend;
Elf_Internal_Rela *irela;
Elf_Internal_Shdr *symtab_hdr;
size_t nsyms;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Position ourselves at the start of the section. */
if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0)
return FALSE;
/* Read the relocations. */
if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
return FALSE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
nsyms = NUM_SHDR_ENTRIES (symtab_hdr);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
bed = get_elf_backend_data (abfd);
/* Convert the external relocations to the internal format. */
if (shdr->sh_entsize == bed->s->sizeof_rel)
swap_in = bed->s->swap_reloc_in;
else if (shdr->sh_entsize == bed->s->sizeof_rela)
swap_in = bed->s->swap_reloca_in;
else
{
bfd_set_error (bfd_error_wrong_format);
return FALSE;
}
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
erela = (const bfd_byte *) external_relocs;
erelaend = erela + shdr->sh_size;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
irela = internal_relocs;
while (erela < erelaend)
{
bfd_vma r_symndx;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
(*swap_in) (abfd, erela, irela);
r_symndx = ELF32_R_SYM (irela->r_info);
if (bed->s->arch_size == 64)
r_symndx >>= 24;
if (nsyms > 0)
{
if ((size_t) r_symndx >= nsyms)
{
(*_bfd_error_handler)
(_("%B: bad reloc symbol index (0x%lx >= 0x%lx)"
" for offset 0x%lx in section `%A'"),
abfd, sec,
(unsigned long) r_symndx, (unsigned long) nsyms, irela->r_offset);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
}
else if (r_symndx != STN_UNDEF)
{
(*_bfd_error_handler)
(_("%B: non-zero symbol index (0x%lx) for offset 0x%lx in section `%A'"
" when the object file has no symbol table"),
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
abfd, sec,
(unsigned long) r_symndx, (unsigned long) nsyms, irela->r_offset);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
irela += bed->s->int_rels_per_ext_rel;
erela += shdr->sh_entsize;
}
return TRUE;
}
/* Read and swap the relocs for a section O. They may have been
cached. If the EXTERNAL_RELOCS and INTERNAL_RELOCS arguments are
not NULL, they are used as buffers to read into. They are known to
be large enough. If the INTERNAL_RELOCS relocs argument is NULL,
the return value is allocated using either malloc or bfd_alloc,
according to the KEEP_MEMORY argument. If O has two relocation
sections (both REL and RELA relocations), then the REL_HDR
relocations will appear first in INTERNAL_RELOCS, followed by the
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
RELA_HDR relocations. */
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
Elf_Internal_Rela *
_bfd_elf_link_read_relocs (bfd *abfd,
asection *o,
void *external_relocs,
Elf_Internal_Rela *internal_relocs,
bfd_boolean keep_memory)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
void *alloc1 = NULL;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
Elf_Internal_Rela *alloc2 = NULL;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_data *esdo = elf_section_data (o);
Elf_Internal_Rela *internal_rela_relocs;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (esdo->relocs != NULL)
return esdo->relocs;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (o->reloc_count == 0)
return NULL;
if (internal_relocs == NULL)
{
bfd_size_type size;
size = o->reloc_count;
size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
if (keep_memory)
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_alloc (abfd, size);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
else
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_malloc (size);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (internal_relocs == NULL)
goto error_return;
}
if (external_relocs == NULL)
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
bfd_size_type size = 0;
if (esdo->rel.hdr)
size += esdo->rel.hdr->sh_size;
if (esdo->rela.hdr)
size += esdo->rela.hdr->sh_size;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
alloc1 = bfd_malloc (size);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (alloc1 == NULL)
goto error_return;
external_relocs = alloc1;
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
internal_rela_relocs = internal_relocs;
if (esdo->rel.hdr)
{
if (!elf_link_read_relocs_from_section (abfd, o, esdo->rel.hdr,
external_relocs,
internal_relocs))
goto error_return;
external_relocs = (((bfd_byte *) external_relocs)
+ esdo->rel.hdr->sh_size);
internal_rela_relocs += (NUM_SHDR_ENTRIES (esdo->rel.hdr)
* bed->s->int_rels_per_ext_rel);
}
if (esdo->rela.hdr
&& (!elf_link_read_relocs_from_section (abfd, o, esdo->rela.hdr,
external_relocs,
internal_rela_relocs)))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
goto error_return;
/* Cache the results for next time, if we can. */
if (keep_memory)
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
esdo->relocs = internal_relocs;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (alloc1 != NULL)
free (alloc1);
/* Don't free alloc2, since if it was allocated we are passing it
back (under the name of internal_relocs). */
return internal_relocs;
error_return:
if (alloc1 != NULL)
free (alloc1);
if (alloc2 != NULL)
{
if (keep_memory)
bfd_release (abfd, alloc2);
else
free (alloc2);
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return NULL;
}
/* Compute the size of, and allocate space for, REL_HDR which is the
section header for a section containing relocations for O. */
static bfd_boolean
_bfd_elf_link_size_reloc_section (bfd *abfd,
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_reloc_data *reldata)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
Elf_Internal_Shdr *rel_hdr = reldata->hdr;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* That allows us to calculate the size of the section. */
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
rel_hdr->sh_size = rel_hdr->sh_entsize * reldata->count;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* The contents field must last into write_object_contents, so we
allocate it with bfd_alloc rather than malloc. Also since we
cannot be sure that the contents will actually be filled in,
we zero the allocated space. */
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
rel_hdr->contents = (unsigned char *) bfd_zalloc (abfd, rel_hdr->sh_size);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
return FALSE;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (reldata->hashes == NULL && reldata->count)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
struct elf_link_hash_entry **p;
p = ((struct elf_link_hash_entry **)
bfd_zmalloc (reldata->count * sizeof (*p)));
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (p == NULL)
return FALSE;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
reldata->hashes = p;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
return TRUE;
}
/* Copy the relocations indicated by the INTERNAL_RELOCS (which
originated from the section given by INPUT_REL_HDR) to the
OUTPUT_BFD. */
bfd_boolean
_bfd_elf_link_output_relocs (bfd *output_bfd,
asection *input_section,
Elf_Internal_Shdr *input_rel_hdr,
2005-05-05 Paul Brook <paul@codesourcery.com> bfd/ * config.bfd: Use bfd_elf32_i386_vxworks_vec for i?86-*-vxworks. * configure.in: Add bfd_elf32_i386_vxworks_vec. i386 targets need elf-vxworks.lo. * configure: Regenerate. * Makefile.am (BFD32_BACKENDS): Add elf-vxworks.lo. (BFD32_BACKENDS_CFILES): Add elf-vxworks.c. (elf32-i386.lo): Depend on elf-vxworks.h. (elf-vxworks.lo): New rule. * Makefile.in: Regenerate. * elf-bfd.h (elf_backend_data): Update type of elf_backend_emit_relocs. (_bfd_elf_link_output_relocs): Update prototype. * elflink.c (_bfd_elf_link_output_relocs): Always use bed->elf_backend_emit_relocs when outputting relocations. * elfxx-target.h (elf_backend_emit_relocs): Default to _bfd_elf_link_output_relocs. * targets.c (bfd_elf32_i386_vxworks_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_vxworks_vec. * elf32-i386.c: Add elf32-i386-vxworks target BFD. (elf_i386_plt0_entry): Remove padding. (elf_i386_pic_plt0_entry): Ditto. (PLTRESOLVE_RELOCS_SHLIB, PLTRESOLVE_RELOCS): Define. (PLT_NON_JUMP_SLOT_RELOCS): Define. (elf_i386_link_hash_table): Add srelplt2, hgot, hplt, is_vxworks and plt0_pad_byte fields. (elf_i386_link_hash_table_create): Zero them. (elf_i386_create_dynamic_sections): Create static relocation section. (allocate_dynrelocs): Allocate space for static PLT relocations. (elf_i386_size_dynamic_sections): Save shortcuts to PLT and GOT symbols. Give PLT symbols function type. Don't strip PLT sections if we have exported symbols from them. (elf_i386_finish_dynamic_symbol): Fill in VxWorks PLT static relocation section. Don't mark _GLOBAL_OFFSET_TABLE_ as absolute on VxWorks. (elf_i386_finish_dynamic_sections): Allow different pad bytes. Add relocation for GOT location. Fill in PLT static relocations. (elf_i386_vxworks_link_hash_table_create): New function. (elf_i386_vxworks_link_output_symbol_hook): New function. * elf-vxworks.h: New file. gas/ * config/tc-i386.h (ELF_TARGET_FORMAT): Define for TE_VXWORKS. gas/testsuite/ * gas/i386/i386.exp: Don't run divide test on vxworks. ld/ * Makefile.am: Add eelf_i386_vxworks. * Makefile.in: Regenerate. * configure.tgt: Make i?86-*-vxworks use targ_emul=elf_i386_vxworks. * emulparams/elf_i386_vxworks.sh: New file. * emulparams/vxworks.sh: New file. * scripttempl/elf.sc: Add DATA_END_SYMBOLS and ETEXT_NAME.
2005-05-05 16:37:27 +02:00
Elf_Internal_Rela *internal_relocs,
struct elf_link_hash_entry **rel_hash
ATTRIBUTE_UNUSED)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
bfd_byte *erel;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_reloc_data *output_reldata;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
asection *output_section;
const struct elf_backend_data *bed;
void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_data *esdo;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
output_section = input_section->output_section;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
bed = get_elf_backend_data (output_bfd);
esdo = elf_section_data (output_section);
if (esdo->rel.hdr && esdo->rel.hdr->sh_entsize == input_rel_hdr->sh_entsize)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
output_reldata = &esdo->rel;
swap_out = bed->s->swap_reloc_out;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
else if (esdo->rela.hdr
&& esdo->rela.hdr->sh_entsize == input_rel_hdr->sh_entsize)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
output_reldata = &esdo->rela;
swap_out = bed->s->swap_reloca_out;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
else
{
(*_bfd_error_handler)
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
(_("%B: relocation size mismatch in %B section %A"),
output_bfd, input_section->owner, input_section);
bfd_set_error (bfd_error_wrong_format);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
erel = output_reldata->hdr->contents;
erel += output_reldata->count * input_rel_hdr->sh_entsize;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
irela = internal_relocs;
irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr)
* bed->s->int_rels_per_ext_rel);
while (irela < irelaend)
{
(*swap_out) (output_bfd, irela, erel);
irela += bed->s->int_rels_per_ext_rel;
erel += input_rel_hdr->sh_entsize;
}
/* Bump the counter, so that we know where to add the next set of
relocations. */
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
output_reldata->count += NUM_SHDR_ENTRIES (input_rel_hdr);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return TRUE;
}
/* Make weak undefined symbols in PIE dynamic. */
bfd_boolean
_bfd_elf_link_hash_fixup_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *h)
{
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_pie (info)
&& h->dynindx == -1
&& h->root.type == bfd_link_hash_undefweak)
return bfd_elf_link_record_dynamic_symbol (info, h);
return TRUE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Fix up the flags for a symbol. This handles various cases which
can only be fixed after all the input files are seen. This is
currently called by both adjust_dynamic_symbol and
assign_sym_version, which is unnecessary but perhaps more robust in
the face of future changes. */
static bfd_boolean
_bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
struct elf_info_failed *eif)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
const struct elf_backend_data *bed;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If this symbol was mentioned in a non-ELF file, try to set
DEF_REGULAR and REF_REGULAR correctly. This is the only way to
permit a non-ELF file to correctly refer to a symbol defined in
an ELF dynamic object. */
2004-09-16 16:52:12 +02:00
if (h->non_elf)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
while (h->root.type == bfd_link_hash_indirect)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
2004-09-16 16:52:12 +02:00
{
h->ref_regular = 1;
h->ref_regular_nonweak = 1;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
else
{
if (h->root.u.def.section->owner != NULL
&& (bfd_get_flavour (h->root.u.def.section->owner)
== bfd_target_elf_flavour))
2004-09-16 16:52:12 +02:00
{
h->ref_regular = 1;
h->ref_regular_nonweak = 1;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
else
2004-09-16 16:52:12 +02:00
h->def_regular = 1;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
if (h->dynindx == -1
2004-09-16 16:52:12 +02:00
&& (h->def_dynamic
|| h->ref_dynamic))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! bfd_elf_link_record_dynamic_symbol (eif->info, h))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
eif->failed = TRUE;
return FALSE;
}
}
}
else
{
2004-09-16 16:52:12 +02:00
/* Unfortunately, NON_ELF is only correct if the symbol
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
was first seen in a non-ELF file. Fortunately, if the symbol
was first seen in an ELF file, we're probably OK unless the
symbol was defined in a non-ELF file. Catch that case here.
FIXME: We're still in trouble if the symbol was first seen in
a dynamic object, and then later in a non-ELF regular object. */
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
2004-09-16 16:52:12 +02:00
&& !h->def_regular
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& (h->root.u.def.section->owner != NULL
? (bfd_get_flavour (h->root.u.def.section->owner)
!= bfd_target_elf_flavour)
: (bfd_is_abs_section (h->root.u.def.section)
2004-09-16 16:52:12 +02:00
&& !h->def_dynamic)))
h->def_regular = 1;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
/* Backend specific symbol fixup. */
bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
if (bed->elf_backend_fixup_symbol
&& !(*bed->elf_backend_fixup_symbol) (eif->info, h))
return FALSE;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If this is a final link, and the symbol was defined as a common
symbol in a regular object file, and there was no definition in
any dynamic object, then the linker will have allocated space for
2004-09-16 16:52:12 +02:00
the symbol in a common section but the DEF_REGULAR
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
flag will not have been set. */
if (h->root.type == bfd_link_hash_defined
2004-09-16 16:52:12 +02:00
&& !h->def_regular
&& h->ref_regular
&& !h->def_dynamic
&& (h->root.u.def.section->owner->flags & (DYNAMIC | BFD_PLUGIN)) == 0)
2004-09-16 16:52:12 +02:00
h->def_regular = 1;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If -Bsymbolic was used (which means to bind references to global
symbols to the definition within the shared object), and this
symbol was defined in a regular object, then it actually doesn't
need a PLT entry. Likewise, if the symbol has non-default
visibility. If the symbol has hidden or internal visibility, we
will force it local. */
2004-09-16 16:52:12 +02:00
if (h->needs_plt
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& bfd_link_pic (eif->info)
* elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg. * elf.c (_bfd_elf_merge_sections): Adjust to suit. (_bfd_elf_link_just_syms): Likewise. (bfd_elf_get_needed_list): Likewise. (bfd_elf_get_runpath_list): Likewise. (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens. * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab creator flavour. (elf32_hppa_set_gp): Look up output sections rather than using htab. * elf32-i960.c: Comment fix. Formatting. * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table rather than testing creator flavour. * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise. * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for is_elf_hash_table change. Remove redundant test. (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than testing creator flavour. (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant checks. Use is_elf_hash_table rather than testing creator flavour. Use hash_table throughout in place of info->hash. (elf_add_dynamic_entry): Adjust for is_elf_hash_table change. (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant check. (elf_bfd_final_link): Adjust for is_elf_hash_table change. (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than testing creator flavour. (elf_gc_sections): Add is_elf_hash_table check. (elf_gc_common_finalize_got_offsets): Likewise. (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove redundant check. * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table rather than testing creator flavour.
2003-12-01 07:28:24 +01:00
&& is_elf_hash_table (eif->info->hash)
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
&& (SYMBOLIC_BIND (eif->info, h)
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
2004-09-16 16:52:12 +02:00
&& h->def_regular)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
bfd_boolean force_local;
force_local = (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN);
(*bed->elf_backend_hide_symbol) (eif->info, h, force_local);
}
/* If a weak undefined symbol has non-default visibility, we also
hide it from the dynamic linker. */
if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
&& h->root.type == bfd_link_hash_undefweak)
(*bed->elf_backend_hide_symbol) (eif->info, h, TRUE);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If this is a weak defined symbol in a dynamic object, and we know
the real definition in the dynamic object, copy interesting flags
over to the real definition. */
if (h->u.weakdef != NULL)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
/* If the real definition is defined by a regular object file,
don't do anything special. See the longer description in
_bfd_elf_adjust_dynamic_symbol, below. */
if (h->u.weakdef->def_regular)
h->u.weakdef = NULL;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
else
{
struct elf_link_hash_entry *weakdef = h->u.weakdef;
while (h->root.type == bfd_link_hash_indirect)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
BFD_ASSERT (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak);
BFD_ASSERT (weakdef->def_dynamic);
BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
|| weakdef->root.type == bfd_link_hash_defweak);
(*bed->elf_backend_copy_indirect_symbol) (eif->info, weakdef, h);
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
return TRUE;
}
/* Make the backend pick a good value for a dynamic symbol. This is
called via elf_link_hash_traverse, and also calls itself
recursively. */
static bfd_boolean
_bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct elf_info_failed *eif = (struct elf_info_failed *) data;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
bfd *dynobj;
const struct elf_backend_data *bed;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
* elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg. * elf.c (_bfd_elf_merge_sections): Adjust to suit. (_bfd_elf_link_just_syms): Likewise. (bfd_elf_get_needed_list): Likewise. (bfd_elf_get_runpath_list): Likewise. (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens. * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab creator flavour. (elf32_hppa_set_gp): Look up output sections rather than using htab. * elf32-i960.c: Comment fix. Formatting. * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table rather than testing creator flavour. * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise. * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for is_elf_hash_table change. Remove redundant test. (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than testing creator flavour. (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant checks. Use is_elf_hash_table rather than testing creator flavour. Use hash_table throughout in place of info->hash. (elf_add_dynamic_entry): Adjust for is_elf_hash_table change. (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant check. (elf_bfd_final_link): Adjust for is_elf_hash_table change. (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than testing creator flavour. (elf_gc_sections): Add is_elf_hash_table check. (elf_gc_common_finalize_got_offsets): Likewise. (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove redundant check. * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table rather than testing creator flavour.
2003-12-01 07:28:24 +01:00
if (! is_elf_hash_table (eif->info->hash))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
/* Fix the symbol flags. */
if (! _bfd_elf_fix_symbol_flags (h, eif))
return FALSE;
/* If this symbol does not require a PLT entry, and it is not
defined by a dynamic object, or is not referenced by a regular
object, ignore it. We do have to handle a weak defined symbol,
even if no regular object refers to it, if we decided to add it
to the dynamic symbol table. FIXME: Do we normally need to worry
about symbols which are defined by one dynamic object and
referenced by another one? */
2004-09-16 16:52:12 +02:00
if (!h->needs_plt
&& h->type != STT_GNU_IFUNC
2004-09-16 16:52:12 +02:00
&& (h->def_regular
|| !h->def_dynamic
|| (!h->ref_regular
&& (h->u.weakdef == NULL || h->u.weakdef->dynindx == -1))))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
* elf-bfd.h (struct elf_link_hash_table): Delete init_refcount and init_offset. Add init_got_refcount, init_plt_refcount, init_got_offset and init_plt_offset. * elf.c (_bfd_elf_link_hash_newfunc): Adjust for above change. (_bfd_elf_link_hash_hide_symbol): Likewise. (_bfd_elf_link_hash_table_init): Likewise. * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise. * elflink.c (_bfd_elf_adjust_dynamic_symbol): Likewise. (bfd_elf_size_dynamic_sections): Likewise. * elf32-ppc.c (GLINK_PLTRESOLVE): Now 16 insns. (LWZU_0_X_12, LWZ_0_4_30, LWZ_0_X_12, LWZ_11_X_11, LWZ_11_X_30, LWZ_12_4_12, LWZ_12_8_30, LWZ_12_X_12, SUB_11_11_30): Delete. (ADDIS_12_12, BCL_20_31, LWZU_0_12, LWZ_0_12, LWZ_11_11, LWZ_11_30, LWZ_12_12, MFLR_0, MFLR_12, MTLR_0, SUB_11_11_12): Define. (struct plt_entry): New. (ppc_elf_link_hash_table_create): Set new init_plt fields. (ppc_elf_copy_indirect_symbol): Handle merge of plt plist. Don't use _bfd_elf_link_hash_copy_indirect. (update_plt_info, find_plt_ent): New functions. (ppc_elf_check_relocs): Handle R_PPC_PLTREL24 with non-zero addend and adjust for use of plt list rather than refcount. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_adjust_dynamic_symbol): Likewise. (allocate_dynrelocs): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. Adjust R_PPC_PLTREL24 addends when performing a relocatable link. (ppc_elf_finish_dynamic_symbol): Likewise. Write .glink stubs here.. (ppc_elf_finish_dynamic_sections): ..rather than here. Use new pic resolver stub.
2005-05-19 10:26:56 +02:00
h->plt = elf_hash_table (eif->info)->init_plt_offset;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return TRUE;
}
/* If we've already adjusted this symbol, don't do it again. This
can happen via a recursive call. */
2004-09-16 16:52:12 +02:00
if (h->dynamic_adjusted)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return TRUE;
/* Don't look at this symbol again. Note that we must set this
after checking the above conditions, because we may look at a
symbol once, decide not to do anything, and then get called
recursively later after REF_REGULAR is set below. */
2004-09-16 16:52:12 +02:00
h->dynamic_adjusted = 1;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* If this is a weak definition, and we know a real definition, and
the real symbol is not itself defined by a regular object file,
then get a good value for the real definition. We handle the
real symbol first, for the convenience of the backend routine.
Note that there is a confusing case here. If the real definition
is defined by a regular object file, we don't get the real symbol
from the dynamic object, but we do get the weak symbol. If the
processor backend uses a COPY reloc, then if some routine in the
dynamic object changes the real symbol, we will not see that
change in the corresponding weak symbol. This is the way other
ELF linkers work as well, and seems to be a result of the shared
library model.
I will clarify this issue. Most SVR4 shared libraries define the
variable _timezone and define timezone as a weak synonym. The
tzset call changes _timezone. If you write
extern int timezone;
int _timezone = 5;
int main () { tzset (); printf ("%d %d\n", timezone, _timezone); }
you might expect that, since timezone is a synonym for _timezone,
the same number will print both times. However, if the processor
backend uses a COPY reloc, then actually timezone will be copied
into your process image, and, since you define _timezone
yourself, _timezone will not. Thus timezone and _timezone will
wind up at different memory locations. The tzset call will set
_timezone, leaving timezone unchanged. */
if (h->u.weakdef != NULL)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
/* If we get to this point, there is an implicit reference to
H->U.WEAKDEF by a regular object file via the weak symbol H. */
h->u.weakdef->ref_regular = 1;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Ensure that the backend adjust_dynamic_symbol function sees
H->U.WEAKDEF before H by recursively calling ourselves. */
if (! _bfd_elf_adjust_dynamic_symbol (h->u.weakdef, eif))
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
return FALSE;
}
/* If a symbol has no type and no size and does not require a PLT
entry, then we are probably about to do the wrong thing here: we
are probably going to create a COPY reloc for an empty object.
This case can arise when a shared object is built with assembly
code, and the assembly code fails to set the symbol type. */
if (h->size == 0
&& h->type == STT_NOTYPE
2004-09-16 16:52:12 +02:00
&& !h->needs_plt)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
(*_bfd_error_handler)
(_("warning: type and size of dynamic symbol `%s' are not defined"),
h->root.root.string);
dynobj = elf_hash_table (eif->info)->dynobj;
bed = get_elf_backend_data (dynobj);
include/elf/ * common.h (STT_IFUNC): Define. elfcpp/ * elfcpp.h (enum STT): Add STT_IFUNC. bfd/ * syms.c (struct bfd_symbol): Add new flag BSF_INDIRECT_FUNCTION. Remove redundant flag BFD_FORT_COMM_DEFAULT_VALUE. Renumber flags to remove gaps. (bfd_print_symbol_vandf): Return 'i' for BSF_INDIRECT_FUNCTION. (bfd_decode_symclass): Likewise. * elf.c (swap_out_syms): Translate BSF_INDIRECT_FUNCTION into STT_IFUNC. (elf_find_function): Treat STT_IFUNC in the same way as STT_FUNC. (_bfd_elf_is_function_type): Likewise. * elf32-arm.c (arm_elf_find_function): Likewise. (elf32_arm_adjust_dynamic_symbol): Likewise. (elf32_arm_swap_symbol_in): Likewise. (elf32_arm_additional_program_headers): Likewise. * elf32-i386.c (is_indirect_symbol): New function. (elf_i386_check_relocs): Also generate dynamic relocs for relocations against STT_IFUNC symbols. (allocate_dynrelocs): Likewise. (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (is_indirect_symbol): New function. (elf64_x86_64_check_relocs): Also generate dynamic relocs for relocations against STT_IFUNC symbols. (allocate_dynrelocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfcode.h (elf_slurp_symbol_table): Translate STT_IFUNC into BSF_INDIRECT_FUNCTION. * elflink.c (_bfd_elf_adjust_dynamic_reloc_section): Add support for STT_IFUNC symbols. (get_ifunc_reloc_section_name): New function. (_bfd_elf_make_ifunc_reloc_section): New function. * elf-bfd.h (struct bfd_elf_section_data): Add indirect_relocs field. * bfd-in2.h: Regenerate. gas/ * config/obj-elf.c (obj_elf_type): Add support for STT_IFUNC type. * doc/as.texinfo: Document new feature. * NEWS: Mention new feature. gas/testsuite/ * gas/elf/type.s: Add test of STT_IFUNC symbol type. * gas/elf/type.e: Update expected disassembly. * gas/elf/elf.exp: Update grep of symbol types. ld/ * NEWS: Mention new feature. * pe-dll.c (process_def_file): Replace use of redundant BFD_FORT_COMM_DEFAULT_VALUE with 0. * scripttempl/elf.sc: Add .rel.ifunc.dyn and .rela.ifunc.dyn sections. ld/testsuite/ * ld-mips-elf/reloc-1-n32.d: Updated expected output for reloc descriptions. * ld-mips-elf/reloc-1-n64.d: Likewise. * ld-i386/ifunc.d: New test. * ld-i386/ifunc.s: Source file for the new test. * ld-i386/i386.exp: Run the new test.
2008-12-03 15:51:00 +01:00
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h))
{
eif->failed = TRUE;
return FALSE;
}
return TRUE;
}
/* Adjust the dynamic symbol, H, for copy in the dynamic bss section,
DYNBSS. */
bfd_boolean
Copy relocations against protected symbols Copy relocs are used in a scheme to avoid dynamic text relocations in non-PIC executables that refer to variables defined in shared libraries. The idea is to have the linker define any such variable in the executable, with a copy reloc copying the initial value, then have both the executable and shared library refer to the executable copy. If the shared library defines the variable as protected then we have two copies of the variable being used. PR 15228 * elflink.c (_bfd_elf_adjust_dynamic_copy): Add "info" param. Error on copy relocs against protected symbols. (elf_merge_st_other): Set h->protected_def. * elf-bfd.h (struct elf_link_hash_entry): Add "protected_def". (_bfd_elf_adjust_dynamic_copy): Update prototype. * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Update _bfd_elf_adjust_dynamic_copy call. * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. * elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. * elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. * elf32-metag.c (elf_metag_adjust_dynamic_symbol): Likewise. * elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Likewise. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise. * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol): Likewise.
2014-12-12 13:23:46 +01:00
_bfd_elf_adjust_dynamic_copy (struct bfd_link_info *info,
struct elf_link_hash_entry *h,
asection *dynbss)
{
unsigned int power_of_two;
bfd_vma mask;
asection *sec = h->root.u.def.section;
/* The section aligment of definition is the maximum alignment
requirement of symbols defined in the section. Since we don't
know the symbol alignment requirement, we start with the
maximum alignment and check low bits of the symbol address
for the minimum alignment. */
power_of_two = bfd_get_section_alignment (sec->owner, sec);
mask = ((bfd_vma) 1 << power_of_two) - 1;
while ((h->root.u.def.value & mask) != 0)
{
mask >>= 1;
--power_of_two;
}
if (power_of_two > bfd_get_section_alignment (dynbss->owner,
dynbss))
{
/* Adjust the section alignment if needed. */
if (! bfd_set_section_alignment (dynbss->owner, dynbss,
power_of_two))
return FALSE;
}
/* We make sure that the symbol will be aligned properly. */
dynbss->size = BFD_ALIGN (dynbss->size, mask + 1);
/* Define the symbol as being at this point in DYNBSS. */
h->root.u.def.section = dynbss;
h->root.u.def.value = dynbss->size;
/* Increment the size of DYNBSS to make room for the symbol. */
dynbss->size += h->size;
Add extern_protected_data and set it for x86 Re-apply: commit ca3fe95e469b9daec153caa2c90665f5daaec2b5 With copy relocation, address of protected data defined in the shared library may be external. This patch adds extern_protected_data and changes _bfd_elf_symbol_refs_local_p to return false for protected data if extern_protected_data is true. This patch will break building shared libraries with protected data symbols using GCCs older than GCC 5 without the bug fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 GCC backport request should be made in the GCC bug report above. To get correct run-time behavior on Linux, glibc 2.22 or above are required, which have the bug fix for https://sourceware.org/bugzilla/show_bug.cgi?id=17711 Backports for glibc 2.21, 2.20, 2.19 and 2.18 are on hjl/pr17711/2.21, hjl/pr17711/2.20, hjl/pr17711/2.19 and hjl/pr17711/2.18 branches, respectively, at https://sourceware.org/git/?p=glibc.git;a=summary bfd/ PR ld/pr15228 PR ld/pr17709 * elf-bfd.h (elf_backend_data): Add extern_protected_data. * elf32-i386.c (elf_backend_extern_protected_data): New. Defined to 1. * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise. * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on copy relocs against protected symbols if extern_protected_data is true. (_bfd_elf_symbol_refs_local_p): Don't return true on protected non-function symbols if extern_protected_data is true. * elfxx-target.h (elf_backend_extern_protected_data): New. Default to 0. (elfNN_bed): Initialize extern_protected_data with elf_backend_extern_protected_data. ld/testsuite/ PR ld/pr15228 PR ld/pr17709 * ld-i386/i386.exp (i386tests): Add a test for PR ld/17709. * ld-i386/pr17709-nacl.rd: New file. * ld-i386/pr17709.rd: Likewise. * ld-i386/pr17709a.s: Likewise. * ld-i386/pr17709b.s: Likewise. * ld-i386/protected3.d: Updated. * ld-i386/protected3.s: Likewise. * ld-x86-64/pr17709-nacl.rd: New file. * ld-x86-64/pr17709.rd: Likewise. * ld-x86-64/pr17709a.s: Likewise. * ld-x86-64/pr17709b.s: Likewise. * ld-x86-64/protected3.d: Updated. * ld-x86-64/protected3.s: Likewise. * ld-x86-64/x86-64.exp (x86_64tests): Add a test for PR ld/17709.
2015-03-05 15:34:39 +01:00
/* No error if extern_protected_data is true. */
if (h->protected_def
Add -z noextern-protected-data to ld for ELF/x86 Address of protected data defined in the shared library may be external, i.e., due to copy relocation. By default, linker backend checks if relocations against protected data symbols are valid for building shared library and issues an error if relocation isn't allowed. The new option override linker backend default. When -z noextern-protected-data is used, updates on protected data symbols by another module won't be visibile to the resulting shared library. This option is specific to ELF/i386 and ELF/x86-64. bfd/ PR ld/pr17709 * elflink.c (_bfd_elf_adjust_dynamic_copy): Check info->extern_protected_data when warning copy relocs against protected symbols. (_bfd_elf_symbol_refs_local_p): Check info->extern_protected_data when checking protected non-function symbols. include/ PR ld/pr17709 * bfdlink.h (bfd_link_info): Add extern_protected_data. ld/ PR ld/pr17709 * ld.texinfo: Document "-z noextern-protected-data". * ldmain.c (main): Initialize link_info.extern_protected_data to -1. * lexsup.c (elf_shlib_list_options): Add "-z [no]extern-protected-data". * emulparams/elf32_x86_64.sh: Source extern_protected_data.sh. * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Source extern_protected_data.sh. (PARSE_AND_LIST_OPTIONS): Renamed to ... (PARSE_AND_LIST_OPTIONS_BNDPLT): This. (PARSE_AND_LIST_ARGS_CASE_Z): Renamed to ... (PARSE_AND_LIST_ARGS_CASE_Z_BNDPLT): This. (PARSE_AND_LIST_OPTIONS): Append $PARSE_AND_LIST_OPTIONS_BNDPLT. (PARSE_AND_LIST_ARGS_CASE_Z): Append $PARSE_AND_LIST_ARGS_CASE_Z_BNDPLT. * emulparams/extern_protected_data.sh: New file. ld/testsuite/ PR ld/pr17709 * ld-i386/i386.exp: Run protected6b. * ld-i386/protected6b.d: New file. * ld-x86-64/protected6b.d: Likewise. * ld-x86-64/x86-64.exp: Run protected6b.
2015-04-14 13:12:55 +02:00
&& (!info->extern_protected_data
|| (info->extern_protected_data < 0
&& !get_elf_backend_data (dynbss->owner)->extern_protected_data)))
info->callbacks->einfo
(_("%P: copy reloc against protected `%T' is dangerous\n"),
h->root.root.string);
Copy relocations against protected symbols Copy relocs are used in a scheme to avoid dynamic text relocations in non-PIC executables that refer to variables defined in shared libraries. The idea is to have the linker define any such variable in the executable, with a copy reloc copying the initial value, then have both the executable and shared library refer to the executable copy. If the shared library defines the variable as protected then we have two copies of the variable being used. PR 15228 * elflink.c (_bfd_elf_adjust_dynamic_copy): Add "info" param. Error on copy relocs against protected symbols. (elf_merge_st_other): Set h->protected_def. * elf-bfd.h (struct elf_link_hash_entry): Add "protected_def". (_bfd_elf_adjust_dynamic_copy): Update prototype. * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Update _bfd_elf_adjust_dynamic_copy call. * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. * elf32-cr16.c (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. * elf32-lm32.c (lm32_elf_adjust_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. * elf32-metag.c (elf_metag_adjust_dynamic_symbol): Likewise. * elf32-or1k.c (or1k_elf_adjust_dynamic_symbol): Likewise. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. * elf32-tic6x.c (elf32_tic6x_adjust_dynamic_symbol): Likewise. * elf32-tilepro.c (tilepro_elf_adjust_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise. * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise. * elfxx-tilegx.c (tilegx_elf_adjust_dynamic_symbol): Likewise.
2014-12-12 13:23:46 +01:00
return TRUE;
}
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
/* Adjust all external symbols pointing into SEC_MERGE sections
to reflect the object merging within the sections. */
static bfd_boolean
_bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
asection *sec;
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& ((sec = h->root.u.def.section)->flags & SEC_MERGE)
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
&& sec->sec_info_type == SEC_INFO_TYPE_MERGE)
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
bfd *output_bfd = (bfd *) data;
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
h->root.u.def.value =
_bfd_merged_section_offset (output_bfd,
&h->root.u.def.section,
elf_section_data (sec)->sec_info,
h->root.u.def.value);
* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from elflink.h. Replace LOG_FILE_ALIGN with bed->s->log_file_align. (_bfd_elf_create_dynamic_sections): Use bed->s->log_file_align. (bfd_elf_record_link_assignment): Move from elflink.h. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_add_default_symbol): Likewise. (_bfd_elf_export_symbol): Likewise. (_bfd_elf_link_find_version_dependencies): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Likewise. (_bfd_elf_fix_symbol_flags): Likewise. (_bfd_elf_adjust_dynamic_symbol): Likewise. (_bfd_elf_link_sec_merge_syms): Likewise. (elf_link_read_relocs_from_section): Likewise. Use bed->s->sizeof_rel and bed->s->sizeof_rela. (_bfd_elf_link_output_relocs): Likewise. * elf-bfd.h (struct elf_size_info): Rename file_align to log_file_align. (struct elf_info_failed): Move from elflink.h. (struct elf_assign_sym_version_info): Likewise. (struct elf_find_verdep_info): Likewise. (_bfd_elf_create_dynamic_sections): Delete duplicate declaration. (_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_link_create_dynamic_sections, _bfd_elf_link_read_relocs, _bfd_elf_link_size_reloc_section, _bfd_elf_link_output_relocs, _bfd_elf_fix_symbol_flags, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms): Declare. (bfd_elf32_link_create_dynamic_sections): Don't declare. (_bfd_elf32_link_read_relocs): Likewise. (bfd_elf64_link_create_dynamic_sections): Likewise. (_bfd_elf64_link_read_relocs): Likewise. * elflink.h: Move lots o' stuff elsewhere. * bfd-in.h (bfd_elf32_record_link_assignment): Don't declare. (bfd_elf64_record_link_assignment): Likewise. (bfd_elf_record_link_assignment): Declare. * bfd-in2.h: Regenerate. * elfcode.h (elf_link_create_dynamic_sections): Don't declare. (NAME(_bfd_elf,size_info)): Adjust for log_file_align. * elf.c (_bfd_elf_init_reloc_shdr): Adjust for bed->s->log_file_align. (assign_file_positions_for_segments): Likewise. (assign_file_positions_except_relocs): Likewise. (swap_out_syms, elfcore_write_note): Likewise. * elf-m10200.c: Adjust for changed function names. * elf-m10300.c: Likewise. * elf32-arm.h: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc11.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mips.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh.c: Likewise. * elf32-v850.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. (MIPS_ELF_LOG_FILE_ALIGN): Use log_file_align. * elf64-alpha.c (alpha_elf_size_info): Adjust for log_file_align. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-mips.c (mips_elf64_size_info): Likewise. * elf64-s390.c (s390_elf64_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2003-05-09 04:27:11 +02:00
}
return TRUE;
}
/* Returns false if the symbol referred to by H should be considered
to resolve local to the current module, and true if it should be
considered to bind dynamically. */
bfd_boolean
_bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
struct bfd_link_info *info,
bfd_boolean not_local_protected)
{
bfd_boolean binding_stays_local_p;
const struct elf_backend_data *bed;
struct elf_link_hash_table *hash_table;
if (h == NULL)
return FALSE;
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
/* If it was forced local, then clearly it's not dynamic. */
if (h->dynindx == -1)
return FALSE;
2004-09-16 16:52:12 +02:00
if (h->forced_local)
return FALSE;
/* Identify the cases where name binding rules say that a
visible symbol resolves locally. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
binding_stays_local_p = (bfd_link_executable (info)
|| SYMBOLIC_BIND (info, h));
switch (ELF_ST_VISIBILITY (h->other))
{
case STV_INTERNAL:
case STV_HIDDEN:
return FALSE;
case STV_PROTECTED:
hash_table = elf_hash_table (info);
if (!is_elf_hash_table (hash_table))
return FALSE;
bed = get_elf_backend_data (hash_table->dynobj);
/* Proper resolution for function pointer equality may require
that these symbols perhaps be resolved dynamically, even though
we should be resolving them to the current module. */
if (!not_local_protected || !bed->is_function_type (h->type))
binding_stays_local_p = TRUE;
break;
default:
break;
}
/* If it isn't defined locally, then clearly it's dynamic. */
if (!h->def_regular && !ELF_COMMON_DEF_P (h))
return TRUE;
/* Otherwise, the symbol is dynamic if binding rules don't tell
us that it remains local. */
return !binding_stays_local_p;
}
/* Return true if the symbol referred to by H should be considered
to resolve local to the current module, and false otherwise. Differs
from (the inverse of) _bfd_elf_dynamic_symbol_p in the treatment of
undefined symbols. The two functions are virtually identical except
for the place where forced_local and dynindx == -1 are tested. If
either of those tests are true, _bfd_elf_dynamic_symbol_p will say
the symbol is local, while _bfd_elf_symbol_refs_local_p will say
the symbol is local only for defined symbols.
It might seem that _bfd_elf_dynamic_symbol_p could be rewritten as
!_bfd_elf_symbol_refs_local_p, except that targets differ in their
treatment of undefined weak symbols. For those that do not make
undefined weak symbols dynamic, both functions may return false. */
bfd_boolean
_bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
struct bfd_link_info *info,
bfd_boolean local_protected)
{
const struct elf_backend_data *bed;
struct elf_link_hash_table *hash_table;
/* If it's a local sym, of course we resolve locally. */
if (h == NULL)
return TRUE;
/* STV_HIDDEN or STV_INTERNAL ones must be local. */
if (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL)
return TRUE;
/* Common symbols that become definitions don't get the DEF_REGULAR
flag set, so test it first, and don't bail out. */
if (ELF_COMMON_DEF_P (h))
/* Do nothing. */;
/* If we don't have a definition in a regular file, then we can't
resolve locally. The sym is either undefined or dynamic. */
else if (!h->def_regular)
return FALSE;
/* Forced local symbols resolve locally. */
2004-09-16 16:52:12 +02:00
if (h->forced_local)
return TRUE;
/* As do non-dynamic symbols. */
if (h->dynindx == -1)
return TRUE;
/* At this point, we know the symbol is defined and dynamic. In an
executable it must resolve locally, likewise when building symbolic
shared libraries. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_executable (info) || SYMBOLIC_BIND (info, h))
return TRUE;
/* Now deal with defined dynamic symbols in shared libraries. Ones
with default visibility might not resolve locally. */
if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
return FALSE;
hash_table = elf_hash_table (info);
if (!is_elf_hash_table (hash_table))
return TRUE;
bed = get_elf_backend_data (hash_table->dynobj);
Add extern_protected_data and set it for x86 Re-apply: commit ca3fe95e469b9daec153caa2c90665f5daaec2b5 With copy relocation, address of protected data defined in the shared library may be external. This patch adds extern_protected_data and changes _bfd_elf_symbol_refs_local_p to return false for protected data if extern_protected_data is true. This patch will break building shared libraries with protected data symbols using GCCs older than GCC 5 without the bug fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 GCC backport request should be made in the GCC bug report above. To get correct run-time behavior on Linux, glibc 2.22 or above are required, which have the bug fix for https://sourceware.org/bugzilla/show_bug.cgi?id=17711 Backports for glibc 2.21, 2.20, 2.19 and 2.18 are on hjl/pr17711/2.21, hjl/pr17711/2.20, hjl/pr17711/2.19 and hjl/pr17711/2.18 branches, respectively, at https://sourceware.org/git/?p=glibc.git;a=summary bfd/ PR ld/pr15228 PR ld/pr17709 * elf-bfd.h (elf_backend_data): Add extern_protected_data. * elf32-i386.c (elf_backend_extern_protected_data): New. Defined to 1. * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise. * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on copy relocs against protected symbols if extern_protected_data is true. (_bfd_elf_symbol_refs_local_p): Don't return true on protected non-function symbols if extern_protected_data is true. * elfxx-target.h (elf_backend_extern_protected_data): New. Default to 0. (elfNN_bed): Initialize extern_protected_data with elf_backend_extern_protected_data. ld/testsuite/ PR ld/pr15228 PR ld/pr17709 * ld-i386/i386.exp (i386tests): Add a test for PR ld/17709. * ld-i386/pr17709-nacl.rd: New file. * ld-i386/pr17709.rd: Likewise. * ld-i386/pr17709a.s: Likewise. * ld-i386/pr17709b.s: Likewise. * ld-i386/protected3.d: Updated. * ld-i386/protected3.s: Likewise. * ld-x86-64/pr17709-nacl.rd: New file. * ld-x86-64/pr17709.rd: Likewise. * ld-x86-64/pr17709a.s: Likewise. * ld-x86-64/pr17709b.s: Likewise. * ld-x86-64/protected3.d: Updated. * ld-x86-64/protected3.s: Likewise. * ld-x86-64/x86-64.exp (x86_64tests): Add a test for PR ld/17709.
2015-03-05 15:34:39 +01:00
/* If extern_protected_data is false, STV_PROTECTED non-function
symbols are local. */
Add -z noextern-protected-data to ld for ELF/x86 Address of protected data defined in the shared library may be external, i.e., due to copy relocation. By default, linker backend checks if relocations against protected data symbols are valid for building shared library and issues an error if relocation isn't allowed. The new option override linker backend default. When -z noextern-protected-data is used, updates on protected data symbols by another module won't be visibile to the resulting shared library. This option is specific to ELF/i386 and ELF/x86-64. bfd/ PR ld/pr17709 * elflink.c (_bfd_elf_adjust_dynamic_copy): Check info->extern_protected_data when warning copy relocs against protected symbols. (_bfd_elf_symbol_refs_local_p): Check info->extern_protected_data when checking protected non-function symbols. include/ PR ld/pr17709 * bfdlink.h (bfd_link_info): Add extern_protected_data. ld/ PR ld/pr17709 * ld.texinfo: Document "-z noextern-protected-data". * ldmain.c (main): Initialize link_info.extern_protected_data to -1. * lexsup.c (elf_shlib_list_options): Add "-z [no]extern-protected-data". * emulparams/elf32_x86_64.sh: Source extern_protected_data.sh. * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Source extern_protected_data.sh. (PARSE_AND_LIST_OPTIONS): Renamed to ... (PARSE_AND_LIST_OPTIONS_BNDPLT): This. (PARSE_AND_LIST_ARGS_CASE_Z): Renamed to ... (PARSE_AND_LIST_ARGS_CASE_Z_BNDPLT): This. (PARSE_AND_LIST_OPTIONS): Append $PARSE_AND_LIST_OPTIONS_BNDPLT. (PARSE_AND_LIST_ARGS_CASE_Z): Append $PARSE_AND_LIST_ARGS_CASE_Z_BNDPLT. * emulparams/extern_protected_data.sh: New file. ld/testsuite/ PR ld/pr17709 * ld-i386/i386.exp: Run protected6b. * ld-i386/protected6b.d: New file. * ld-x86-64/protected6b.d: Likewise. * ld-x86-64/x86-64.exp: Run protected6b.
2015-04-14 13:12:55 +02:00
if ((!info->extern_protected_data
|| (info->extern_protected_data < 0
&& !bed->extern_protected_data))
&& !bed->is_function_type (h->type))
return TRUE;
/* Function pointer equality tests may require that STV_PROTECTED
symbols be treated as dynamic symbols. If the address of a
function not defined in an executable is set to that function's
plt entry in the executable, then the address of the function in
a shared library must also be the plt entry in the executable. */
return local_protected;
}
* bfd-in.h (_bfd_elf_tls_setup): Declare. * bfd-in2.h: Regenerate. * elf-bfd.h (struct elf_link_tls_segment): Delete. (struct elf_link_hash_table): Add tls_sec and tls_size. * elf.c (_bfd_elf_link_hash_table_init): Init tls_sec and tls_size. * elflink.c (_bfd_elf_tls_setup): New function. * elflink.h (struct elf_final_link_info): Remove first_tls_sec. (elf_bfd_final_link): Don't set first_tls_sec here. Update code saving tls segment info, round segment size up. (elf_link_output_extsym): Adjust code using tls segment info. (elf_link_input_bfd): Likewise. * elf32-i386.c (dtpoff_base, tpoff): Likewise. * elf32-s390.c (dtpoff_base, tpoff): Likewise. * elf32-sh.c (dtpoff_base, tpoff): Likewise. * elf32-sparc.c (dtpoff_base, tpoff): Likewise. * elf64-s390.c (dtpoff_base, tpoff): Likewise. * elf64-x86-64.c (dtpoff_base, tpoff): Likewise. * elfxx-ia64.c (elfNN_ia64_tprel_base): Likewise. (elfNN_ia64_dtprel_base): Likewise. * elf64-alpha.c (alpha_get_dtprel_base): Likewise. (alpha_get_tprel_base): Likewise. (struct alpha_relax_info): Remove tls_segment. (elf64_alpha_relax_got_load): Adjust invocation of alpha_get_dtprel_base and alpha_get_tprel_base. (elf64_alpha_relax_tls_get_addr): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_relax_find_tls_segment): Delete. * elf32-ppc.c (struct ppc_elf_link_hash_table): Remove tls_sec. (ppc_elf_tls_setup): Call _bfd_elf_tls_setup. Return section. (ppc_elf_relocate_section): Adjust to use elf.tls_sec. * elf32-ppc.h (ppc_elf_tls_setup): Update. * elf64-ppc.c (struct ppc_link_hash_table): Remove tls_sec. (ppc64_elf_tls_setup): Call _bfd_elf_tls_setup. Return section. (ppc64_elf_tls_optimize): Adjust to use elf.tls_sec. (ppc64_elf_relocate_section): Likewise. * elf64-ppc.h (ppc64_elf_tls_setup): Update. * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Call _bfd_elf_tls_setup.
2003-11-04 07:16:39 +01:00
/* Caches some TLS segment info, and ensures that the TLS segment vma is
aligned. Returns the first TLS output section. */
struct bfd_section *
_bfd_elf_tls_setup (bfd *obfd, struct bfd_link_info *info)
{
struct bfd_section *sec, *tls;
unsigned int align = 0;
for (sec = obfd->sections; sec != NULL; sec = sec->next)
if ((sec->flags & SEC_THREAD_LOCAL) != 0)
break;
tls = sec;
for (; sec != NULL && (sec->flags & SEC_THREAD_LOCAL) != 0; sec = sec->next)
if (sec->alignment_power > align)
align = sec->alignment_power;
elf_hash_table (info)->tls_sec = tls;
/* Ensure the alignment of the first section is the largest alignment,
so that the tls segment starts aligned. */
if (tls != NULL)
tls->alignment_power = align;
return tls;
}
/* Return TRUE iff this is a non-common, definition of a non-function symbol. */
static bfd_boolean
is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
Elf_Internal_Sym *sym)
{
const struct elf_backend_data *bed;
/* Local symbols do not count, but target specific ones might. */
if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL
&& ELF_ST_BIND (sym->st_info) < STB_LOOS)
return FALSE;
bed = get_elf_backend_data (abfd);
/* Function symbols do not count. */
if (bed->is_function_type (ELF_ST_TYPE (sym->st_info)))
return FALSE;
/* If the section is undefined, then so is the symbol. */
if (sym->st_shndx == SHN_UNDEF)
return FALSE;
/* If the symbol is defined in the common section, then
it is a common definition and so does not count. */
if (bed->common_definition (sym))
return FALSE;
/* If the symbol is in a target specific section then we
must rely upon the backend to tell us what it is. */
if (sym->st_shndx >= SHN_LORESERVE && sym->st_shndx < SHN_ABS)
/* FIXME - this function is not coded yet:
return _bfd_is_global_symbol_definition (abfd, sym);
Instead for now assume that the definition is not global,
Even if this is wrong, at least the linker will behave
in the same way that it used to do. */
return FALSE;
return TRUE;
}
/* Search the symbol table of the archive element of the archive ABFD
whose archive map contains a mention of SYMDEF, and determine if
the symbol is defined in this element. */
static bfd_boolean
elf_link_is_defined_archive_symbol (bfd * abfd, carsym * symdef)
{
Elf_Internal_Shdr * hdr;
bfd_size_type symcount;
bfd_size_type extsymcount;
bfd_size_type extsymoff;
Elf_Internal_Sym *isymbuf;
Elf_Internal_Sym *isym;
Elf_Internal_Sym *isymend;
bfd_boolean result;
abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
if (abfd == NULL)
return FALSE;
/* Return FALSE if the object has been claimed by plugin. */
if (abfd->plugin_format == bfd_plugin_yes)
return FALSE;
if (! bfd_check_format (abfd, bfd_object))
return FALSE;
/* Select the appropriate symbol table. */
if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
hdr = &elf_tdata (abfd)->symtab_hdr;
else
hdr = &elf_tdata (abfd)->dynsymtab_hdr;
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
/* The sh_info field of the symtab header tells us where the
external symbols start. We don't care about the local symbols. */
if (elf_bad_symtab (abfd))
{
extsymcount = symcount;
extsymoff = 0;
}
else
{
extsymcount = symcount - hdr->sh_info;
extsymoff = hdr->sh_info;
}
if (extsymcount == 0)
return FALSE;
/* Read in the symbol table. */
isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
NULL, NULL, NULL);
if (isymbuf == NULL)
return FALSE;
/* Scan the symbol table looking for SYMDEF. */
result = FALSE;
for (isym = isymbuf, isymend = isymbuf + extsymcount; isym < isymend; isym++)
{
const char *name;
name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
isym->st_name);
if (name == NULL)
break;
if (strcmp (name, symdef->name) == 0)
{
result = is_global_data_symbol_definition (abfd, isym);
break;
}
}
free (isymbuf);
return result;
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Add an entry to the .dynamic table. */
bfd_boolean
_bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
bfd_vma tag,
bfd_vma val)
{
struct elf_link_hash_table *hash_table;
const struct elf_backend_data *bed;
asection *s;
bfd_size_type newsize;
bfd_byte *newcontents;
Elf_Internal_Dyn dyn;
hash_table = elf_hash_table (info);
if (! is_elf_hash_table (hash_table))
return FALSE;
bed = get_elf_backend_data (hash_table->dynobj);
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (hash_table->dynobj, ".dynamic");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
BFD_ASSERT (s != NULL);
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
newsize = s->size + bed->s->sizeof_dyn;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (newcontents == NULL)
return FALSE;
dyn.d_tag = tag;
dyn.d_un.d_val = val;
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
bed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->size);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
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
s->size = newsize;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
s->contents = newcontents;
return TRUE;
}
/* Add a DT_NEEDED entry for this dynamic object if DO_IT is true,
otherwise just check whether one already exists. Returns -1 on error,
1 if a DT_NEEDED tag already exists, and 0 on success. */
static int
elf_add_dt_needed_tag (bfd *abfd,
struct bfd_link_info *info,
const char *soname,
bfd_boolean do_it)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
struct elf_link_hash_table *hash_table;
bfd_size_type strindex;
if (!_bfd_elf_link_create_dynstrtab (abfd, info))
return -1;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
hash_table = elf_hash_table (info);
strindex = _bfd_elf_strtab_add (hash_table->dynstr, soname, FALSE);
if (strindex == (bfd_size_type) -1)
return -1;
if (_bfd_elf_strtab_refcount (hash_table->dynstr, strindex) != 1)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
asection *sdyn;
const struct elf_backend_data *bed;
bfd_byte *extdyn;
bed = get_elf_backend_data (hash_table->dynobj);
2012-06-29 16:46:03 +02:00
sdyn = bfd_get_linker_section (hash_table->dynobj, ".dynamic");
if (sdyn != NULL)
for (extdyn = sdyn->contents;
extdyn < sdyn->contents + sdyn->size;
extdyn += bed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
bed->s->swap_dyn_in (hash_table->dynobj, extdyn, &dyn);
if (dyn.d_tag == DT_NEEDED
&& dyn.d_un.d_val == strindex)
{
_bfd_elf_strtab_delref (hash_table->dynstr, strindex);
return 1;
}
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
if (do_it)
{
if (!_bfd_elf_link_create_dynamic_sections (hash_table->dynobj, info))
return -1;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex))
return -1;
}
else
/* We were just checking for existence of the tag. */
_bfd_elf_strtab_delref (hash_table->dynstr, strindex);
return 0;
}
static bfd_boolean
on_needed_list (const char *soname, struct bfd_link_needed_list *needed)
{
for (; needed != NULL; needed = needed->next)
if ((elf_dyn_lib_class (needed->by) & DYN_AS_NEEDED) == 0
&& strcmp (soname, needed->name) == 0)
return TRUE;
return FALSE;
}
/* Sort symbol by value, section, and size. */
static int
elf_sort_symbol (const void *arg1, const void *arg2)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
const struct elf_link_hash_entry *h1;
const struct elf_link_hash_entry *h2;
bfd_signed_vma vdiff;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
h1 = *(const struct elf_link_hash_entry **) arg1;
h2 = *(const struct elf_link_hash_entry **) arg2;
vdiff = h1->root.u.def.value - h2->root.u.def.value;
if (vdiff != 0)
return vdiff > 0 ? 1 : -1;
else
{
int sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id;
if (sdiff != 0)
return sdiff > 0 ? 1 : -1;
}
vdiff = h1->size - h2->size;
return vdiff == 0 ? 0 : vdiff > 0 ? 1 : -1;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* This function is used to adjust offsets into .dynstr for
dynamic symbols. This is called via elf_link_hash_traverse. */
static bfd_boolean
elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *data)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (h->dynindx != -1)
h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
return TRUE;
}
/* Assign string offsets in .dynstr, update all structures referencing
them. */
static bfd_boolean
elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
struct elf_link_hash_table *hash_table = elf_hash_table (info);
struct elf_link_local_dynamic_entry *entry;
struct elf_strtab_hash *dynstr = hash_table->dynstr;
bfd *dynobj = hash_table->dynobj;
asection *sdyn;
bfd_size_type size;
const struct elf_backend_data *bed;
bfd_byte *extdyn;
_bfd_elf_strtab_finalize (dynstr);
size = _bfd_elf_strtab_size (dynstr);
bed = get_elf_backend_data (dynobj);
2012-06-29 16:46:03 +02:00
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
BFD_ASSERT (sdyn != NULL);
/* Update all .dynamic entries referencing .dynstr strings. */
for (extdyn = sdyn->contents;
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
extdyn < sdyn->contents + sdyn->size;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
extdyn += bed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
bed->s->swap_dyn_in (dynobj, extdyn, &dyn);
switch (dyn.d_tag)
{
case DT_STRSZ:
dyn.d_un.d_val = size;
break;
case DT_NEEDED:
case DT_SONAME:
case DT_RPATH:
case DT_RUNPATH:
case DT_FILTER:
case DT_AUXILIARY:
case DT_AUDIT:
case DT_DEPAUDIT:
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
dyn.d_un.d_val = _bfd_elf_strtab_offset (dynstr, dyn.d_un.d_val);
break;
default:
continue;
}
bed->s->swap_dyn_out (dynobj, &dyn, extdyn);
}
/* Now update local dynamic symbols. */
for (entry = hash_table->dynlocal; entry ; entry = entry->next)
entry->isym.st_name = _bfd_elf_strtab_offset (dynstr,
entry->isym.st_name);
/* And the rest of dynamic symbols. */
elf_link_hash_traverse (hash_table, elf_adjust_dynstr_offsets, dynstr);
/* Adjust version definitions. */
if (elf_tdata (output_bfd)->cverdefs)
{
asection *s;
bfd_byte *p;
bfd_size_type i;
Elf_Internal_Verdef def;
Elf_Internal_Verdaux defaux;
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".gnu.version_d");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
p = s->contents;
do
{
_bfd_elf_swap_verdef_in (output_bfd, (Elf_External_Verdef *) p,
&def);
p += sizeof (Elf_External_Verdef);
if (def.vd_aux != sizeof (Elf_External_Verdef))
continue;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
for (i = 0; i < def.vd_cnt; ++i)
{
_bfd_elf_swap_verdaux_in (output_bfd,
(Elf_External_Verdaux *) p, &defaux);
defaux.vda_name = _bfd_elf_strtab_offset (dynstr,
defaux.vda_name);
_bfd_elf_swap_verdaux_out (output_bfd,
&defaux, (Elf_External_Verdaux *) p);
p += sizeof (Elf_External_Verdaux);
}
}
while (def.vd_next);
}
/* Adjust version references. */
if (elf_tdata (output_bfd)->verref)
{
asection *s;
bfd_byte *p;
bfd_size_type i;
Elf_Internal_Verneed need;
Elf_Internal_Vernaux needaux;
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".gnu.version_r");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
p = s->contents;
do
{
_bfd_elf_swap_verneed_in (output_bfd, (Elf_External_Verneed *) p,
&need);
need.vn_file = _bfd_elf_strtab_offset (dynstr, need.vn_file);
_bfd_elf_swap_verneed_out (output_bfd, &need,
(Elf_External_Verneed *) p);
p += sizeof (Elf_External_Verneed);
for (i = 0; i < need.vn_cnt; ++i)
{
_bfd_elf_swap_vernaux_in (output_bfd,
(Elf_External_Vernaux *) p, &needaux);
needaux.vna_name = _bfd_elf_strtab_offset (dynstr,
needaux.vna_name);
_bfd_elf_swap_vernaux_out (output_bfd,
&needaux,
(Elf_External_Vernaux *) p);
p += sizeof (Elf_External_Vernaux);
}
}
while (need.vn_next);
}
return TRUE;
}
/* Return TRUE iff relocations for INPUT are compatible with OUTPUT.
The default is to only match when the INPUT and OUTPUT are exactly
the same target. */
bfd_boolean
_bfd_elf_default_relocs_compatible (const bfd_target *input,
const bfd_target *output)
{
return input == output;
}
/* Return TRUE iff relocations for INPUT are compatible with OUTPUT.
This version is used when different targets for the same architecture
are virtually identical. */
bfd_boolean
_bfd_elf_relocs_compatible (const bfd_target *input,
const bfd_target *output)
{
const struct elf_backend_data *obed, *ibed;
if (input == output)
return TRUE;
ibed = xvec_get_elf_backend_data (input);
obed = xvec_get_elf_backend_data (output);
if (ibed->arch != obed->arch)
return FALSE;
/* If both backends are using this function, deem them compatible. */
return ibed->relocs_compatible == obed->relocs_compatible;
}
/* Make a special call to the linker "notice" function to tell it that
we are about to handle an as-needed lib, or have finished
2015-08-12 13:32:43 +02:00
processing the lib. */
bfd_boolean
_bfd_elf_notice_as_needed (bfd *ibfd,
struct bfd_link_info *info,
enum notice_asneeded_action act)
{
return (*info->callbacks->notice) (info, NULL, NULL, ibfd, NULL, act, 0);
}
/* Add symbols from an ELF object file to the linker hash table. */
static bfd_boolean
elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
Elf_Internal_Ehdr *ehdr;
Elf_Internal_Shdr *hdr;
bfd_size_type symcount;
bfd_size_type extsymcount;
bfd_size_type extsymoff;
struct elf_link_hash_entry **sym_hash;
bfd_boolean dynamic;
Elf_External_Versym *extversym = NULL;
Elf_External_Versym *ever;
struct elf_link_hash_entry *weaks;
struct elf_link_hash_entry **nondeflt_vers = NULL;
bfd_size_type nondeflt_vers_cnt = 0;
Elf_Internal_Sym *isymbuf = NULL;
Elf_Internal_Sym *isym;
Elf_Internal_Sym *isymend;
const struct elf_backend_data *bed;
bfd_boolean add_needed;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
struct elf_link_hash_table *htab;
bfd_size_type amt;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
void *alloc_mark = NULL;
struct bfd_hash_entry **old_table = NULL;
unsigned int old_size = 0;
unsigned int old_count = 0;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
void *old_tab = NULL;
void *old_ent;
struct bfd_link_hash_entry *old_undefs = NULL;
struct bfd_link_hash_entry *old_undefs_tail = NULL;
long old_dynsymcount = 0;
bfd_size_type old_dynstr_size = 0;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
size_t tabsize = 0;
asection *s;
bfd_boolean just_syms;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
htab = elf_hash_table (info);
bed = get_elf_backend_data (abfd);
if ((abfd->flags & DYNAMIC) == 0)
dynamic = FALSE;
else
{
dynamic = TRUE;
/* You can't use -r against a dynamic object. Also, there's no
hope of using a dynamic object which does not exactly match
the format of the output file. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_relocatable (info)
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
|| !is_elf_hash_table (htab)
include/ * bfdlink.h (struct bfd_link_hash_table): Delete creator field. (struct bfd_link_info): Add output_bfd. bfd/ * elflink.c: Replace all accesses to hash->creator field with output_bfd->xvec. * cofflink.c: Likewise. * coff-h8300.c: Likewise. * ecoff.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-ppc.c: Likewise. * elf64-alpha.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sparc.c: Likewise. * elfxx-mips.c: Likewise. * i386linux.c: Likewise. * m68klinux.c: Likewise. * sparclinux.c: Likewise. * sunos.c: Likewise. * xcofflink.c: Likewise. * linker.c: Likewise. (_bfd_link_hash_table_init): Don't store creator. ld/ * ldmain.h (output_bfd): Delete. * ldmain.c (output_bfd): Delete. Replace all occurrences of output_bfd with link_info.output_bfd. * ldcref.c: Likewise. * ldctor.c: Likewise. * ldemul.c: Likewise. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldlang.c: Likewise. * ldmisc.c: Likewise. * ldwrite.c: Likewise. * pe-dll.c: Likewise. * emultempl/aix.em: Likewise. * emultempl/alphaelf.em: Likewise. * emultempl/armcoff.em: Likewise. * emultempl/armelf.em: Likewise. * emultempl/avrelf.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/elf-generic.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/irix.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68hc1xelf.em: Likewise. * emultempl/mmix-elfnmmo.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/scoreelf.em: Likewise. * emultempl/sh64elf.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/vxworks.em: Likewise. * emultempl/xtensaelf.em: Likewise. * emultempl/z80.em: Likewise. * ldlang.c (open_output): Don't return output, instead write link_info_output_bfd directly. * emultempl/alphaelf.em: Replace occurrences of link_info.hash->creator with link_info.output_bfd->xvec. * emultempl/hppaelf.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/spuelf.em: Likewise.
2008-02-15 04:35:53 +01:00
|| info->output_bfd->xvec != abfd->xvec)
{
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_relocatable (info))
bfd_set_error (bfd_error_invalid_operation);
else
bfd_set_error (bfd_error_wrong_format);
goto error_return;
}
}
ehdr = elf_elfheader (abfd);
if (info->warn_alternate_em
&& bed->elf_machine_code != ehdr->e_machine
&& ((bed->elf_machine_alt1 != 0
&& ehdr->e_machine == bed->elf_machine_alt1)
|| (bed->elf_machine_alt2 != 0
&& ehdr->e_machine == bed->elf_machine_alt2)))
info->callbacks->einfo
(_("%P: alternate ELF machine code found (%d) in %B, expecting %d\n"),
ehdr->e_machine, abfd, bed->elf_machine_code);
/* As a GNU extension, any input sections which are named
.gnu.warning.SYMBOL are treated as warning symbols for the given
symbol. This differs from .gnu.warning sections, which generate
warnings when they are included in an output file. */
/* PR 12761: Also generate this warning when building shared libraries. */
for (s = abfd->sections; s != NULL; s = s->next)
{
const char *name;
name = bfd_get_section_name (abfd, s);
if (CONST_STRNEQ (name, ".gnu.warning."))
{
char *msg;
bfd_size_type sz;
name += sizeof ".gnu.warning." - 1;
/* If this is a shared object, then look up the symbol
in the hash table. If it is there, and it is already
been defined, then we will not be using the entry
from this shared object, so we don't need to warn.
FIXME: If we see the definition in a regular object
later on, we will warn, but we shouldn't. The only
fix is to keep track of what warnings we are supposed
to emit, and then handle them all at the end of the
link. */
if (dynamic)
{
struct elf_link_hash_entry *h;
h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE);
/* FIXME: What about bfd_link_hash_common? */
if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
continue;
}
sz = s->size;
msg = (char *) bfd_alloc (abfd, sz + 1);
if (msg == NULL)
goto error_return;
if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
goto error_return;
msg[sz] = '\0';
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, BSF_WARNING, s, 0, msg,
FALSE, bed->collect, NULL)))
goto error_return;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_executable (info))
{
/* Clobber the section size so that the warning does
not get copied into the output file. */
s->size = 0;
/* Also set SEC_EXCLUDE, so that symbols defined in
the warning section don't get copied to the output. */
s->flags |= SEC_EXCLUDE;
}
}
}
just_syms = ((s = abfd->sections) != NULL
&& s->sec_info_type == SEC_INFO_TYPE_JUST_SYMS);
add_needed = TRUE;
if (! dynamic)
{
/* If we are creating a shared library, create all the dynamic
sections immediately. We need to attach them to something,
so we attach them to this BFD, provided it is the right
format and is not from ld --just-symbols. Always create the
dynamic sections for -E/--dynamic-list. FIXME: If there
are no input BFD's of the same format as the output, we can't
make a shared library. */
if (!just_syms
&& (bfd_link_pic (info)
|| info->export_dynamic
|| info->dynamic)
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
&& is_elf_hash_table (htab)
include/ * bfdlink.h (struct bfd_link_hash_table): Delete creator field. (struct bfd_link_info): Add output_bfd. bfd/ * elflink.c: Replace all accesses to hash->creator field with output_bfd->xvec. * cofflink.c: Likewise. * coff-h8300.c: Likewise. * ecoff.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-ppc.c: Likewise. * elf64-alpha.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sparc.c: Likewise. * elfxx-mips.c: Likewise. * i386linux.c: Likewise. * m68klinux.c: Likewise. * sparclinux.c: Likewise. * sunos.c: Likewise. * xcofflink.c: Likewise. * linker.c: Likewise. (_bfd_link_hash_table_init): Don't store creator. ld/ * ldmain.h (output_bfd): Delete. * ldmain.c (output_bfd): Delete. Replace all occurrences of output_bfd with link_info.output_bfd. * ldcref.c: Likewise. * ldctor.c: Likewise. * ldemul.c: Likewise. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldlang.c: Likewise. * ldmisc.c: Likewise. * ldwrite.c: Likewise. * pe-dll.c: Likewise. * emultempl/aix.em: Likewise. * emultempl/alphaelf.em: Likewise. * emultempl/armcoff.em: Likewise. * emultempl/armelf.em: Likewise. * emultempl/avrelf.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/elf-generic.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/irix.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68hc1xelf.em: Likewise. * emultempl/mmix-elfnmmo.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/scoreelf.em: Likewise. * emultempl/sh64elf.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/vxworks.em: Likewise. * emultempl/xtensaelf.em: Likewise. * emultempl/z80.em: Likewise. * ldlang.c (open_output): Don't return output, instead write link_info_output_bfd directly. * emultempl/alphaelf.em: Replace occurrences of link_info.hash->creator with link_info.output_bfd->xvec. * emultempl/hppaelf.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/spuelf.em: Likewise.
2008-02-15 04:35:53 +01:00
&& info->output_bfd->xvec == abfd->xvec
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
&& !htab->dynamic_sections_created)
{
if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
goto error_return;
}
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
else if (!is_elf_hash_table (htab))
goto error_return;
else
{
const char *soname = NULL;
char *audit = NULL;
struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
int ret;
/* ld --just-symbols and dynamic objects don't mix very well.
ld shouldn't allow it. */
if (just_syms)
abort ();
/* If this dynamic lib was specified on the command line with
--as-needed in effect, then we don't want to add a DT_NEEDED
tag unless the lib is actually used. Similary for libs brought
in by another lib's DT_NEEDED. When --no-add-needed is used
on a dynamic lib, we don't want to add a DT_NEEDED entry for
any dynamic library in DT_NEEDED tags in the dynamic lib at
all. */
add_needed = (elf_dyn_lib_class (abfd)
& (DYN_AS_NEEDED | DYN_DT_NEEDED
| DYN_NO_NEEDED)) == 0;
s = bfd_get_section_by_name (abfd, ".dynamic");
if (s != NULL)
{
bfd_byte *dynbuf;
bfd_byte *extdyn;
unsigned int elfsec;
unsigned long shlink;
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_malloc_and_get_section (abfd, s, &dynbuf))
{
error_free_dyn:
free (dynbuf);
goto error_return;
}
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
if (elfsec == SHN_BAD)
goto error_free_dyn;
shlink = elf_elfsections (abfd)[elfsec]->sh_link;
for (extdyn = dynbuf;
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
extdyn < dynbuf + s->size;
extdyn += bed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
bed->s->swap_dyn_in (abfd, extdyn, &dyn);
if (dyn.d_tag == DT_SONAME)
{
unsigned int tagv = dyn.d_un.d_val;
soname = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (soname == NULL)
goto error_free_dyn;
}
if (dyn.d_tag == DT_NEEDED)
{
struct bfd_link_needed_list *n, **pn;
char *fnm, *anm;
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
amt = strlen (fnm) + 1;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
anm = (char *) bfd_alloc (abfd, amt);
if (anm == NULL)
goto error_free_dyn;
memcpy (anm, fnm, amt);
n->name = anm;
n->by = abfd;
n->next = NULL;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
for (pn = &htab->needed; *pn != NULL; pn = &(*pn)->next)
;
*pn = n;
}
if (dyn.d_tag == DT_RUNPATH)
{
struct bfd_link_needed_list *n, **pn;
char *fnm, *anm;
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
amt = strlen (fnm) + 1;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
anm = (char *) bfd_alloc (abfd, amt);
if (anm == NULL)
goto error_free_dyn;
memcpy (anm, fnm, amt);
n->name = anm;
n->by = abfd;
n->next = NULL;
for (pn = & runpath;
*pn != NULL;
pn = &(*pn)->next)
;
*pn = n;
}
/* Ignore DT_RPATH if we have seen DT_RUNPATH. */
if (!runpath && dyn.d_tag == DT_RPATH)
{
struct bfd_link_needed_list *n, **pn;
char *fnm, *anm;
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
amt = strlen (fnm) + 1;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
anm = (char *) bfd_alloc (abfd, amt);
if (anm == NULL)
goto error_free_dyn;
memcpy (anm, fnm, amt);
n->name = anm;
n->by = abfd;
n->next = NULL;
for (pn = & rpath;
*pn != NULL;
pn = &(*pn)->next)
;
*pn = n;
}
if (dyn.d_tag == DT_AUDIT)
{
unsigned int tagv = dyn.d_un.d_val;
audit = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
}
}
free (dynbuf);
}
/* DT_RUNPATH overrides DT_RPATH. Do _NOT_ bfd_release, as that
frees all more recently bfd_alloc'd blocks as well. */
if (runpath)
rpath = runpath;
if (rpath)
{
struct bfd_link_needed_list **pn;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
for (pn = &htab->runpath; *pn != NULL; pn = &(*pn)->next)
;
*pn = rpath;
}
/* We do not want to include any of the sections in a dynamic
object in the output file. We hack by simply clobbering the
list of sections in the BFD. This could be handled more
cleanly by, say, a new section flag; the existing
SEC_NEVER_LOAD flag is not the one we want, because that one
still implies that the section takes up space in the output
file. */
bfd_section_list_clear (abfd);
/* Find the name to use in a DT_NEEDED entry that refers to this
object. If the object has a DT_SONAME entry, we use it.
Otherwise, if the generic linker stuck something in
elf_dt_name, we use that. Otherwise, we just use the file
name. */
if (soname == NULL || *soname == '\0')
{
soname = elf_dt_name (abfd);
if (soname == NULL || *soname == '\0')
soname = bfd_get_filename (abfd);
}
/* Save the SONAME because sometimes the linker emulation code
will need to know it. */
elf_dt_name (abfd) = soname;
ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
if (ret < 0)
goto error_return;
/* If we have already included this dynamic object in the
link, just ignore it. There is no reason to include a
particular dynamic object more than once. */
if (ret > 0)
return TRUE;
/* Save the DT_AUDIT entry for the linker emulation code. */
Remove trailing white spaces in bfd * aout0.c: Remove trailing white spaces. * archive.c: Likewise. * archures.c: Likewise. * bfd-in.h: Likewise. * bfd-in2.h: Likewise. * coff-alpha.c: Likewise. * coff-i860.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-tic80.c: Likewise. * coff-x86_64.c: Likewise. * coff-z80.c: Likewise. * coffcode.h: Likewise. * coffgen.c: Likewise. * cofflink.c: Likewise. * compress.c: Likewise. * corefile.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-crx.c: Likewise. * cpu-h8300.c: Likewise. * cpu-i386.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m68k.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-sh.c: Likewise. * cpu-xc16x.c: Likewise. * dwarf2.c: Likewise. * ecofflink.c: Likewise. * ecoffswap.h: Likewise. * elf-ifunc.c: Likewise. * elf-m10300.c: Likewise. * elf-vxworks.c: Likewise. * elf32-avr.c: Likewise. * elf32-avr.h: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i860.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.h: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-v850.c: Likewise. * elf32-xc16x.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elfcore.h: Likewise. * elflink.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * ieee.c: Likewise. * libcoff.h: Likewise. * libpei.h: Likewise. * libxcoff.h: Likewise. * linker.c: Likewise. * mach-o-i386.c: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mach-o.h: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * pe-x86_64.c: Likewise. * peXXigen.c: Likewise. * pef-traceback.h: Likewise. * pei-x86_64.c: Likewise. * peicode.h: Likewise. * plugin.c: Likewise. * reloc.c: Likewise. * riscix.c: Likewise. * section.c: Likewise. * som.c: Likewise. * syms.c: Likewise. * tekhex.c: Likewise. * ticoff.h: Likewise. * vaxbsd.c: Likewise. * xcofflink.c: Likewise. * xtensa-isa.c: Likewise.
2013-01-10 21:03:55 +01:00
elf_dt_audit (abfd) = audit;
}
/* If this is a dynamic object, we always link against the .dynsym
symbol table, not the .symtab symbol table. The dynamic linker
will only see the .dynsym symbol table, so there is no reason to
look at .symtab for a dynamic object. */
if (! dynamic || elf_dynsymtab (abfd) == 0)
hdr = &elf_tdata (abfd)->symtab_hdr;
else
hdr = &elf_tdata (abfd)->dynsymtab_hdr;
symcount = hdr->sh_size / bed->s->sizeof_sym;
/* The sh_info field of the symtab header tells us where the
external symbols start. We don't care about the local symbols at
this point. */
if (elf_bad_symtab (abfd))
{
extsymcount = symcount;
extsymoff = 0;
}
else
{
extsymcount = symcount - hdr->sh_info;
extsymoff = hdr->sh_info;
}
sym_hash = elf_sym_hashes (abfd);
if (extsymcount != 0)
{
isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
NULL, NULL, NULL);
if (isymbuf == NULL)
goto error_return;
if (sym_hash == NULL)
{
/* We store a pointer to the hash table entry for each
external symbol. */
amt = extsymcount * sizeof (struct elf_link_hash_entry *);
sym_hash = (struct elf_link_hash_entry **) bfd_zalloc (abfd, amt);
if (sym_hash == NULL)
goto error_free_sym;
elf_sym_hashes (abfd) = sym_hash;
}
}
if (dynamic)
{
/* Read in any version definitions. */
if (!_bfd_elf_slurp_version_tables (abfd,
info->default_imported_symver))
goto error_free_sym;
/* Read in the symbol versions, but don't bother to convert them
to internal format. */
if (elf_dynversym (abfd) != 0)
{
Elf_Internal_Shdr *versymhdr;
versymhdr = &elf_tdata (abfd)->dynversym_hdr;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
if (extversym == NULL)
goto error_free_sym;
amt = versymhdr->sh_size;
if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0
|| bfd_bread (extversym, amt, abfd) != amt)
goto error_free_vers;
}
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
/* If we are loading an as-needed shared lib, save the symbol table
state before we start adding symbols. If the lib turns out
to be unneeded, restore the state. */
if ((elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0)
{
unsigned int i;
size_t entsize;
for (entsize = 0, i = 0; i < htab->root.table.size; i++)
{
struct bfd_hash_entry *p;
struct elf_link_hash_entry *h;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
for (p = htab->root.table.table[i]; p != NULL; p = p->next)
{
h = (struct elf_link_hash_entry *) p;
entsize += htab->root.table.entsize;
if (h->root.type == bfd_link_hash_warning)
entsize += htab->root.table.entsize;
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
}
tabsize = htab->root.table.size * sizeof (struct bfd_hash_entry *);
old_tab = bfd_malloc (tabsize + entsize);
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (old_tab == NULL)
goto error_free_vers;
/* Remember the current objalloc pointer, so that all mem for
symbols added can later be reclaimed. */
alloc_mark = bfd_hash_allocate (&htab->root.table, 1);
if (alloc_mark == NULL)
goto error_free_vers;
/* Make a special call to the linker "notice" function to
tell it that we are about to handle an as-needed lib. */
if (!(*bed->notice_as_needed) (abfd, info, notice_as_needed))
goto error_free_vers;
/* Clone the symbol table. Remember some pointers into the
symbol table, and dynamic symbol count. */
old_ent = (char *) old_tab + tabsize;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
memcpy (old_tab, htab->root.table.table, tabsize);
old_undefs = htab->root.undefs;
old_undefs_tail = htab->root.undefs_tail;
old_table = htab->root.table.table;
old_size = htab->root.table.size;
old_count = htab->root.table.count;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
old_dynsymcount = htab->dynsymcount;
old_dynstr_size = _bfd_elf_strtab_size (htab->dynstr);
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
for (i = 0; i < htab->root.table.size; i++)
{
struct bfd_hash_entry *p;
struct elf_link_hash_entry *h;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
for (p = htab->root.table.table[i]; p != NULL; p = p->next)
{
memcpy (old_ent, p, htab->root.table.entsize);
old_ent = (char *) old_ent + htab->root.table.entsize;
h = (struct elf_link_hash_entry *) p;
if (h->root.type == bfd_link_hash_warning)
{
memcpy (old_ent, h->root.u.i.link, htab->root.table.entsize);
old_ent = (char *) old_ent + htab->root.table.entsize;
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
}
}
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
weaks = NULL;
ever = extversym != NULL ? extversym + extsymoff : NULL;
for (isym = isymbuf, isymend = isymbuf + extsymcount;
isym < isymend;
isym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL))
{
int bind;
bfd_vma value;
asection *sec, *new_sec;
flagword flags;
const char *name;
struct elf_link_hash_entry *h;
struct elf_link_hash_entry *hi;
bfd_boolean definition;
bfd_boolean size_change_ok;
bfd_boolean type_change_ok;
bfd_boolean new_weakdef;
bfd_boolean new_weak;
bfd_boolean old_weak;
bfd_boolean override;
bfd_boolean common;
unsigned int old_alignment;
bfd *old_bfd;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
bfd_boolean matched;
override = FALSE;
flags = BSF_NO_FLAGS;
sec = NULL;
value = isym->st_value;
common = bed->common_definition (isym);
bind = ELF_ST_BIND (isym->st_info);
* config/obj-elf.c (obj_elf_type): Add code to support a type of gnu_unique_object. * doc/as.texinfo: Document new feature of .type directive. * NEWS: Mention support for gnu_unique_object symbol type. * common.h (STB_GNU_UNIQUE): Define. * NEWS: Mention the linker's support for symbols with a binding of STB_GNU_UNIQUE. * gas/elf/type.s: Add unique global symbol definition. * gas/elf/type.e: Add expected readelf output for global unique symbol. * elfcpp.h (enum STB): Add STB_GNU_UNIQUE. * readelf.c (get_symbol_binding): For Linux targeted files return UNIQUE for symbols with the STB_GNU_UNIQUE binding. * doc/binutils.texi: Document the meaning of the 'u' symbol binding in the output of nm and objdump --syms. * elf-bfd.h (struct elf_link_hash_entry): Add unique_global field. * elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols with the BSF_GNU_UNIQUE flag bit set. * elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. * elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols with the STB_GNU_UNIQUE binding. (elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. Set STB_GNU_UNIQUE for symbols with the unique_global field set. (elf_link_output_extsym): Set unique_global field for symbols with the STB_GNU_UNIQUE binding. * syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit. (bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE symbols. (bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE symbols. * bfd-in2.h: Regenerate.
2009-07-23 15:00:30 +02:00
switch (bind)
{
* config/obj-elf.c (obj_elf_type): Add code to support a type of gnu_unique_object. * doc/as.texinfo: Document new feature of .type directive. * NEWS: Mention support for gnu_unique_object symbol type. * common.h (STB_GNU_UNIQUE): Define. * NEWS: Mention the linker's support for symbols with a binding of STB_GNU_UNIQUE. * gas/elf/type.s: Add unique global symbol definition. * gas/elf/type.e: Add expected readelf output for global unique symbol. * elfcpp.h (enum STB): Add STB_GNU_UNIQUE. * readelf.c (get_symbol_binding): For Linux targeted files return UNIQUE for symbols with the STB_GNU_UNIQUE binding. * doc/binutils.texi: Document the meaning of the 'u' symbol binding in the output of nm and objdump --syms. * elf-bfd.h (struct elf_link_hash_entry): Add unique_global field. * elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols with the BSF_GNU_UNIQUE flag bit set. * elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. * elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols with the STB_GNU_UNIQUE binding. (elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. Set STB_GNU_UNIQUE for symbols with the unique_global field set. (elf_link_output_extsym): Set unique_global field for symbols with the STB_GNU_UNIQUE binding. * syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit. (bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE symbols. (bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE symbols. * bfd-in2.h: Regenerate.
2009-07-23 15:00:30 +02:00
case STB_LOCAL:
/* This should be impossible, since ELF requires that all
global symbols follow all local symbols, and that sh_info
point to the first global symbol. Unfortunately, Irix 5
screws this up. */
continue;
* config/obj-elf.c (obj_elf_type): Add code to support a type of gnu_unique_object. * doc/as.texinfo: Document new feature of .type directive. * NEWS: Mention support for gnu_unique_object symbol type. * common.h (STB_GNU_UNIQUE): Define. * NEWS: Mention the linker's support for symbols with a binding of STB_GNU_UNIQUE. * gas/elf/type.s: Add unique global symbol definition. * gas/elf/type.e: Add expected readelf output for global unique symbol. * elfcpp.h (enum STB): Add STB_GNU_UNIQUE. * readelf.c (get_symbol_binding): For Linux targeted files return UNIQUE for symbols with the STB_GNU_UNIQUE binding. * doc/binutils.texi: Document the meaning of the 'u' symbol binding in the output of nm and objdump --syms. * elf-bfd.h (struct elf_link_hash_entry): Add unique_global field. * elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols with the BSF_GNU_UNIQUE flag bit set. * elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. * elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols with the STB_GNU_UNIQUE binding. (elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. Set STB_GNU_UNIQUE for symbols with the unique_global field set. (elf_link_output_extsym): Set unique_global field for symbols with the STB_GNU_UNIQUE binding. * syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit. (bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE symbols. (bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE symbols. * bfd-in2.h: Regenerate.
2009-07-23 15:00:30 +02:00
case STB_GLOBAL:
if (isym->st_shndx != SHN_UNDEF && !common)
flags = BSF_GLOBAL;
* config/obj-elf.c (obj_elf_type): Add code to support a type of gnu_unique_object. * doc/as.texinfo: Document new feature of .type directive. * NEWS: Mention support for gnu_unique_object symbol type. * common.h (STB_GNU_UNIQUE): Define. * NEWS: Mention the linker's support for symbols with a binding of STB_GNU_UNIQUE. * gas/elf/type.s: Add unique global symbol definition. * gas/elf/type.e: Add expected readelf output for global unique symbol. * elfcpp.h (enum STB): Add STB_GNU_UNIQUE. * readelf.c (get_symbol_binding): For Linux targeted files return UNIQUE for symbols with the STB_GNU_UNIQUE binding. * doc/binutils.texi: Document the meaning of the 'u' symbol binding in the output of nm and objdump --syms. * elf-bfd.h (struct elf_link_hash_entry): Add unique_global field. * elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols with the BSF_GNU_UNIQUE flag bit set. * elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. * elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols with the STB_GNU_UNIQUE binding. (elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. Set STB_GNU_UNIQUE for symbols with the unique_global field set. (elf_link_output_extsym): Set unique_global field for symbols with the STB_GNU_UNIQUE binding. * syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit. (bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE symbols. (bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE symbols. * bfd-in2.h: Regenerate.
2009-07-23 15:00:30 +02:00
break;
case STB_WEAK:
flags = BSF_WEAK;
break;
case STB_GNU_UNIQUE:
flags = BSF_GNU_UNIQUE;
break;
default:
/* Leave it up to the processor backend. */
* config/obj-elf.c (obj_elf_type): Add code to support a type of gnu_unique_object. * doc/as.texinfo: Document new feature of .type directive. * NEWS: Mention support for gnu_unique_object symbol type. * common.h (STB_GNU_UNIQUE): Define. * NEWS: Mention the linker's support for symbols with a binding of STB_GNU_UNIQUE. * gas/elf/type.s: Add unique global symbol definition. * gas/elf/type.e: Add expected readelf output for global unique symbol. * elfcpp.h (enum STB): Add STB_GNU_UNIQUE. * readelf.c (get_symbol_binding): For Linux targeted files return UNIQUE for symbols with the STB_GNU_UNIQUE binding. * doc/binutils.texi: Document the meaning of the 'u' symbol binding in the output of nm and objdump --syms. * elf-bfd.h (struct elf_link_hash_entry): Add unique_global field. * elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols with the BSF_GNU_UNIQUE flag bit set. * elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. * elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols with the STB_GNU_UNIQUE binding. (elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. Set STB_GNU_UNIQUE for symbols with the unique_global field set. (elf_link_output_extsym): Set unique_global field for symbols with the STB_GNU_UNIQUE binding. * syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit. (bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE symbols. (bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE symbols. * bfd-in2.h: Regenerate.
2009-07-23 15:00:30 +02:00
break;
}
if (isym->st_shndx == SHN_UNDEF)
sec = bfd_und_section_ptr;
else if (isym->st_shndx == SHN_ABS)
sec = bfd_abs_section_ptr;
else if (isym->st_shndx == SHN_COMMON)
{
sec = bfd_com_section_ptr;
/* What ELF calls the size we call the value. What ELF
calls the value we call the alignment. */
value = isym->st_size;
}
else
{
sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
if (sec == NULL)
sec = bfd_abs_section_ptr;
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
else if (discarded_section (sec))
{
/* Symbols from discarded section are undefined. We keep
its visibility. */
sec = bfd_und_section_ptr;
isym->st_shndx = SHN_UNDEF;
}
else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
value -= sec->vma;
}
name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
isym->st_name);
if (name == NULL)
goto error_free_vers;
if (isym->st_shndx == SHN_COMMON
&& (abfd->flags & BFD_PLUGIN) != 0)
{
asection *xc = bfd_get_section_by_name (abfd, "COMMON");
if (xc == NULL)
{
flagword sflags = (SEC_ALLOC | SEC_IS_COMMON | SEC_KEEP
| SEC_EXCLUDE);
xc = bfd_make_section_with_flags (abfd, "COMMON", sflags);
if (xc == NULL)
goto error_free_vers;
}
sec = xc;
}
else if (isym->st_shndx == SHN_COMMON
&& ELF_ST_TYPE (isym->st_info) == STT_TLS
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& !bfd_link_relocatable (info))
{
asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon");
if (tcomm == NULL)
{
flagword sflags = (SEC_ALLOC | SEC_THREAD_LOCAL | SEC_IS_COMMON
| SEC_LINKER_CREATED);
tcomm = bfd_make_section_with_flags (abfd, ".tcommon", sflags);
2005-05-05 H.J. Lu <hongjiu.lu@intel.com> * section.c (bfd_make_section_anyway_with_flags): New. (bfd_make_section_anyway): Call bfd_make_section_anyway_with_flags, (bfd_make_section_with_flags): New. (bfd_make_section): Call bfd_make_section_with_flags. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Call bfd_make_section_with_flags/bfd_make_section_anyway_with_flags instead of bfd_make_section/bfd_make_section and don't call bfd_set_section_flags. (mn10300_elf_check_relocs): Likewise. (_bfd_mn10300_elf_create_dynamic_sections): Likewise. * elf32-arm.c (create_got_section): Likewise. (bfd_elf32_arm_add_glue_sections_to_bfd): Likewise. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_add_symbol_hook): Likewise. (_frv_create_got_section): Likewise. (elf32_frvfdpic_create_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_create_dynamic_sections): Likewise. (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_create_dynamic_sections): Likewise. (i370_elf_check_relocs): Likewise. * elf32-i386.c (create_got_section): Likewise. (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise. (create_got_section): Likewise. (m32r_elf_create_dynamic_sections): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_create_got): Likewise. (ppc_elf_create_dynamic_sections): Likewise. (ppc_elf_add_symbol_hook): Likewise. (ppc_elf_check_relocs): Likewise. * elf32-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf32-sh.c (create_got_section): Likewise. (sh_elf_create_dynamic_sections): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Likewise. (add_extra_plt_sections): Likewise. * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise. (elf64_alpha_create_got_section): Likewise. (elf64_alpha_create_dynamic_sections): Likewise. (elf64_alpha_check_relocs): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. (get_opd): Likewise. (get_plt): Likewise. (get_dlt): Likewise. (get_stub): Likewise. (elf64_hppa_create_dynamic_sectionso): Likewise. * elf64-mmix.c (mmix_elf_check_common_relocs): Likewise. * elf64-ppc.c (create_linkage_sections): Likewise. (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (create_got_section): Likewise. (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_check_relocs): Likewise. (sh64_elf64_create_dynamic_sections): Likewise. * elf64-x86-64.c (create_got_section): Likewise. (elf64_x86_64_check_relocs): Likewise. * elflink.c (_bfd_elf_create_got_section): Likewise. (_bfd_elf_link_create_dynamic_sections): Likewise. (elf_link_add_object_symbols): Likewise. * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise. (elfNN_ia64_create_dynamic_sections): Likewise. (get_fptr): Likewise. (get_pltoff): Likewise. (get_reloc_section): Likewise. (elfNN_ia64_object_p): Likewise. * elfxx-mips.c (mips_elf_rel_dyn_section): Likewise. (mips_elf_create_compact_rel_section): Likewise. (mips_elf_create_got_section): Likewise. (_bfd_mips_elf_create_dynamic_sections): Likewise. * elfxx-sparc.c (create_got_section): Likewise. (_bfd_sparc_elf_check_relocs): Likewise. * elf.c (_bfd_elf_new_section_hook): Call _bfd_elf_get_sec_type_attr on linker created sections.
2005-05-05 16:34:04 +02:00
if (tcomm == NULL)
goto error_free_vers;
}
sec = tcomm;
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
else if (bed->elf_add_symbol_hook)
{
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (! (*bed->elf_add_symbol_hook) (abfd, info, isym, &name, &flags,
&sec, &value))
goto error_free_vers;
/* The hook function sets the name to NULL if this symbol
should be skipped for some reason. */
if (name == NULL)
continue;
}
/* Sanity check that all possibilities were handled. */
if (sec == NULL)
{
bfd_set_error (bfd_error_bad_value);
goto error_free_vers;
}
/* Silently discard TLS symbols from --just-syms. There's
no way to combine a static TLS block with a new TLS block
for this executable. */
if (ELF_ST_TYPE (isym->st_info) == STT_TLS
&& sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
continue;
if (bfd_is_und_section (sec)
|| bfd_is_com_section (sec))
definition = FALSE;
else
definition = TRUE;
size_change_ok = FALSE;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
type_change_ok = bed->type_change_ok;
old_weak = FALSE;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
matched = FALSE;
old_alignment = 0;
old_bfd = NULL;
new_sec = sec;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (is_elf_hash_table (htab))
{
Elf_Internal_Versym iver;
unsigned int vernum = 0;
bfd_boolean skip;
if (ever == NULL)
{
if (info->default_imported_symver)
/* Use the default symbol version created earlier. */
iver.vs_vers = elf_tdata (abfd)->cverdefs;
else
iver.vs_vers = 0;
}
else
_bfd_elf_swap_versym_in (abfd, ever, &iver);
vernum = iver.vs_vers & VERSYM_VERSION;
/* If this is a hidden symbol, or if it is not version
1, we append the version name to the symbol name.
However, we do not modify a non-hidden absolute symbol
if it is not a function, because it might be the version
symbol itself. FIXME: What if it isn't? */
if ((iver.vs_vers & VERSYM_HIDDEN) != 0
|| (vernum > 1
&& (!bfd_is_abs_section (sec)
|| bed->is_function_type (ELF_ST_TYPE (isym->st_info)))))
{
const char *verstr;
size_t namelen, verlen, newlen;
char *newname, *p;
if (isym->st_shndx != SHN_UNDEF)
{
if (vernum > elf_tdata (abfd)->cverdefs)
verstr = NULL;
else if (vernum > 1)
verstr =
elf_tdata (abfd)->verdef[vernum - 1].vd_nodename;
else
verstr = "";
if (verstr == NULL)
{
(*_bfd_error_handler)
(_("%B: %s: invalid version %u (max %d)"),
abfd, name, vernum,
elf_tdata (abfd)->cverdefs);
bfd_set_error (bfd_error_bad_value);
goto error_free_vers;
}
}
else
{
/* We cannot simply test for the number of
entries in the VERNEED section since the
numbers for the needed versions do not start
at 0. */
Elf_Internal_Verneed *t;
verstr = NULL;
for (t = elf_tdata (abfd)->verref;
t != NULL;
t = t->vn_nextref)
{
Elf_Internal_Vernaux *a;
for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
{
if (a->vna_other == vernum)
{
verstr = a->vna_nodename;
break;
}
}
if (a != NULL)
break;
}
if (verstr == NULL)
{
(*_bfd_error_handler)
(_("%B: %s: invalid needed version %d"),
abfd, name, vernum);
bfd_set_error (bfd_error_bad_value);
goto error_free_vers;
}
}
namelen = strlen (name);
verlen = strlen (verstr);
newlen = namelen + verlen + 2;
if ((iver.vs_vers & VERSYM_HIDDEN) == 0
&& isym->st_shndx != SHN_UNDEF)
++newlen;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
newname = (char *) bfd_hash_allocate (&htab->root.table, newlen);
if (newname == NULL)
goto error_free_vers;
memcpy (newname, name, namelen);
p = newname + namelen;
*p++ = ELF_VER_CHR;
/* If this is a defined non-hidden version symbol,
we add another @ to the name. This indicates the
default version of the symbol. */
if ((iver.vs_vers & VERSYM_HIDDEN) == 0
&& isym->st_shndx != SHN_UNDEF)
*p++ = ELF_VER_CHR;
memcpy (p, verstr, verlen + 1);
name = newname;
}
/* If this symbol has default visibility and the user has
requested we not re-export it, then mark it as hidden. */
if (!bfd_is_und_section (sec)
&& !dynamic
PR ld/17973 LTO file syms LTO output objects have an STT_FILE symbol using the name of the file, a temporary file. This results in executables that can't be exactly reproduced, so the file name needs to be dropped. We don't want to lose all file symbols when linking a mix of lto and non-lto objects as a file symbol can be used to figure which source file generated a given local symbol. So lto output objects need to be marked. I chose to mark lto output objects with a new bfd flag. This flag is also used to fix a bug in the link-once handling; An object being loaded after "loading_lto_outputs" is set might be one extracted from an archive to satisfy new references from lto objects, not an lto object itself. The new flag is copied from archive to elements, and the same done for no_export. This fixes a bug in that --exclude-libs doesn't work with thin archives. I'm not completely happy with this part of the patch and may revist this to avoid the hack in _bfd_look_for_bfd_in_cache. PR ld/17973 include/ * bfdlink.h (struct bfd_link_info): Delete loading_lto_outputs. bfd/ * bfd.c (struct bfd): Add lto_output. * linker.c (_bfd_handle_already_linked): Explicitly test for objects added by the lto plugin. * opncls.c (_bfd_new_bfd_contained_in): Copy lto_output and no_export flags from archive. * archive.c (open_nested_file): New function, setting lto_output and no_export, extracted from.. (find_nested_archive): ..here. Flip params. Rename from _bfd_find_nested_archive. (_bfd_get_elt_at_filepos): Correct var typo. Use open_nested_file. (_bfd_look_for_bfd_in_cache): Copy no_export. * elflink.c (elf_link_add_object_symbols): Remove now unnecessary my_archive->no_export test. (elf_link_input_bfd): Drop existing lto_output STT_FILE syms. Don't use the file name when adding lto_output STT_FILE sym. * bfd-in2.h: Regenerate. ld/ * ldlang.h (struct lang_input_statement_flags): Add lto_output. * ldlang.c (lang_process): Don't set loading_lto_outputs. * ldfile.c (ldfile_try_open_bfd): Transfer entry flags.lto_output to bfd. * plugin.c (add_input_file, add_input_library): Set flags.lto_output.
2015-02-14 09:08:32 +01:00
&& abfd->no_export
&& ELF_ST_VISIBILITY (isym->st_other) != STV_INTERNAL)
isym->st_other = (STV_HIDDEN
| (isym->st_other & ~ELF_ST_VISIBILITY (-1)));
if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec, &value,
sym_hash, &old_bfd, &old_weak,
&old_alignment, &skip, &override,
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
&type_change_ok, &size_change_ok,
&matched))
goto error_free_vers;
if (skip)
continue;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
/* Override a definition only if the new symbol matches the
existing one. */
if (override && matched)
definition = FALSE;
h = *sym_hash;
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if (elf_tdata (abfd)->verdef != NULL
&& vernum > 1
&& definition)
h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1];
}
if (! (_bfd_generic_link_add_one_symbol
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
(info, abfd, name, flags, sec, value, NULL, FALSE, bed->collect,
(struct bfd_link_hash_entry **) sym_hash)))
goto error_free_vers;
h = *sym_hash;
/* We need to make sure that indirect symbol dynamic flags are
updated. */
hi = h;
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
* config/obj-elf.c (obj_elf_type): Add code to support a type of gnu_unique_object. * doc/as.texinfo: Document new feature of .type directive. * NEWS: Mention support for gnu_unique_object symbol type. * common.h (STB_GNU_UNIQUE): Define. * NEWS: Mention the linker's support for symbols with a binding of STB_GNU_UNIQUE. * gas/elf/type.s: Add unique global symbol definition. * gas/elf/type.e: Add expected readelf output for global unique symbol. * elfcpp.h (enum STB): Add STB_GNU_UNIQUE. * readelf.c (get_symbol_binding): For Linux targeted files return UNIQUE for symbols with the STB_GNU_UNIQUE binding. * doc/binutils.texi: Document the meaning of the 'u' symbol binding in the output of nm and objdump --syms. * elf-bfd.h (struct elf_link_hash_entry): Add unique_global field. * elf.c (swap_out_syms): Set binding to STB_GNU_UNIQUE for symbols with the BSF_GNU_UNIQUE flag bit set. * elfcode.h (elf_slurp_symbol_table): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. * elflink.c (_bfd_elf_merge_symbol): Set unique_global for symbols with the STB_GNU_UNIQUE binding. (elf_link_add_object_symbols): Set the BSF_GNU_UNIQUE flag for symbols with STB_GNU_UNIQUE binding. Set STB_GNU_UNIQUE for symbols with the unique_global field set. (elf_link_output_extsym): Set unique_global field for symbols with the STB_GNU_UNIQUE binding. * syms.c (struct bfd_symbol): Define BSF_GNU_UNIQUE flag bit. (bfd_print_symbol_vandf): Print a 'u' character for BSF_GNU_UNIQUE symbols. (bfd_decode_symclass): Return a 'u' character for BSF_GNU_UNIQUE symbols. * bfd-in2.h: Regenerate.
2009-07-23 15:00:30 +02:00
*sym_hash = h;
new_weak = (flags & BSF_WEAK) != 0;
new_weakdef = FALSE;
if (dynamic
&& definition
&& new_weak
&& !bed->is_function_type (ELF_ST_TYPE (isym->st_info))
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
&& is_elf_hash_table (htab)
&& h->u.weakdef == NULL)
{
/* Keep a list of all weak defined non function symbols from
a dynamic object, using the weakdef field. Later in this
function we will set the weakdef field to the correct
value. We only put non-function symbols from dynamic
objects on this list, because that happens to be the only
time we need to know the normal symbol corresponding to a
weak symbol, and the information is time consuming to
figure out. If the weakdef field is not already NULL,
then this symbol was already defined by some previous
dynamic object, and we will be using that previous
definition anyhow. */
h->u.weakdef = weaks;
weaks = h;
new_weakdef = TRUE;
}
/* Set the alignment of a common symbol. */
if ((common || bfd_is_com_section (sec))
&& h->root.type == bfd_link_hash_common)
{
unsigned int align;
if (common)
align = bfd_log2 (isym->st_value);
else
{
/* The new symbol is a common symbol in a shared object.
We need to get the alignment from the section. */
align = new_sec->alignment_power;
}
if (align > old_alignment)
h->root.u.c.p->alignment_power = align;
else
h->root.u.c.p->alignment_power = old_alignment;
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (is_elf_hash_table (htab))
{
/* Set a flag in the hash table entry indicating the type of
reference or definition we just found. A dynamic symbol
is one which is referenced or defined by both a regular
object and a shared object. */
bfd_boolean dynsym = FALSE;
/* Plugin symbols aren't normal. Don't set def_regular or
ref_regular for them, or make them dynamic. */
if ((abfd->flags & BFD_PLUGIN) != 0)
;
else if (! dynamic)
{
if (! definition)
{
h->ref_regular = 1;
if (bind != STB_WEAK)
h->ref_regular_nonweak = 1;
}
else
{
h->def_regular = 1;
if (h->def_dynamic)
{
h->def_dynamic = 0;
h->ref_dynamic = 1;
}
}
/* If the indirect symbol has been forced local, don't
make the real symbol dynamic. */
if ((h == hi || !hi->forced_local)
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& (bfd_link_dll (info)
|| h->def_dynamic
|| h->ref_dynamic))
dynsym = TRUE;
}
else
{
if (! definition)
{
h->ref_dynamic = 1;
hi->ref_dynamic = 1;
}
else
{
h->def_dynamic = 1;
hi->def_dynamic = 1;
}
/* If the indirect symbol has been forced local, don't
make the real symbol dynamic. */
if ((h == hi || !hi->forced_local)
&& (h->def_regular
|| h->ref_regular
|| (h->u.weakdef != NULL
&& ! new_weakdef
&& h->u.weakdef->dynindx != -1)))
dynsym = TRUE;
}
/* Check to see if we need to add an indirect symbol for
the default name. */
if (definition
|| (!override && h->root.type == bfd_link_hash_common))
if (!_bfd_elf_add_default_symbol (abfd, info, h, name, isym,
sec, value, &old_bfd, &dynsym))
goto error_free_vers;
/* Check the alignment when a common symbol is involved. This
can change when a common symbol is overridden by a normal
definition or a common symbol is ignored due to the old
normal definition. We need to make sure the maximum
alignment is maintained. */
if ((old_alignment || common)
&& h->root.type != bfd_link_hash_common)
{
unsigned int common_align;
unsigned int normal_align;
unsigned int symbol_align;
bfd *normal_bfd;
bfd *common_bfd;
BFD_ASSERT (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak);
symbol_align = ffs (h->root.u.def.value) - 1;
if (h->root.u.def.section->owner != NULL
&& (h->root.u.def.section->owner->flags & DYNAMIC) == 0)
{
normal_align = h->root.u.def.section->alignment_power;
if (normal_align > symbol_align)
normal_align = symbol_align;
}
else
normal_align = symbol_align;
if (old_alignment)
{
common_align = old_alignment;
common_bfd = old_bfd;
normal_bfd = abfd;
}
else
{
common_align = bfd_log2 (isym->st_value);
common_bfd = abfd;
normal_bfd = old_bfd;
}
if (normal_align < common_align)
{
/* PR binutils/2735 */
if (normal_bfd == NULL)
(*_bfd_error_handler)
(_("Warning: alignment %u of common symbol `%s' in %B is"
" greater than the alignment (%u) of its section %A"),
common_bfd, h->root.u.def.section,
1 << common_align, name, 1 << normal_align);
else
(*_bfd_error_handler)
(_("Warning: alignment %u of symbol `%s' in %B"
" is smaller than %u in %B"),
normal_bfd, common_bfd,
1 << normal_align, name, 1 << common_align);
}
}
/* Remember the symbol size if it isn't undefined. */
if (isym->st_size != 0
&& isym->st_shndx != SHN_UNDEF
&& (definition || h->size == 0))
{
if (h->size != 0
&& h->size != isym->st_size
&& ! size_change_ok)
(*_bfd_error_handler)
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
(_("Warning: size of symbol `%s' changed"
" from %lu in %B to %lu in %B"),
old_bfd, abfd,
name, (unsigned long) h->size,
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
(unsigned long) isym->st_size);
h->size = isym->st_size;
}
/* If this is a common symbol, then we always want H->SIZE
to be the size of the common symbol. The code just above
won't fix the size if a common symbol becomes larger. We
don't warn about a size change here, because that is
covered by --warn-common. Allow changes between different
function types. */
if (h->root.type == bfd_link_hash_common)
h->size = h->root.u.c.size;
if (ELF_ST_TYPE (isym->st_info) != STT_NOTYPE
&& ((definition && !new_weak)
|| (old_weak && h->root.type == bfd_link_hash_common)
|| h->type == STT_NOTYPE))
{
unsigned int type = ELF_ST_TYPE (isym->st_info);
/* Turn an IFUNC symbol from a DSO into a normal FUNC
symbol. */
if (type == STT_GNU_IFUNC
&& (abfd->flags & DYNAMIC) != 0)
type = STT_FUNC;
if (h->type != type)
{
if (h->type != STT_NOTYPE && ! type_change_ok)
(*_bfd_error_handler)
(_("Warning: type of symbol `%s' changed"
" from %d to %d in %B"),
abfd, name, h->type, type);
h->type = type;
}
}
/* Merge st_other field. */
elf_merge_st_other (abfd, h, isym, sec, definition, dynamic);
/* We don't want to make debug symbol dynamic. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (definition
&& (sec->flags & SEC_DEBUGGING)
&& !bfd_link_relocatable (info))
dynsym = FALSE;
/* Nor should we make plugin symbols dynamic. */
if ((abfd->flags & BFD_PLUGIN) != 0)
dynsym = FALSE;
include/elf/ * internal.h (elf_internal_sym): Add st_target_internal. * arm.h (arm_st_branch_type): New enum. (ARM_SYM_BRANCH_TYPE): New macro. bfd/ * elf-bfd.h (elf_link_hash_entry): Add target_internal. * elf.c (swap_out_syms): Set st_target_internal for each Elf_Internal_Sym. * elfcode.h (elf_swap_symbol_in): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise. * elf32-sh-symbian.c (sh_symbian_relocate_section): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elflink.c (elf_link_output_extsym): Likewise. (bfd_elf_final_link): Likewise. (elf_link_add_object_symbols): Copy st_target_internal to the hash table if we see a definition. (_bfd_elf_copy_link_hash_symbol_type): Copy target_internal. * elf32-arm.c (elf32_arm_stub_hash_entry): Replace st_type with a branch_type field. (a8_erratum_fix, a8_erratum_reloc): Likewise. (arm_type_of_stub): Replace actual_st_type with an actual_branch_type parameter. (arm_build_one_stub): Use branch types rather than st_types to determine the type of branch. (cortex_a8_erratum_scan): Likewise. (elf32_arm_size_stubs): Likewise. (bfd_elf32_arm_process_before_allocation): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_finish_dynamic_sections): Likewise. (elf32_arm_final_link_relocate): Replace sym_flags parameter with a branch_type parameter. (elf32_arm_relocate_section): Update call accordingly. (elf32_arm_adjust_dynamic_symbol): Don't check STT_ARM_TFUNC. (elf32_arm_output_map_sym): Initialize st_target_internal. (elf32_arm_output_stub_sym): Likewise. (elf32_arm_symbol_processing): Delete. (elf32_arm_swap_symbol_in): Convert STT_ARM_TFUNCs into STT_FUNCs. Use st_target_internal to record the branch type. (elf32_arm_swap_symbol_out): Use st_target_internal to test for Thumb functions. (elf32_arm_is_function_type): Delete. (elf_backend_symbol_processing): Likewise. (elf_backend_is_function_type): Likewise. gas/ * config/tc-arm.c (arm_adjust_symtab): Set the branch type for Thumb symbols. ld/ * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Check eh->target_internal. opcodes/ * arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC. Use branch types instead. (print_insn): Likewise.
2011-03-14 16:55:04 +01:00
if (definition)
{
h->target_internal = isym->st_target_internal;
h->unique_global = (flags & BSF_GNU_UNIQUE) != 0;
}
include/elf/ * internal.h (elf_internal_sym): Add st_target_internal. * arm.h (arm_st_branch_type): New enum. (ARM_SYM_BRANCH_TYPE): New macro. bfd/ * elf-bfd.h (elf_link_hash_entry): Add target_internal. * elf.c (swap_out_syms): Set st_target_internal for each Elf_Internal_Sym. * elfcode.h (elf_swap_symbol_in): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise. * elf32-sh-symbian.c (sh_symbian_relocate_section): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elflink.c (elf_link_output_extsym): Likewise. (bfd_elf_final_link): Likewise. (elf_link_add_object_symbols): Copy st_target_internal to the hash table if we see a definition. (_bfd_elf_copy_link_hash_symbol_type): Copy target_internal. * elf32-arm.c (elf32_arm_stub_hash_entry): Replace st_type with a branch_type field. (a8_erratum_fix, a8_erratum_reloc): Likewise. (arm_type_of_stub): Replace actual_st_type with an actual_branch_type parameter. (arm_build_one_stub): Use branch types rather than st_types to determine the type of branch. (cortex_a8_erratum_scan): Likewise. (elf32_arm_size_stubs): Likewise. (bfd_elf32_arm_process_before_allocation): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_finish_dynamic_sections): Likewise. (elf32_arm_final_link_relocate): Replace sym_flags parameter with a branch_type parameter. (elf32_arm_relocate_section): Update call accordingly. (elf32_arm_adjust_dynamic_symbol): Don't check STT_ARM_TFUNC. (elf32_arm_output_map_sym): Initialize st_target_internal. (elf32_arm_output_stub_sym): Likewise. (elf32_arm_symbol_processing): Delete. (elf32_arm_swap_symbol_in): Convert STT_ARM_TFUNCs into STT_FUNCs. Use st_target_internal to record the branch type. (elf32_arm_swap_symbol_out): Use st_target_internal to test for Thumb functions. (elf32_arm_is_function_type): Delete. (elf_backend_symbol_processing): Likewise. (elf_backend_is_function_type): Likewise. gas/ * config/tc-arm.c (arm_adjust_symtab): Set the branch type for Thumb symbols. ld/ * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Check eh->target_internal. opcodes/ * arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC. Use branch types instead. (print_insn): Likewise.
2011-03-14 16:55:04 +01:00
if (definition && !dynamic)
{
char *p = strchr (name, ELF_VER_CHR);
if (p != NULL && p[1] != ELF_VER_CHR)
{
/* Queue non-default versions so that .symver x, x@FOO
aliases can be checked. */
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (!nondeflt_vers)
{
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
amt = ((isymend - isym + 1)
* sizeof (struct elf_link_hash_entry *));
nondeflt_vers
= (struct elf_link_hash_entry **) bfd_malloc (amt);
if (!nondeflt_vers)
goto error_free_vers;
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
nondeflt_vers[nondeflt_vers_cnt++] = h;
}
}
if (dynsym && h->dynindx == -1)
{
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers;
if (h->u.weakdef != NULL
&& ! new_weakdef
&& h->u.weakdef->dynindx == -1)
{
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (!bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef))
goto error_free_vers;
}
}
else if (dynsym && h->dynindx != -1)
/* If the symbol already has a dynamic index, but
visibility says it should not be visible, turn it into
a local symbol. */
switch (ELF_ST_VISIBILITY (h->other))
{
case STV_INTERNAL:
case STV_HIDDEN:
(*bed->elf_backend_hide_symbol) (info, h, TRUE);
dynsym = FALSE;
break;
}
/* Don't add DT_NEEDED for references from the dummy bfd nor
for unmatched symbol. */
if (!add_needed
&& matched
&& definition
&& ((dynsym
&& h->ref_regular_nonweak
&& (old_bfd == NULL
|| (old_bfd->flags & BFD_PLUGIN) == 0))
|| (h->ref_dynamic_nonweak
&& (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
&& !on_needed_list (elf_dt_name (abfd), htab->needed))))
{
int ret;
const char *soname = elf_dt_name (abfd);
info->callbacks->minfo ("%!", soname, old_bfd,
h->root.root.string);
/* A symbol from a library loaded via DT_NEEDED of some
other library is referenced by a regular object.
Add a DT_NEEDED entry for it. Issue an error if
--no-add-needed is used and the reference was not
a weak one. */
if (old_bfd != NULL
&& (elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0)
{
(*_bfd_error_handler)
(_("%B: undefined reference to symbol '%s'"),
old_bfd, name);
bfd_set_error (bfd_error_missing_dso);
goto error_free_vers;
}
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
elf_dyn_lib_class (abfd) = (enum dynamic_lib_link_class)
(elf_dyn_lib_class (abfd) & ~DYN_AS_NEEDED);
add_needed = TRUE;
ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
if (ret < 0)
goto error_free_vers;
BFD_ASSERT (ret == 0);
}
}
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (extversym != NULL)
{
free (extversym);
extversym = NULL;
}
if (isymbuf != NULL)
{
free (isymbuf);
isymbuf = NULL;
}
if ((elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0)
{
unsigned int i;
/* Restore the symbol table. */
old_ent = (char *) old_tab + tabsize;
memset (elf_sym_hashes (abfd), 0,
extsymcount * sizeof (struct elf_link_hash_entry *));
htab->root.table.table = old_table;
htab->root.table.size = old_size;
htab->root.table.count = old_count;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
memcpy (htab->root.table.table, old_tab, tabsize);
htab->root.undefs = old_undefs;
htab->root.undefs_tail = old_undefs_tail;
_bfd_elf_strtab_restore_size (htab->dynstr, old_dynstr_size);
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
for (i = 0; i < htab->root.table.size; i++)
{
struct bfd_hash_entry *p;
struct elf_link_hash_entry *h;
bfd_size_type size;
unsigned int alignment_power;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
for (p = htab->root.table.table[i]; p != NULL; p = p->next)
{
h = (struct elf_link_hash_entry *) p;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if (h->dynindx >= old_dynsymcount
&& h->dynstr_index < old_dynstr_size)
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
_bfd_elf_strtab_delref (htab->dynstr, h->dynstr_index);
/* Preserve the maximum alignment and size for common
symbols even if this dynamic lib isn't on DT_NEEDED
since it can still be loaded at run time by another
dynamic lib. */
if (h->root.type == bfd_link_hash_common)
{
size = h->root.u.c.size;
alignment_power = h->root.u.c.p->alignment_power;
}
else
{
size = 0;
alignment_power = 0;
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
memcpy (p, old_ent, htab->root.table.entsize);
old_ent = (char *) old_ent + htab->root.table.entsize;
h = (struct elf_link_hash_entry *) p;
if (h->root.type == bfd_link_hash_warning)
{
memcpy (h->root.u.i.link, old_ent, htab->root.table.entsize);
old_ent = (char *) old_ent + htab->root.table.entsize;
h = (struct elf_link_hash_entry *) h->root.u.i.link;
}
if (h->root.type == bfd_link_hash_common)
{
if (size > h->root.u.c.size)
h->root.u.c.size = size;
if (alignment_power > h->root.u.c.p->alignment_power)
h->root.u.c.p->alignment_power = alignment_power;
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
}
}
/* Make a special call to the linker "notice" function to
tell it that symbols added for crefs may need to be removed. */
if (!(*bed->notice_as_needed) (abfd, info, notice_not_needed))
goto error_free_vers;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
free (old_tab);
objalloc_free_block ((struct objalloc *) htab->root.table.memory,
alloc_mark);
if (nondeflt_vers != NULL)
free (nondeflt_vers);
return TRUE;
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (old_tab != NULL)
{
if (!(*bed->notice_as_needed) (abfd, info, notice_needed))
goto error_free_vers;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
free (old_tab);
old_tab = NULL;
}
/* Now that all the symbols from this input file are created, if
not performing a relocatable link, handle .symver foo, foo@BAR
such that any relocs against foo become foo@BAR. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (info) && nondeflt_vers != NULL)
{
bfd_size_type cnt, symidx;
for (cnt = 0; cnt < nondeflt_vers_cnt; ++cnt)
{
struct elf_link_hash_entry *h = nondeflt_vers[cnt], *hi;
char *shortname, *p;
p = strchr (h->root.root.string, ELF_VER_CHR);
if (p == NULL
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak))
continue;
amt = p - h->root.root.string;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
shortname = (char *) bfd_malloc (amt + 1);
if (!shortname)
goto error_free_vers;
memcpy (shortname, h->root.root.string, amt);
shortname[amt] = '\0';
hi = (struct elf_link_hash_entry *)
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
bfd_link_hash_lookup (&htab->root, shortname,
FALSE, FALSE, FALSE);
if (hi != NULL
&& hi->root.type == h->root.type
&& hi->root.u.def.value == h->root.u.def.value
&& hi->root.u.def.section == h->root.u.def.section)
{
(*bed->elf_backend_hide_symbol) (info, hi, TRUE);
hi->root.type = bfd_link_hash_indirect;
hi->root.u.i.link = (struct bfd_link_hash_entry *) h;
(*bed->elf_backend_copy_indirect_symbol) (info, h, hi);
sym_hash = elf_sym_hashes (abfd);
if (sym_hash)
for (symidx = 0; symidx < extsymcount; ++symidx)
if (sym_hash[symidx] == hi)
{
sym_hash[symidx] = h;
break;
}
}
free (shortname);
}
free (nondeflt_vers);
nondeflt_vers = NULL;
}
/* Now set the weakdefs field correctly for all the weak defined
symbols we found. The only way to do this is to search all the
symbols. Since we only need the information for non functions in
dynamic objects, that's the only time we actually put anything on
the list WEAKS. We need this information so that if a regular
object refers to a symbol defined weakly in a dynamic object, the
real symbol in the dynamic object is also put in the dynamic
symbols; we also must arrange for both symbols to point to the
same memory location. We could handle the general case of symbol
aliasing, but a general symbol alias can only be generated in
assembler code, handling it correctly would be very time
consuming, and other ELF linkers don't handle general aliasing
either. */
if (weaks != NULL)
{
struct elf_link_hash_entry **hpp;
struct elf_link_hash_entry **hppend;
struct elf_link_hash_entry **sorted_sym_hash;
struct elf_link_hash_entry *h;
size_t sym_count;
/* Since we have to search the whole symbol list for each weak
defined symbol, search time for N weak defined symbols will be
O(N^2). Binary search will cut it down to O(NlogN). */
amt = extsymcount * sizeof (struct elf_link_hash_entry *);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
sorted_sym_hash = (struct elf_link_hash_entry **) bfd_malloc (amt);
if (sorted_sym_hash == NULL)
goto error_return;
sym_hash = sorted_sym_hash;
hpp = elf_sym_hashes (abfd);
hppend = hpp + extsymcount;
sym_count = 0;
for (; hpp < hppend; hpp++)
{
h = *hpp;
if (h != NULL
&& h->root.type == bfd_link_hash_defined
&& !bed->is_function_type (h->type))
{
*sym_hash = h;
sym_hash++;
sym_count++;
}
}
qsort (sorted_sym_hash, sym_count,
sizeof (struct elf_link_hash_entry *),
elf_sort_symbol);
while (weaks != NULL)
{
struct elf_link_hash_entry *hlook;
asection *slook;
bfd_vma vlook;
size_t i, j, idx = 0;
hlook = weaks;
weaks = hlook->u.weakdef;
hlook->u.weakdef = NULL;
BFD_ASSERT (hlook->root.type == bfd_link_hash_defined
|| hlook->root.type == bfd_link_hash_defweak
|| hlook->root.type == bfd_link_hash_common
|| hlook->root.type == bfd_link_hash_indirect);
slook = hlook->root.u.def.section;
vlook = hlook->root.u.def.value;
i = 0;
j = sym_count;
while (i != j)
{
bfd_signed_vma vdiff;
idx = (i + j) / 2;
h = sorted_sym_hash[idx];
vdiff = vlook - h->root.u.def.value;
if (vdiff < 0)
j = idx;
else if (vdiff > 0)
i = idx + 1;
else
{
int sdiff = slook->id - h->root.u.def.section->id;
if (sdiff < 0)
j = idx;
else if (sdiff > 0)
i = idx + 1;
else
break;
}
}
/* We didn't find a value/section match. */
if (i == j)
continue;
/* With multiple aliases, or when the weak symbol is already
strongly defined, we have multiple matching symbols and
the binary search above may land on any of them. Step
one past the matching symbol(s). */
while (++idx != j)
{
h = sorted_sym_hash[idx];
if (h->root.u.def.section != slook
|| h->root.u.def.value != vlook)
break;
}
/* Now look back over the aliases. Since we sorted by size
as well as value and section, we'll choose the one with
the largest size. */
while (idx-- != i)
{
h = sorted_sym_hash[idx];
/* Stop if value or section doesn't match. */
if (h->root.u.def.section != slook
|| h->root.u.def.value != vlook)
break;
else if (h != hlook)
{
hlook->u.weakdef = h;
/* If the weak definition is in the list of dynamic
symbols, make sure the real definition is put
there as well. */
if (hlook->dynindx != -1 && h->dynindx == -1)
{
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! bfd_elf_link_record_dynamic_symbol (info, h))
{
err_free_sym_hash:
free (sorted_sym_hash);
goto error_return;
}
}
/* If the real definition is in the list of dynamic
symbols, make sure the weak definition is put
there as well. If we don't do this, then the
dynamic loader might not merge the entries for the
real definition and the weak definition. */
if (h->dynindx != -1 && hlook->dynindx == -1)
{
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! bfd_elf_link_record_dynamic_symbol (info, hlook))
goto err_free_sym_hash;
}
break;
}
}
}
free (sorted_sym_hash);
}
if (bed->check_directives
&& !(*bed->check_directives) (abfd, info))
return FALSE;
2004-07-06 18:58:43 +02:00
/* If this object is the same format as the output object, and it is
not a shared library, then let the backend look through the
relocs.
This is required to build global offset table entries and to
arrange for dynamic relocs. It is not required for the
particular common case of linking non PIC code, even when linking
against shared libraries, but unfortunately there is no way of
knowing whether an object file has been compiled PIC or not.
Looking through the relocs is not particularly time consuming.
The problem is that we must either (1) keep the relocs in memory,
which causes the linker to require additional runtime memory or
(2) read the relocs twice from the input file, which wastes time.
This would be a good case for using mmap.
I have no idea how to handle linking PIC code into a file of a
different format. It probably can't be done. */
if (! dynamic
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
&& is_elf_hash_table (htab)
&& bed->check_relocs != NULL
&& elf_object_id (abfd) == elf_hash_table_id (htab)
include/ * bfdlink.h (struct bfd_link_hash_table): Delete creator field. (struct bfd_link_info): Add output_bfd. bfd/ * elflink.c: Replace all accesses to hash->creator field with output_bfd->xvec. * cofflink.c: Likewise. * coff-h8300.c: Likewise. * ecoff.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-ppc.c: Likewise. * elf64-alpha.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sparc.c: Likewise. * elfxx-mips.c: Likewise. * i386linux.c: Likewise. * m68klinux.c: Likewise. * sparclinux.c: Likewise. * sunos.c: Likewise. * xcofflink.c: Likewise. * linker.c: Likewise. (_bfd_link_hash_table_init): Don't store creator. ld/ * ldmain.h (output_bfd): Delete. * ldmain.c (output_bfd): Delete. Replace all occurrences of output_bfd with link_info.output_bfd. * ldcref.c: Likewise. * ldctor.c: Likewise. * ldemul.c: Likewise. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldlang.c: Likewise. * ldmisc.c: Likewise. * ldwrite.c: Likewise. * pe-dll.c: Likewise. * emultempl/aix.em: Likewise. * emultempl/alphaelf.em: Likewise. * emultempl/armcoff.em: Likewise. * emultempl/armelf.em: Likewise. * emultempl/avrelf.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/elf-generic.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/irix.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68hc1xelf.em: Likewise. * emultempl/mmix-elfnmmo.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/scoreelf.em: Likewise. * emultempl/sh64elf.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/vxworks.em: Likewise. * emultempl/xtensaelf.em: Likewise. * emultempl/z80.em: Likewise. * ldlang.c (open_output): Don't return output, instead write link_info_output_bfd directly. * emultempl/alphaelf.em: Replace occurrences of link_info.hash->creator with link_info.output_bfd->xvec. * emultempl/hppaelf.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/spuelf.em: Likewise.
2008-02-15 04:35:53 +01:00
&& (*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
{
asection *o;
for (o = abfd->sections; o != NULL; o = o->next)
{
Elf_Internal_Rela *internal_relocs;
bfd_boolean ok;
if ((o->flags & SEC_RELOC) == 0
|| o->reloc_count == 0
|| ((info->strip == strip_all || info->strip == strip_debugger)
&& (o->flags & SEC_DEBUGGING) != 0)
|| bfd_is_abs_section (o->output_section))
continue;
internal_relocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL,
info->keep_memory);
if (internal_relocs == NULL)
goto error_return;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
ok = (*bed->check_relocs) (abfd, info, o, internal_relocs);
if (elf_section_data (o)->relocs != internal_relocs)
free (internal_relocs);
if (! ok)
goto error_return;
}
}
/* If this is a non-traditional link, try to optimize the handling
of the .stab/.stabstr sections. */
if (! dynamic
&& ! info->traditional_format
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
&& is_elf_hash_table (htab)
&& (info->strip != strip_all && info->strip != strip_debugger))
{
asection *stabstr;
stabstr = bfd_get_section_by_name (abfd, ".stabstr");
if (stabstr != NULL)
{
bfd_size_type string_offset = 0;
asection *stab;
for (stab = abfd->sections; stab; stab = stab->next)
if (CONST_STRNEQ (stab->name, ".stab")
&& (!stab->name[5] ||
(stab->name[5] == '.' && ISDIGIT (stab->name[6])))
&& (stab->flags & SEC_MERGE) == 0
&& !bfd_is_abs_section (stab->output_section))
{
struct bfd_elf_section_data *secdata;
secdata = elf_section_data (stab);
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (! _bfd_link_section_stabs (abfd, &htab->stab_info, stab,
stabstr, &secdata->sec_info,
&string_offset))
goto error_return;
if (secdata->sec_info)
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
stab->sec_info_type = SEC_INFO_TYPE_STABS;
}
}
}
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (is_elf_hash_table (htab) && add_needed)
{
/* Add this bfd to the loaded list. */
struct elf_link_loaded_list *n;
n = (struct elf_link_loaded_list *) bfd_alloc (abfd, sizeof (*n));
if (n == NULL)
goto error_return;
n->abfd = abfd;
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
n->next = htab->loaded;
htab->loaded = n;
}
return TRUE;
error_free_vers:
PR 2434 bfd/ * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. (elf_link_add_object_symbols): Delete unnecessary locals. Rename hash_table -> htab. Formatting. Save entire symbol table before loading as-needed syms, and restore afterwards if lib not needed. Use bfd_hash_allocate rather than bfd_alloc for sym name. Free some buffers earlier. * bfd-in.h (struct bfd_hash_table): Add entsize. (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise * hash.c (bfd_hash_table_init_n): Add entsize param, save to hash table. (bfd_hash_table_init): Add param, adjust calls. * aoutx.h: Adjust all hash_table_init functions and calls. * bfd.c: Likewise. * coff-arm.c: Likewise. * coff-h8300.c: Likewise. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * ecofflink.c: Likewise. * elf-m10300.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-bfin.c: Likewise. * elf32-cris.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * i386linux.c: Likewise. * libaout.h: Likewise. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * linker.c: Likewise. * m68klinux.c: Likewise. * merge.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * sparclinux.c: Likewise. * stabs.c: Likewise. * sunos.c: Likewise. * vms.c: Likewise. * xcofflink.c: Likewise. * section.c (struct section_hash_entry): Move to.. * libbfd-in.h: ..here. * Makefile.am: Run "make dep-am" * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. binutils/ * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. ld/ * ldcref.c (add_cref): Adjust bfd_hash_table_init calls. * ldlang.c (output_statement_table_init, lang_init): Likewise. * ldmain.c (add_ysym, add_wrap, add_keepsyms_file): Likewise. (undefined_symbol): Likewise.
2006-03-16 13:20:16 +01:00
if (old_tab != NULL)
free (old_tab);
if (nondeflt_vers != NULL)
free (nondeflt_vers);
if (extversym != NULL)
free (extversym);
error_free_sym:
if (isymbuf != NULL)
free (isymbuf);
error_return:
return FALSE;
}
/* Return the linker hash table entry of a symbol that might be
satisfied by an archive symbol. Return -1 on error. */
struct elf_link_hash_entry *
_bfd_elf_archive_symbol_lookup (bfd *abfd,
struct bfd_link_info *info,
const char *name)
{
struct elf_link_hash_entry *h;
char *p, *copy;
size_t len, first;
h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, TRUE);
if (h != NULL)
return h;
/* If this is a default version (the name contains @@), look up the
symbol again with only one `@' as well as without the version.
The effect is that references to the symbol with and without the
version will be matched by the default symbol in the archive. */
p = strchr (name, ELF_VER_CHR);
if (p == NULL || p[1] != ELF_VER_CHR)
return h;
/* First check with only one `@'. */
len = strlen (name);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
copy = (char *) bfd_alloc (abfd, len);
if (copy == NULL)
return (struct elf_link_hash_entry *) 0 - 1;
first = p - name + 1;
memcpy (copy, name, first);
memcpy (copy + first, name + first + 1, len - first);
h = elf_link_hash_lookup (elf_hash_table (info), copy, FALSE, FALSE, TRUE);
if (h == NULL)
{
/* We also need to check references to the symbol without the
version. */
copy[first - 1] = '\0';
h = elf_link_hash_lookup (elf_hash_table (info), copy,
FALSE, FALSE, TRUE);
}
bfd_release (abfd, copy);
return h;
}
/* Add symbols from an ELF archive file to the linker hash table. We
Fix LTO vs. COFF archives Avoid scan of symbols on objects in coff archives since we don't need to do anything special with common symbols. The scan is quite useless, and breaks LTO due to slim LTO objects not having symbols available until after the plugin has claimed them. Instead we can add objects based on their archive symbol map. Also, rip out the archive symbol hash table used by the generic linker. Using a hash breaks one feature of unix archive linking; The first object file in an archive defining any given symbol should be the object extracted to satisfy that symbol. What's more a hash isn't much faster except in pathological cases where object file ordering causes many scans of the archive. See the comment which I'm removing from elf_link_add_archive_symbols. Finally, tidy elflink.c archive handling a little. PR 13557 * linker.c (struct archive_list, struct archive_hash_entry, struct archive_hash_table, archive_hash_newfunc, archive_hash_table_init, archive_hash_lookup, archive_hash_allocate, archive_hash_table_free): Delete. (_bfd_generic_link_add_archive_symbols): Add h and name params to checkfn. Rewrite using a straight-forward scan over archive map. (generic_link_check_archive_element_no_collect, generic_link_check_archive_element_collect, generic_link_check_archive_element): Add h and name params. * aoutx.h (aout_link_check_archive_element): Likewise. * pdp11.c (aout_link_check_archive_element): Likewise. * xcofflink.c (xcoff_link_check_archive_element): Likewise. * cofflink.c (coff_link_check_archive_element): Likewise. Don't scan symbols, simply add archive element whenever h is undefined. (coff_link_check_ar_symbols): Delete. * ecoff.c (read_ext_syms_and_strs): Delete. (reread_ext_syms_and_strs): Delete. (ecoff_link_check_archive_element): Add h and name param. Don't scan symbols, simply add based on h. Use ecoff_link_add_object_symbols. * elflink.c (elf_link_is_defined_archive_symbol): Don't test archive_pass. (elf_link_add_archive_symbols): Delete "defined" array, merge functionality into "included". Make "included" a char array. Don't set or test archive_pass. * libbfd-in.h (_bfd_generic_link_add_archive_symbols): Update. * libbfd.h: Regenerate.
2014-08-05 03:16:57 +02:00
don't use _bfd_generic_link_add_archive_symbols because we need to
handle versioned symbols.
Fortunately, ELF archive handling is simpler than that done by
_bfd_generic_link_add_archive_symbols, which has to allow for a.out
oddities. In ELF, if we find a symbol in the archive map, and the
symbol is currently undefined, we know that we must pull in that
object file.
Unfortunately, we do have to make multiple passes over the symbol
table until nothing further is resolved. */
static bfd_boolean
elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
{
symindex c;
Fix LTO vs. COFF archives Avoid scan of symbols on objects in coff archives since we don't need to do anything special with common symbols. The scan is quite useless, and breaks LTO due to slim LTO objects not having symbols available until after the plugin has claimed them. Instead we can add objects based on their archive symbol map. Also, rip out the archive symbol hash table used by the generic linker. Using a hash breaks one feature of unix archive linking; The first object file in an archive defining any given symbol should be the object extracted to satisfy that symbol. What's more a hash isn't much faster except in pathological cases where object file ordering causes many scans of the archive. See the comment which I'm removing from elf_link_add_archive_symbols. Finally, tidy elflink.c archive handling a little. PR 13557 * linker.c (struct archive_list, struct archive_hash_entry, struct archive_hash_table, archive_hash_newfunc, archive_hash_table_init, archive_hash_lookup, archive_hash_allocate, archive_hash_table_free): Delete. (_bfd_generic_link_add_archive_symbols): Add h and name params to checkfn. Rewrite using a straight-forward scan over archive map. (generic_link_check_archive_element_no_collect, generic_link_check_archive_element_collect, generic_link_check_archive_element): Add h and name params. * aoutx.h (aout_link_check_archive_element): Likewise. * pdp11.c (aout_link_check_archive_element): Likewise. * xcofflink.c (xcoff_link_check_archive_element): Likewise. * cofflink.c (coff_link_check_archive_element): Likewise. Don't scan symbols, simply add archive element whenever h is undefined. (coff_link_check_ar_symbols): Delete. * ecoff.c (read_ext_syms_and_strs): Delete. (reread_ext_syms_and_strs): Delete. (ecoff_link_check_archive_element): Add h and name param. Don't scan symbols, simply add based on h. Use ecoff_link_add_object_symbols. * elflink.c (elf_link_is_defined_archive_symbol): Don't test archive_pass. (elf_link_add_archive_symbols): Delete "defined" array, merge functionality into "included". Make "included" a char array. Don't set or test archive_pass. * libbfd-in.h (_bfd_generic_link_add_archive_symbols): Update. * libbfd.h: Regenerate.
2014-08-05 03:16:57 +02:00
unsigned char *included = NULL;
carsym *symdefs;
bfd_boolean loop;
bfd_size_type amt;
const struct elf_backend_data *bed;
struct elf_link_hash_entry * (*archive_symbol_lookup)
(bfd *, struct bfd_link_info *, const char *);
if (! bfd_has_map (abfd))
{
/* An empty archive is a special case. */
if (bfd_openr_next_archived_file (abfd, NULL) == NULL)
return TRUE;
bfd_set_error (bfd_error_no_armap);
return FALSE;
}
/* Keep track of all symbols we know to be already defined, and all
files we know to be already included. This is to speed up the
second and subsequent passes. */
c = bfd_ardata (abfd)->symdef_count;
if (c == 0)
return TRUE;
amt = c;
Fix LTO vs. COFF archives Avoid scan of symbols on objects in coff archives since we don't need to do anything special with common symbols. The scan is quite useless, and breaks LTO due to slim LTO objects not having symbols available until after the plugin has claimed them. Instead we can add objects based on their archive symbol map. Also, rip out the archive symbol hash table used by the generic linker. Using a hash breaks one feature of unix archive linking; The first object file in an archive defining any given symbol should be the object extracted to satisfy that symbol. What's more a hash isn't much faster except in pathological cases where object file ordering causes many scans of the archive. See the comment which I'm removing from elf_link_add_archive_symbols. Finally, tidy elflink.c archive handling a little. PR 13557 * linker.c (struct archive_list, struct archive_hash_entry, struct archive_hash_table, archive_hash_newfunc, archive_hash_table_init, archive_hash_lookup, archive_hash_allocate, archive_hash_table_free): Delete. (_bfd_generic_link_add_archive_symbols): Add h and name params to checkfn. Rewrite using a straight-forward scan over archive map. (generic_link_check_archive_element_no_collect, generic_link_check_archive_element_collect, generic_link_check_archive_element): Add h and name params. * aoutx.h (aout_link_check_archive_element): Likewise. * pdp11.c (aout_link_check_archive_element): Likewise. * xcofflink.c (xcoff_link_check_archive_element): Likewise. * cofflink.c (coff_link_check_archive_element): Likewise. Don't scan symbols, simply add archive element whenever h is undefined. (coff_link_check_ar_symbols): Delete. * ecoff.c (read_ext_syms_and_strs): Delete. (reread_ext_syms_and_strs): Delete. (ecoff_link_check_archive_element): Add h and name param. Don't scan symbols, simply add based on h. Use ecoff_link_add_object_symbols. * elflink.c (elf_link_is_defined_archive_symbol): Don't test archive_pass. (elf_link_add_archive_symbols): Delete "defined" array, merge functionality into "included". Make "included" a char array. Don't set or test archive_pass. * libbfd-in.h (_bfd_generic_link_add_archive_symbols): Update. * libbfd.h: Regenerate.
2014-08-05 03:16:57 +02:00
amt *= sizeof (*included);
included = (unsigned char *) bfd_zmalloc (amt);
if (included == NULL)
return FALSE;
symdefs = bfd_ardata (abfd)->symdefs;
bed = get_elf_backend_data (abfd);
archive_symbol_lookup = bed->elf_backend_archive_symbol_lookup;
do
{
file_ptr last;
symindex i;
carsym *symdef;
carsym *symdefend;
loop = FALSE;
last = -1;
symdef = symdefs;
symdefend = symdef + c;
for (i = 0; symdef < symdefend; symdef++, i++)
{
struct elf_link_hash_entry *h;
bfd *element;
struct bfd_link_hash_entry *undefs_tail;
symindex mark;
Fix LTO vs. COFF archives Avoid scan of symbols on objects in coff archives since we don't need to do anything special with common symbols. The scan is quite useless, and breaks LTO due to slim LTO objects not having symbols available until after the plugin has claimed them. Instead we can add objects based on their archive symbol map. Also, rip out the archive symbol hash table used by the generic linker. Using a hash breaks one feature of unix archive linking; The first object file in an archive defining any given symbol should be the object extracted to satisfy that symbol. What's more a hash isn't much faster except in pathological cases where object file ordering causes many scans of the archive. See the comment which I'm removing from elf_link_add_archive_symbols. Finally, tidy elflink.c archive handling a little. PR 13557 * linker.c (struct archive_list, struct archive_hash_entry, struct archive_hash_table, archive_hash_newfunc, archive_hash_table_init, archive_hash_lookup, archive_hash_allocate, archive_hash_table_free): Delete. (_bfd_generic_link_add_archive_symbols): Add h and name params to checkfn. Rewrite using a straight-forward scan over archive map. (generic_link_check_archive_element_no_collect, generic_link_check_archive_element_collect, generic_link_check_archive_element): Add h and name params. * aoutx.h (aout_link_check_archive_element): Likewise. * pdp11.c (aout_link_check_archive_element): Likewise. * xcofflink.c (xcoff_link_check_archive_element): Likewise. * cofflink.c (coff_link_check_archive_element): Likewise. Don't scan symbols, simply add archive element whenever h is undefined. (coff_link_check_ar_symbols): Delete. * ecoff.c (read_ext_syms_and_strs): Delete. (reread_ext_syms_and_strs): Delete. (ecoff_link_check_archive_element): Add h and name param. Don't scan symbols, simply add based on h. Use ecoff_link_add_object_symbols. * elflink.c (elf_link_is_defined_archive_symbol): Don't test archive_pass. (elf_link_add_archive_symbols): Delete "defined" array, merge functionality into "included". Make "included" a char array. Don't set or test archive_pass. * libbfd-in.h (_bfd_generic_link_add_archive_symbols): Update. * libbfd.h: Regenerate.
2014-08-05 03:16:57 +02:00
if (included[i])
continue;
if (symdef->file_offset == last)
{
included[i] = TRUE;
continue;
}
h = archive_symbol_lookup (abfd, info, symdef->name);
if (h == (struct elf_link_hash_entry *) 0 - 1)
goto error_return;
if (h == NULL)
continue;
if (h->root.type == bfd_link_hash_common)
{
/* We currently have a common symbol. The archive map contains
a reference to this symbol, so we may want to include it. We
only want to include it however, if this archive element
contains a definition of the symbol, not just another common
declaration of it.
Unfortunately some archivers (including GNU ar) will put
declarations of common symbols into their archive maps, as
well as real definitions, so we cannot just go by the archive
map alone. Instead we must read in the element's symbol
table and check that to see what kind of symbol definition
this is. */
if (! elf_link_is_defined_archive_symbol (abfd, symdef))
continue;
}
else if (h->root.type != bfd_link_hash_undefined)
{
if (h->root.type != bfd_link_hash_undefweak)
Fix LTO vs. COFF archives Avoid scan of symbols on objects in coff archives since we don't need to do anything special with common symbols. The scan is quite useless, and breaks LTO due to slim LTO objects not having symbols available until after the plugin has claimed them. Instead we can add objects based on their archive symbol map. Also, rip out the archive symbol hash table used by the generic linker. Using a hash breaks one feature of unix archive linking; The first object file in an archive defining any given symbol should be the object extracted to satisfy that symbol. What's more a hash isn't much faster except in pathological cases where object file ordering causes many scans of the archive. See the comment which I'm removing from elf_link_add_archive_symbols. Finally, tidy elflink.c archive handling a little. PR 13557 * linker.c (struct archive_list, struct archive_hash_entry, struct archive_hash_table, archive_hash_newfunc, archive_hash_table_init, archive_hash_lookup, archive_hash_allocate, archive_hash_table_free): Delete. (_bfd_generic_link_add_archive_symbols): Add h and name params to checkfn. Rewrite using a straight-forward scan over archive map. (generic_link_check_archive_element_no_collect, generic_link_check_archive_element_collect, generic_link_check_archive_element): Add h and name params. * aoutx.h (aout_link_check_archive_element): Likewise. * pdp11.c (aout_link_check_archive_element): Likewise. * xcofflink.c (xcoff_link_check_archive_element): Likewise. * cofflink.c (coff_link_check_archive_element): Likewise. Don't scan symbols, simply add archive element whenever h is undefined. (coff_link_check_ar_symbols): Delete. * ecoff.c (read_ext_syms_and_strs): Delete. (reread_ext_syms_and_strs): Delete. (ecoff_link_check_archive_element): Add h and name param. Don't scan symbols, simply add based on h. Use ecoff_link_add_object_symbols. * elflink.c (elf_link_is_defined_archive_symbol): Don't test archive_pass. (elf_link_add_archive_symbols): Delete "defined" array, merge functionality into "included". Make "included" a char array. Don't set or test archive_pass. * libbfd-in.h (_bfd_generic_link_add_archive_symbols): Update. * libbfd.h: Regenerate.
2014-08-05 03:16:57 +02:00
/* Symbol must be defined. Don't check it again. */
included[i] = TRUE;
continue;
}
/* We need to include this archive member. */
element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
if (element == NULL)
goto error_return;
if (! bfd_check_format (element, bfd_object))
goto error_return;
undefs_tail = info->hash->undefs_tail;
if (!(*info->callbacks
->add_archive_element) (info, element, symdef->name, &element))
goto error_return;
if (!bfd_link_add_symbols (element, info))
goto error_return;
/* If there are any new undefined symbols, we need to make
another pass through the archive in order to see whether
they can be defined. FIXME: This isn't perfect, because
common symbols wind up on undefs_tail and because an
undefined symbol which is defined later on in this pass
does not require another pass. This isn't a bug, but it
does make the code less efficient than it could be. */
if (undefs_tail != info->hash->undefs_tail)
loop = TRUE;
/* Look backward to mark all symbols from this object file
which we have already seen in this pass. */
mark = i;
do
{
included[mark] = TRUE;
if (mark == 0)
break;
--mark;
}
while (symdefs[mark].file_offset == symdef->file_offset);
/* We mark subsequent symbols from this object file as we go
on through the loop. */
last = symdef->file_offset;
}
}
while (loop);
free (included);
return TRUE;
error_return:
if (included != NULL)
free (included);
return FALSE;
}
/* Given an ELF BFD, add symbols to the global hash table as
appropriate. */
bfd_boolean
bfd_elf_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
{
switch (bfd_get_format (abfd))
{
case bfd_object:
return elf_link_add_object_symbols (abfd, info);
case bfd_archive:
return elf_link_add_archive_symbols (abfd, info);
default:
bfd_set_error (bfd_error_wrong_format);
return FALSE;
}
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
struct hash_codes_info
{
unsigned long *hashcodes;
bfd_boolean error;
};
2007-09-30 15:43:23 +02:00
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* This function will be called though elf_link_hash_traverse to store
all hash value of the exported symbols in an array. */
static bfd_boolean
elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct hash_codes_info *inf = (struct hash_codes_info *) data;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
const char *name;
unsigned long ha;
char *alc = NULL;
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->dynindx == -1)
return TRUE;
name = h->root.root.string;
if (h->versioned >= versioned)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
char *p = strchr (name, ELF_VER_CHR);
if (p != NULL)
{
alc = (char *) bfd_malloc (p - name + 1);
if (alc == NULL)
{
inf->error = TRUE;
return FALSE;
}
memcpy (alc, name, p - name);
alc[p - name] = '\0';
name = alc;
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
/* Compute the hash value. */
ha = bfd_elf_hash (name);
/* Store the found hash value in the array given as the argument. */
*(inf->hashcodes)++ = ha;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* And store it in the struct so that we can put it in the hash table
later. */
h->u.elf_hash_value = ha;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (alc != NULL)
free (alc);
return TRUE;
}
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
struct collect_gnu_hash_codes
{
bfd *output_bfd;
const struct elf_backend_data *bed;
unsigned long int nsyms;
unsigned long int maskbits;
unsigned long int *hashcodes;
unsigned long int *hashval;
unsigned long int *indx;
unsigned long int *counts;
bfd_vma *bitmask;
bfd_byte *contents;
long int min_dynindx;
unsigned long int bucketcount;
unsigned long int symindx;
long int local_indx;
long int shift1, shift2;
unsigned long int mask;
bfd_boolean error;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
};
/* This function will be called though elf_link_hash_traverse to store
all hash value of the exported symbols in an array. */
static bfd_boolean
elf_collect_gnu_hash_codes (struct elf_link_hash_entry *h, void *data)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
const char *name;
unsigned long ha;
char *alc = NULL;
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->dynindx == -1)
return TRUE;
/* Ignore also local symbols and undefined symbols. */
if (! (*s->bed->elf_hash_symbol) (h))
return TRUE;
name = h->root.root.string;
if (h->versioned >= versioned)
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
{
char *p = strchr (name, ELF_VER_CHR);
if (p != NULL)
{
alc = (char *) bfd_malloc (p - name + 1);
if (alc == NULL)
{
s->error = TRUE;
return FALSE;
}
memcpy (alc, name, p - name);
alc[p - name] = '\0';
name = alc;
}
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
}
/* Compute the hash value. */
ha = bfd_elf_gnu_hash (name);
/* Store the found hash value in the array for compute_bucket_count,
and also for .dynsym reordering purposes. */
s->hashcodes[s->nsyms] = ha;
s->hashval[h->dynindx] = ha;
++s->nsyms;
if (s->min_dynindx < 0 || s->min_dynindx > h->dynindx)
s->min_dynindx = h->dynindx;
if (alc != NULL)
free (alc);
return TRUE;
}
/* This function will be called though elf_link_hash_traverse to do
final dynaminc symbol renumbering. */
static bfd_boolean
elf_renumber_gnu_hash_syms (struct elf_link_hash_entry *h, void *data)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
unsigned long int bucket;
unsigned long int val;
/* Ignore indirect symbols. */
if (h->dynindx == -1)
return TRUE;
/* Ignore also local symbols and undefined symbols. */
if (! (*s->bed->elf_hash_symbol) (h))
{
if (h->dynindx >= s->min_dynindx)
h->dynindx = s->local_indx++;
return TRUE;
}
bucket = s->hashval[h->dynindx] % s->bucketcount;
val = (s->hashval[h->dynindx] >> s->shift1)
& ((s->maskbits >> s->shift1) - 1);
s->bitmask[val] |= ((bfd_vma) 1) << (s->hashval[h->dynindx] & s->mask);
s->bitmask[val]
|= ((bfd_vma) 1) << ((s->hashval[h->dynindx] >> s->shift2) & s->mask);
val = s->hashval[h->dynindx] & ~(unsigned long int) 1;
if (s->counts[bucket] == 1)
/* Last element terminates the chain. */
val |= 1;
bfd_put_32 (s->output_bfd, val,
s->contents + (s->indx[bucket] - s->symindx) * 4);
--s->counts[bucket];
h->dynindx = s->indx[bucket]++;
return TRUE;
}
/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
bfd_boolean
_bfd_elf_hash_symbol (struct elf_link_hash_entry *h)
{
return !(h->forced_local
|| h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak
|| ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->root.u.def.section->output_section == NULL));
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Array used to determine the number of hash table buckets to use
based on the number of symbols there are. If there are fewer than
3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets,
fewer than 37 we use 17 buckets, and so forth. We never use more
than 32771 buckets. */
static const size_t elf_buckets[] =
{
1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209,
16411, 32771, 0
};
/* Compute bucket count for hashing table. We do not use a static set
of possible tables sizes anymore. Instead we determine for all
possible reasonable sizes of the table the outcome (i.e., the
number of collisions etc) and choose the best solution. The
weighting functions are not too simple to allow the table to grow
without bounds. Instead one of the weighting factors is the size.
Therefore the result is always a good payoff between few collisions
(= short chain lengths) and table size. */
static size_t
compute_bucket_count (struct bfd_link_info *info ATTRIBUTE_UNUSED,
unsigned long int *hashcodes ATTRIBUTE_UNUSED,
unsigned long int nsyms,
int gnu_hash)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
size_t best_size = 0;
unsigned long int i;
/* We have a problem here. The following code to optimize the table
size requires an integer type with more the 32 bits. If
BFD_HOST_U_64_BIT is set we know about such a type. */
#ifdef BFD_HOST_U_64_BIT
if (info->optimize)
{
size_t minsize;
size_t maxsize;
BFD_HOST_U_64_BIT best_chlen = ~((BFD_HOST_U_64_BIT) 0);
bfd *dynobj = elf_hash_table (info)->dynobj;
size_t dynsymcount = elf_hash_table (info)->dynsymcount;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
unsigned long int *counts;
bfd_size_type amt;
unsigned int no_improvement_count = 0;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Possible optimization parameters: if we have NSYMS symbols we say
that the hashing table must at least have NSYMS/4 and at most
2*NSYMS buckets. */
minsize = nsyms / 4;
if (minsize == 0)
minsize = 1;
best_size = maxsize = nsyms * 2;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (gnu_hash)
{
if (minsize < 2)
minsize = 2;
if ((best_size & 31) == 0)
++best_size;
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Create array where we count the collisions in. We must use bfd_malloc
since the size could be large. */
amt = maxsize;
amt *= sizeof (unsigned long int);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
counts = (unsigned long int *) bfd_malloc (amt);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (counts == NULL)
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
return 0;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Compute the "optimal" size for the hash table. The criteria is a
minimal chain length. The minor criteria is (of course) the size
of the table. */
for (i = minsize; i < maxsize; ++i)
{
/* Walk through the array of hashcodes and count the collisions. */
BFD_HOST_U_64_BIT max;
unsigned long int j;
unsigned long int fact;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (gnu_hash && (i & 31) == 0)
continue;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
memset (counts, '\0', i * sizeof (unsigned long int));
/* Determine how often each hash bucket is used. */
for (j = 0; j < nsyms; ++j)
++counts[hashcodes[j] % i];
/* For the weight function we need some information about the
pagesize on the target. This is information need not be 100%
accurate. Since this information is not available (so far) we
define it here to a reasonable default value. If it is crucial
to have a better value some day simply define this value. */
# ifndef BFD_TARGET_PAGESIZE
# define BFD_TARGET_PAGESIZE (4096)
# endif
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
/* We in any case need 2 + DYNSYMCOUNT entries for the size values
and the chains. */
max = (2 + dynsymcount) * bed->s->sizeof_hash_entry;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
# if 1
/* Variant 1: optimize for short chains. We add the squares
of all the chain lengths (which favors many small chain
over a few long chains). */
for (j = 0; j < i; ++j)
max += counts[j] * counts[j];
/* This adds penalties for the overall size of the table. */
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
max *= fact * fact;
# else
/* Variant 2: Optimize a lot more for small table. Here we
also add squares of the size but we also add penalties for
empty slots (the +1 term). */
for (j = 0; j < i; ++j)
max += (1 + counts[j]) * (1 + counts[j]);
/* The overall size of the table is considered, but not as
strong as in variant 1, where it is squared. */
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
fact = i / (BFD_TARGET_PAGESIZE / bed->s->sizeof_hash_entry) + 1;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
max *= fact;
# endif
/* Compare with current best results. */
if (max < best_chlen)
{
best_chlen = max;
best_size = i;
no_improvement_count = 0;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
/* PR 11843: Avoid futile long searches for the best bucket size
when there are a large number of symbols. */
else if (++no_improvement_count == 100)
break;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
free (counts);
}
else
#endif /* defined (BFD_HOST_U_64_BIT) */
{
/* This is the fallback solution if no 64bit type is available or if we
are not supposed to spend much time on optimizations. We select the
bucket count using a fixed set of numbers. */
for (i = 0; elf_buckets[i] != 0; i++)
{
best_size = elf_buckets[i];
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (nsyms < elf_buckets[i + 1])
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
break;
}
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (gnu_hash && best_size < 2)
best_size = 2;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
return best_size;
}
/* Size any SHT_GROUP section for ld -r. */
bfd_boolean
_bfd_elf_size_group_sections (struct bfd_link_info *info)
{
bfd *ibfd;
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour
&& !_bfd_elf_fixup_group_sections (ibfd, bfd_abs_section_ptr))
return FALSE;
return TRUE;
}
bfd/ * bfd-in.h (bfd_elf_stack_segment_size): Declare. * bfd-in2.h: Rebuilt. * elfxx-target.h (elf_backend_stack_align): New. (elfNN_bed): Add it. * elf-bfd.h (struct elf_backend_data): Add stack_align field. * elf.c (bfd_elf_map_sections_to_segments): Pay attention to stack_align and stacksize for PT_GNU_STACK segment. (assign_file_positions_for_non_load_sections): Set p_memsz for PT_GNU_STACK segment. (copy_elf_program_header): Copy PT_GNU_STACK size. * elflink.c (bfd_elf_stack_segment_size): New function, taken from uclinux backends. (bfd_elf_size_dynamic_sections): Determine PT_GNU_STACK requirements after calling backend. Pay attention to stacksize. * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_bfinfdpic_modify_program_headers): Delete. (elf32_bfingfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-frv.c (frvfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_frvfdpic_modify_program_headers): Delete. (elf32_frvfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-lm32.c (lm32_elf_always_size_sections): Leave PT_GNU_STACK creation to underlying elf support. Check __stacksize here for backwards compatibility, and set it if needed. (lm32_elf_modify_segment_map): Delete. (lm32_elf_modify_program_headers): Delete. (elf_backend_stack_align): Override. (elf_backend_modify_segment_map): Don't override. (elf_backend_modify_program_headers): Don't override. * elf32-sh.c (sh_elf_always_size_sections): Call bfd_elf_stack_segment_size. (sh_elf_modify_program_headers): Delete. (sh_elf_copy_private_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-tic6x.c (elf32_tic6x_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_tic6x_modify_program_headers): Delete. (elf32_tic6x_copy_private_data): Delete. (elf_backend_stack_align): Override. (bfd_elf32_bfd_copy_private_bfd_data): Don't override. (elf_backend_modify_program_headers): Don't override. include/ * bfdlink.h (struct bfd_link_info): Add stacksize option. ld/ * ld.texinfo (stack-size): New option. * emultempl/elf32.em: Add stack-size option. ld/testsuite/ * ld-elf/binutils.exp: Add -z stack-size=0. * ld-elf/elf.exp: Add stack-exec and stack-size tests. * ld-elf/orphan-region.d: Add stack-size option. Remove xfail. * ld-elf/stack-exec.rd: New. * ld-elf/stack-size.rd: New. * ld-elf/stack.s: New. * ld-scripts/empty-aligned.d: Add stack-size option. * ld-sh/fdpic-stack-set.d: New. * ld-tic6x/shlib-1.rd: Remove __stacksize symbol. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1.rd: Likewise. * ld-tic6x/shlib-app-1b.rd: Likewise. * ld-tic6x/shlib-app-1r.rd: Likewise. * ld-tic6x/shlib-app-1rb.rd: Likewise. * ld-tic6x/shlib-noindex.rd: Likewise. * ld-tic6x/static-app-1.rd: Likewise. * ld-tic6x/static-app-1b.rd: Likewise. * ld-tic6x/static-app-1r.rd: Likewise. * ld-tic6x/static-app-1rb.rd: Likewise.
2012-10-23 11:33:56 +02:00
/* Set a default stack segment size. The value in INFO wins. If it
is unset, LEGACY_SYMBOL's value is used, and if that symbol is
undefined it is initialized. */
bfd_boolean
bfd_elf_stack_segment_size (bfd *output_bfd,
struct bfd_link_info *info,
const char *legacy_symbol,
bfd_vma default_size)
{
struct elf_link_hash_entry *h = NULL;
/* Look for legacy symbol. */
if (legacy_symbol)
h = elf_link_hash_lookup (elf_hash_table (info), legacy_symbol,
FALSE, FALSE, FALSE);
if (h && (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->def_regular
&& (h->type == STT_NOTYPE || h->type == STT_OBJECT))
{
/* The symbol has no type if specified on the command line. */
h->type = STT_OBJECT;
if (info->stacksize)
(*_bfd_error_handler) (_("%B: stack size specified and %s set"),
output_bfd, legacy_symbol);
else if (h->root.u.def.section != bfd_abs_section_ptr)
(*_bfd_error_handler) (_("%B: %s not absolute"),
output_bfd, legacy_symbol);
else
info->stacksize = h->root.u.def.value;
}
if (!info->stacksize)
/* If the user didn't set a size, or explicitly inhibit the
size, set it now. */
info->stacksize = default_size;
/* Provide the legacy symbol, if it is referenced. */
if (h && (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak))
{
struct bfd_link_hash_entry *bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, output_bfd, legacy_symbol,
BSF_GLOBAL, bfd_abs_section_ptr,
info->stacksize >= 0 ? info->stacksize : 0,
NULL, FALSE, get_elf_backend_data (output_bfd)->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
h->type = STT_OBJECT;
}
return TRUE;
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Set up the sizes and contents of the ELF dynamic sections. This is
called by the ELF linker emulation before_allocation routine. We
must set the sizes of the sections before the linker sets the
addresses of the various sections. */
bfd_boolean
bfd_elf_size_dynamic_sections (bfd *output_bfd,
const char *soname,
const char *rpath,
const char *filter_shlib,
const char *audit,
const char *depaudit,
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
const char * const *auxiliary_filters,
struct bfd_link_info *info,
asection **sinterpptr)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
bfd_size_type soname_indx;
bfd *dynobj;
const struct elf_backend_data *bed;
struct elf_info_failed asvinfo;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
*sinterpptr = NULL;
soname_indx = (bfd_size_type) -1;
if (!is_elf_hash_table (info->hash))
return TRUE;
bed = get_elf_backend_data (output_bfd);
bfd/ * bfd-in.h (bfd_elf_stack_segment_size): Declare. * bfd-in2.h: Rebuilt. * elfxx-target.h (elf_backend_stack_align): New. (elfNN_bed): Add it. * elf-bfd.h (struct elf_backend_data): Add stack_align field. * elf.c (bfd_elf_map_sections_to_segments): Pay attention to stack_align and stacksize for PT_GNU_STACK segment. (assign_file_positions_for_non_load_sections): Set p_memsz for PT_GNU_STACK segment. (copy_elf_program_header): Copy PT_GNU_STACK size. * elflink.c (bfd_elf_stack_segment_size): New function, taken from uclinux backends. (bfd_elf_size_dynamic_sections): Determine PT_GNU_STACK requirements after calling backend. Pay attention to stacksize. * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_bfinfdpic_modify_program_headers): Delete. (elf32_bfingfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-frv.c (frvfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_frvfdpic_modify_program_headers): Delete. (elf32_frvfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-lm32.c (lm32_elf_always_size_sections): Leave PT_GNU_STACK creation to underlying elf support. Check __stacksize here for backwards compatibility, and set it if needed. (lm32_elf_modify_segment_map): Delete. (lm32_elf_modify_program_headers): Delete. (elf_backend_stack_align): Override. (elf_backend_modify_segment_map): Don't override. (elf_backend_modify_program_headers): Don't override. * elf32-sh.c (sh_elf_always_size_sections): Call bfd_elf_stack_segment_size. (sh_elf_modify_program_headers): Delete. (sh_elf_copy_private_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-tic6x.c (elf32_tic6x_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_tic6x_modify_program_headers): Delete. (elf32_tic6x_copy_private_data): Delete. (elf_backend_stack_align): Override. (bfd_elf32_bfd_copy_private_bfd_data): Don't override. (elf_backend_modify_program_headers): Don't override. include/ * bfdlink.h (struct bfd_link_info): Add stacksize option. ld/ * ld.texinfo (stack-size): New option. * emultempl/elf32.em: Add stack-size option. ld/testsuite/ * ld-elf/binutils.exp: Add -z stack-size=0. * ld-elf/elf.exp: Add stack-exec and stack-size tests. * ld-elf/orphan-region.d: Add stack-size option. Remove xfail. * ld-elf/stack-exec.rd: New. * ld-elf/stack-size.rd: New. * ld-elf/stack.s: New. * ld-scripts/empty-aligned.d: Add stack-size option. * ld-sh/fdpic-stack-set.d: New. * ld-tic6x/shlib-1.rd: Remove __stacksize symbol. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1.rd: Likewise. * ld-tic6x/shlib-app-1b.rd: Likewise. * ld-tic6x/shlib-app-1r.rd: Likewise. * ld-tic6x/shlib-app-1rb.rd: Likewise. * ld-tic6x/shlib-noindex.rd: Likewise. * ld-tic6x/static-app-1.rd: Likewise. * ld-tic6x/static-app-1b.rd: Likewise. * ld-tic6x/static-app-1r.rd: Likewise. * ld-tic6x/static-app-1rb.rd: Likewise.
2012-10-23 11:33:56 +02:00
/* Any syms created from now on start with -1 in
got.refcount/offset and plt.refcount/offset. */
elf_hash_table (info)->init_got_refcount
= elf_hash_table (info)->init_got_offset;
elf_hash_table (info)->init_plt_refcount
= elf_hash_table (info)->init_plt_offset;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_relocatable (info)
bfd/ * bfd-in.h (bfd_elf_stack_segment_size): Declare. * bfd-in2.h: Rebuilt. * elfxx-target.h (elf_backend_stack_align): New. (elfNN_bed): Add it. * elf-bfd.h (struct elf_backend_data): Add stack_align field. * elf.c (bfd_elf_map_sections_to_segments): Pay attention to stack_align and stacksize for PT_GNU_STACK segment. (assign_file_positions_for_non_load_sections): Set p_memsz for PT_GNU_STACK segment. (copy_elf_program_header): Copy PT_GNU_STACK size. * elflink.c (bfd_elf_stack_segment_size): New function, taken from uclinux backends. (bfd_elf_size_dynamic_sections): Determine PT_GNU_STACK requirements after calling backend. Pay attention to stacksize. * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_bfinfdpic_modify_program_headers): Delete. (elf32_bfingfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-frv.c (frvfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_frvfdpic_modify_program_headers): Delete. (elf32_frvfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-lm32.c (lm32_elf_always_size_sections): Leave PT_GNU_STACK creation to underlying elf support. Check __stacksize here for backwards compatibility, and set it if needed. (lm32_elf_modify_segment_map): Delete. (lm32_elf_modify_program_headers): Delete. (elf_backend_stack_align): Override. (elf_backend_modify_segment_map): Don't override. (elf_backend_modify_program_headers): Don't override. * elf32-sh.c (sh_elf_always_size_sections): Call bfd_elf_stack_segment_size. (sh_elf_modify_program_headers): Delete. (sh_elf_copy_private_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-tic6x.c (elf32_tic6x_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_tic6x_modify_program_headers): Delete. (elf32_tic6x_copy_private_data): Delete. (elf_backend_stack_align): Override. (bfd_elf32_bfd_copy_private_bfd_data): Don't override. (elf_backend_modify_program_headers): Don't override. include/ * bfdlink.h (struct bfd_link_info): Add stacksize option. ld/ * ld.texinfo (stack-size): New option. * emultempl/elf32.em: Add stack-size option. ld/testsuite/ * ld-elf/binutils.exp: Add -z stack-size=0. * ld-elf/elf.exp: Add stack-exec and stack-size tests. * ld-elf/orphan-region.d: Add stack-size option. Remove xfail. * ld-elf/stack-exec.rd: New. * ld-elf/stack-size.rd: New. * ld-elf/stack.s: New. * ld-scripts/empty-aligned.d: Add stack-size option. * ld-sh/fdpic-stack-set.d: New. * ld-tic6x/shlib-1.rd: Remove __stacksize symbol. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1.rd: Likewise. * ld-tic6x/shlib-app-1b.rd: Likewise. * ld-tic6x/shlib-app-1r.rd: Likewise. * ld-tic6x/shlib-app-1rb.rd: Likewise. * ld-tic6x/shlib-noindex.rd: Likewise. * ld-tic6x/static-app-1.rd: Likewise. * ld-tic6x/static-app-1b.rd: Likewise. * ld-tic6x/static-app-1r.rd: Likewise. * ld-tic6x/static-app-1rb.rd: Likewise.
2012-10-23 11:33:56 +02:00
&& !_bfd_elf_size_group_sections (info))
return FALSE;
/* The backend may have to create some sections regardless of whether
we're dynamic or not. */
if (bed->elf_backend_always_size_sections
&& ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
return FALSE;
/* Determine any GNU_STACK segment requirements, after the backend
has had a chance to set a default segment size. */
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (info->execstack)
elf_stack_flags (output_bfd) = PF_R | PF_W | PF_X;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
else if (info->noexecstack)
elf_stack_flags (output_bfd) = PF_R | PF_W;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
else
{
bfd *inputobj;
asection *notesec = NULL;
int exec = 0;
for (inputobj = info->input_bfds;
inputobj;
inputobj = inputobj->link.next)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
asection *s;
if (inputobj->flags
& (DYNAMIC | EXEC_P | BFD_PLUGIN | BFD_LINKER_CREATED))
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
continue;
s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
if (s)
{
if (s->flags & SEC_CODE)
exec = PF_X;
notesec = s;
}
else if (bed->default_execstack)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
exec = PF_X;
}
bfd/ * bfd-in.h (bfd_elf_stack_segment_size): Declare. * bfd-in2.h: Rebuilt. * elfxx-target.h (elf_backend_stack_align): New. (elfNN_bed): Add it. * elf-bfd.h (struct elf_backend_data): Add stack_align field. * elf.c (bfd_elf_map_sections_to_segments): Pay attention to stack_align and stacksize for PT_GNU_STACK segment. (assign_file_positions_for_non_load_sections): Set p_memsz for PT_GNU_STACK segment. (copy_elf_program_header): Copy PT_GNU_STACK size. * elflink.c (bfd_elf_stack_segment_size): New function, taken from uclinux backends. (bfd_elf_size_dynamic_sections): Determine PT_GNU_STACK requirements after calling backend. Pay attention to stacksize. * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_bfinfdpic_modify_program_headers): Delete. (elf32_bfingfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-frv.c (frvfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_frvfdpic_modify_program_headers): Delete. (elf32_frvfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-lm32.c (lm32_elf_always_size_sections): Leave PT_GNU_STACK creation to underlying elf support. Check __stacksize here for backwards compatibility, and set it if needed. (lm32_elf_modify_segment_map): Delete. (lm32_elf_modify_program_headers): Delete. (elf_backend_stack_align): Override. (elf_backend_modify_segment_map): Don't override. (elf_backend_modify_program_headers): Don't override. * elf32-sh.c (sh_elf_always_size_sections): Call bfd_elf_stack_segment_size. (sh_elf_modify_program_headers): Delete. (sh_elf_copy_private_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-tic6x.c (elf32_tic6x_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_tic6x_modify_program_headers): Delete. (elf32_tic6x_copy_private_data): Delete. (elf_backend_stack_align): Override. (bfd_elf32_bfd_copy_private_bfd_data): Don't override. (elf_backend_modify_program_headers): Don't override. include/ * bfdlink.h (struct bfd_link_info): Add stacksize option. ld/ * ld.texinfo (stack-size): New option. * emultempl/elf32.em: Add stack-size option. ld/testsuite/ * ld-elf/binutils.exp: Add -z stack-size=0. * ld-elf/elf.exp: Add stack-exec and stack-size tests. * ld-elf/orphan-region.d: Add stack-size option. Remove xfail. * ld-elf/stack-exec.rd: New. * ld-elf/stack-size.rd: New. * ld-elf/stack.s: New. * ld-scripts/empty-aligned.d: Add stack-size option. * ld-sh/fdpic-stack-set.d: New. * ld-tic6x/shlib-1.rd: Remove __stacksize symbol. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1.rd: Likewise. * ld-tic6x/shlib-app-1b.rd: Likewise. * ld-tic6x/shlib-app-1r.rd: Likewise. * ld-tic6x/shlib-app-1rb.rd: Likewise. * ld-tic6x/shlib-noindex.rd: Likewise. * ld-tic6x/static-app-1.rd: Likewise. * ld-tic6x/static-app-1b.rd: Likewise. * ld-tic6x/static-app-1r.rd: Likewise. * ld-tic6x/static-app-1rb.rd: Likewise.
2012-10-23 11:33:56 +02:00
if (notesec || info->stacksize > 0)
elf_stack_flags (output_bfd) = PF_R | PF_W | exec;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (notesec && exec && bfd_link_relocatable (info)
bfd/ * bfd-in.h (bfd_elf_stack_segment_size): Declare. * bfd-in2.h: Rebuilt. * elfxx-target.h (elf_backend_stack_align): New. (elfNN_bed): Add it. * elf-bfd.h (struct elf_backend_data): Add stack_align field. * elf.c (bfd_elf_map_sections_to_segments): Pay attention to stack_align and stacksize for PT_GNU_STACK segment. (assign_file_positions_for_non_load_sections): Set p_memsz for PT_GNU_STACK segment. (copy_elf_program_header): Copy PT_GNU_STACK size. * elflink.c (bfd_elf_stack_segment_size): New function, taken from uclinux backends. (bfd_elf_size_dynamic_sections): Determine PT_GNU_STACK requirements after calling backend. Pay attention to stacksize. * elf32-bfin.c (elf32_bfinfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_bfinfdpic_modify_program_headers): Delete. (elf32_bfingfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-frv.c (frvfdpic_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_frvfdpic_modify_program_headers): Delete. (elf32_frvfdpic_copy_private_bfd_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-lm32.c (lm32_elf_always_size_sections): Leave PT_GNU_STACK creation to underlying elf support. Check __stacksize here for backwards compatibility, and set it if needed. (lm32_elf_modify_segment_map): Delete. (lm32_elf_modify_program_headers): Delete. (elf_backend_stack_align): Override. (elf_backend_modify_segment_map): Don't override. (elf_backend_modify_program_headers): Don't override. * elf32-sh.c (sh_elf_always_size_sections): Call bfd_elf_stack_segment_size. (sh_elf_modify_program_headers): Delete. (sh_elf_copy_private_data): Don't copy PT_GNU_STACK here. (elf_backend_stack_align): Override. (elf_backend_modify_program_headers): Don't override. * elf32-tic6x.c (elf32_tic6x_always_size_sections): Call bfd_elf_stack_segment_size. (elf32_tic6x_modify_program_headers): Delete. (elf32_tic6x_copy_private_data): Delete. (elf_backend_stack_align): Override. (bfd_elf32_bfd_copy_private_bfd_data): Don't override. (elf_backend_modify_program_headers): Don't override. include/ * bfdlink.h (struct bfd_link_info): Add stacksize option. ld/ * ld.texinfo (stack-size): New option. * emultempl/elf32.em: Add stack-size option. ld/testsuite/ * ld-elf/binutils.exp: Add -z stack-size=0. * ld-elf/elf.exp: Add stack-exec and stack-size tests. * ld-elf/orphan-region.d: Add stack-size option. Remove xfail. * ld-elf/stack-exec.rd: New. * ld-elf/stack-size.rd: New. * ld-elf/stack.s: New. * ld-scripts/empty-aligned.d: Add stack-size option. * ld-sh/fdpic-stack-set.d: New. * ld-tic6x/shlib-1.rd: Remove __stacksize symbol. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1.rd: Likewise. * ld-tic6x/shlib-app-1b.rd: Likewise. * ld-tic6x/shlib-app-1r.rd: Likewise. * ld-tic6x/shlib-app-1rb.rd: Likewise. * ld-tic6x/shlib-noindex.rd: Likewise. * ld-tic6x/static-app-1.rd: Likewise. * ld-tic6x/static-app-1b.rd: Likewise. * ld-tic6x/static-app-1r.rd: Likewise. * ld-tic6x/static-app-1rb.rd: Likewise.
2012-10-23 11:33:56 +02:00
&& notesec->output_section != bfd_abs_section_ptr)
notesec->output_section->flags |= SEC_CODE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
dynobj = elf_hash_table (info)->dynobj;
if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
struct elf_info_failed eif;
struct elf_link_hash_entry *h;
asection *dynstr;
struct bfd_elf_version_tree *t;
struct bfd_elf_version_expr *d;
bfd/ * elf32-ppc.c (struct elf_linker_section): Replace sym_val field with sym. (ppc_elf_relocate_section): Adjust for above. (create_sdata_sym): New function. (ppc_elf_create_linker_section): Call it. (ppc_elf_check_relocs): Correct has_sda_refs and non_got_refs. Create sdata syms for all SDA relocs. (ppc_elf_adjust_dynamic_symbol): Don't special case _SDA_BASE_ and _SDA2_BASE_. (ppc_elf_set_sdata_syms): Delete. * elflink.c (bfd_elf_size_dynamic_sections): Don't create DT_INIT and DT_FINI tags unless associated section has input. (bfd_elf_set_symbol, _bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in.h (_bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in2.h: Regenerate. ld/ * ldemul.c (ldemul_do_assignments, do_assignments_default): Delete. * ldemul.h (ldemul_do_assignments, do_assignments_default): Delete. (struct ld_emulation_xfer_struct): Remove do_assignments field. * ldlang.c (lang_do_assignments): Don't call ldemul_do_assignments. * emulparams/elf32ppc.sh (SDATA_START_SYMBOLS): New. (SDATA2_START_SYMBOLS, SBSS_START_SYMBOLS, SBSS_END_SYMBOLS): New. * emultempl/aix.em (ld_*_emulation): Delete do_assignments init. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/elf32.em: Likewise. (gld*_provide_bound_symbols): Delete. (gld*_provide_init_fini_syms): Delete. (gld*_before_allocation): Don't call ldemul_do_assignments. * emultempl/ppc32elf.em (ppc_do_assignments): Delete. (LDEMUL_DO_ASSIGNMENTS): Delete. * scripttempl/elf.sc: Provide init/fini syms. Add SBSS_START_SYMBOLS, SBSS_END_SYMBOLS, SDATA2_START_SYMBOLS.
2005-08-04 08:22:14 +02:00
asection *s;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
bfd_boolean all_defined;
2012-06-29 16:46:03 +02:00
*sinterpptr = bfd_get_linker_section (dynobj, ".interp");
Add --no-dynamic-linker option to ld, for static PIE use Inhibits output of .interp section in ELF executables. include/ * bfdlink.h (struct bfd_link_info): Add "nointerp" field. bfd/ * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create .interp when info->nointerp. (bfd_elf_size_dynamic_sections): Adjust assert. * elf32-arm.c (elf32_arm_size_dynamic_sections): Don't size .interp when info->nointerp. * elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise. * elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise. * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise. * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise. * elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise. * elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise. * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise. * elf32-metag.c (elf_metag_size_dynamic_sections): Likewise. * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise. * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise. * elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise. * elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Likewise. * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise. * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise. * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise. * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise. * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise. * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise. * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise. * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise. * elfnn-ia64.c (elfNN_ia64_size_dynamic_sections): Likewise. * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise. ld/ * ld.texinfo (--no-dynamic-linker): Document. * ldlex.h (enum option_values): Add OPTION_NO_DYNAMIC_LINKER. * lexsup.c (ld_options, parse_args): Handle --no-dynamic-linker.
2015-09-20 04:50:19 +02:00
BFD_ASSERT (*sinterpptr != NULL || !bfd_link_executable (info) || info->nointerp);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (soname != NULL)
{
soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
soname, TRUE);
if (soname_indx == (bfd_size_type) -1
|| !_bfd_elf_add_dynamic_entry (info, DT_SONAME, soname_indx))
return FALSE;
}
if (info->symbolic)
{
if (!_bfd_elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
return FALSE;
info->flags |= DF_SYMBOLIC;
}
if (rpath != NULL)
{
bfd_size_type indx;
bfd_vma tag;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
TRUE);
if (indx == (bfd_size_type) -1)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
return FALSE;
tag = info->new_dtags ? DT_RUNPATH : DT_RPATH;
if (!_bfd_elf_add_dynamic_entry (info, tag, indx))
return FALSE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
if (filter_shlib != NULL)
{
bfd_size_type indx;
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
filter_shlib, TRUE);
if (indx == (bfd_size_type) -1
|| !_bfd_elf_add_dynamic_entry (info, DT_FILTER, indx))
return FALSE;
}
if (auxiliary_filters != NULL)
{
const char * const *p;
for (p = auxiliary_filters; *p != NULL; p++)
{
bfd_size_type indx;
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
*p, TRUE);
if (indx == (bfd_size_type) -1
|| !_bfd_elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
return FALSE;
}
}
if (audit != NULL)
{
bfd_size_type indx;
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, audit,
TRUE);
if (indx == (bfd_size_type) -1
|| !_bfd_elf_add_dynamic_entry (info, DT_AUDIT, indx))
return FALSE;
}
if (depaudit != NULL)
{
bfd_size_type indx;
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, depaudit,
TRUE);
if (indx == (bfd_size_type) -1
|| !_bfd_elf_add_dynamic_entry (info, DT_DEPAUDIT, indx))
return FALSE;
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
eif.info = info;
eif.failed = FALSE;
/* If we are supposed to export all symbols into the dynamic symbol
table (this is not the normal case), then do so. */
bfd/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * elf-bfd.h (elf_link_hash_entry): Add a dynamic field. (bfd_elf_link_mark_dynamic_symbol): New. (SYMBOLIC_BIND): New. * elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic with SYMBOLIC_BIND (info, h). (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise. * elflink.c (bfd_elf_link_mark_dynamic_symbol): New. (bfd_elf_record_link_assignment): Call bfd_elf_link_mark_dynamic_symbol on new entry. (_bfd_elf_merge_symbol): Likewise. (_bfd_elf_export_symbol): Return if the symbol isn't exported. (_bfd_elf_fix_symbol_flags): Replace info->symbolic with SYMBOLIC_BIND (info, h). (_bfd_elf_dynamic_symbol_p): Likewise. (_bfd_elf_symbol_refs_local_p): Likewise. (bfd_elf_size_dynamic_sections): Updated. include/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * bfdlink.h (bfd_elf_dynamic_list): New. (bfd_link_info): Add a dynamic field. ld/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.am (CXX): Set to g++. (CXX_FOR_TARGET): Likewise. * Makefile.in: Regenerated. * NEWS: Mention --dynamic-list. * ld.texinfo: Document --dynamic-list. * ldgram.y: Support dynamic list. * ldlang.c (lang_process): Call lang_finalize_version_expr_head on link_info.dynamic if needed. (lang_append_dynamic_list): New. (lang_append_dynamic_list_cpp_typeinfo): New. * ldlang.h (lang_append_dynamic_list): Likewise. * ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise. * ldlex.h (input_enum): Add input_dynamic_list. * ldlex.l: Handle it. * ldmain.c (main): Initialize link_info.dynamic. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (ld_options): Add entries for OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. (parse_args): Handle OPTION_DYNAMIC_LIST and OPTION_DYNAMIC_LIST_CPP_TYPEINFO. ld/testsuite/ 2006-09-07 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/dl1.c: New file. * ld-elf/dl1.list: Likewise. * ld-elf/dl1.out: Likewise. * ld-elf/dl1main.c: Likewise. * ld-elf/dl2.c: Likewise. * ld-elf/dl2.list: Likewise. * ld-elf/dl2a.out: Likewise. * ld-elf/dl2b.out: Likewise. * ld-elf/dl2main.c: Likewise. * ld-elf/dl2xxx.c: Likewise. * ld-elf/dl2xxx.list: Likewise. * ld-elf/dl3.cc: Likewise. * ld-elf/dl3.list: Likewise. * ld-elf/dl3a.out: Likewise. * ld-elf/dl3b.out: Likewise. * ld-elf/dl3header.h: Likewise. * ld-elf/dl3main.cc: Likewise. * ld-elf/shared.exp: Updated. * lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional argument for source language. Use CC/CXX for link, depending on source language. (run_cc_link_tests): Likewise.
2006-09-07 19:16:34 +02:00
if (info->export_dynamic
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
|| (bfd_link_executable (info) && info->dynamic))
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_export_symbol,
&eif);
if (eif.failed)
return FALSE;
}
/* Make all global versions with definition. */
for (t = info->version_info; t != NULL; t = t->next)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
for (d = t->globals.list; d != NULL; d = d->next)
if (!d->symver && d->literal)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
const char *verstr, *name;
size_t namelen, verlen, newlen;
char *newname, *p, leading_char;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
struct elf_link_hash_entry *newh;
leading_char = bfd_get_symbol_leading_char (output_bfd);
name = d->pattern;
namelen = strlen (name) + (leading_char != '\0');
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
verstr = t->name;
verlen = strlen (verstr);
newlen = namelen + verlen + 3;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
newname = (char *) bfd_malloc (newlen);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (newname == NULL)
return FALSE;
newname[0] = leading_char;
memcpy (newname + (leading_char != '\0'), name, namelen);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Check the hidden versioned definition. */
p = newname + namelen;
*p++ = ELF_VER_CHR;
memcpy (p, verstr, verlen + 1);
newh = elf_link_hash_lookup (elf_hash_table (info),
newname, FALSE, FALSE,
FALSE);
if (newh == NULL
|| (newh->root.type != bfd_link_hash_defined
&& newh->root.type != bfd_link_hash_defweak))
{
/* Check the default versioned definition. */
*p++ = ELF_VER_CHR;
memcpy (p, verstr, verlen + 1);
newh = elf_link_hash_lookup (elf_hash_table (info),
newname, FALSE, FALSE,
FALSE);
}
free (newname);
/* Mark this version if there is a definition and it is
not defined in a shared object. */
if (newh != NULL
2004-09-16 16:52:12 +02:00
&& !newh->def_dynamic
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
&& (newh->root.type == bfd_link_hash_defined
|| newh->root.type == bfd_link_hash_defweak))
d->symver = 1;
}
/* Attach all the symbols to their version information. */
asvinfo.info = info;
asvinfo.failed = FALSE;
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_link_assign_sym_version,
&asvinfo);
if (asvinfo.failed)
return FALSE;
if (!info->allow_undefined_version)
{
/* Check if all global versions have a definition. */
all_defined = TRUE;
for (t = info->version_info; t != NULL; t = t->next)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
for (d = t->globals.list; d != NULL; d = d->next)
if (d->literal && !d->symver && !d->script)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
(*_bfd_error_handler)
(_("%s: undefined version: %s"),
d->pattern, t->name);
all_defined = FALSE;
}
if (!all_defined)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
}
/* Find all symbols which were defined in a dynamic object and make
the backend pick a reasonable value for them. */
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_adjust_dynamic_symbol,
&eif);
if (eif.failed)
return FALSE;
/* Add some entries to the .dynamic section. We fill in some of the
values later, in bfd_elf_final_link, but we must add the entries
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
now so that we know the final size of the .dynamic section. */
/* If there are initialization and/or finalization functions to
call then add the corresponding DT_INIT/DT_FINI entries. */
h = (info->init_function
? elf_link_hash_lookup (elf_hash_table (info),
info->init_function, FALSE,
FALSE, FALSE)
: NULL);
if (h != NULL
2004-09-16 16:52:12 +02:00
&& (h->ref_regular
|| h->def_regular))
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
if (!_bfd_elf_add_dynamic_entry (info, DT_INIT, 0))
return FALSE;
}
h = (info->fini_function
? elf_link_hash_lookup (elf_hash_table (info),
info->fini_function, FALSE,
FALSE, FALSE)
: NULL);
if (h != NULL
2004-09-16 16:52:12 +02:00
&& (h->ref_regular
|| h->def_regular))
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
if (!_bfd_elf_add_dynamic_entry (info, DT_FINI, 0))
return FALSE;
}
bfd/ * elf32-ppc.c (struct elf_linker_section): Replace sym_val field with sym. (ppc_elf_relocate_section): Adjust for above. (create_sdata_sym): New function. (ppc_elf_create_linker_section): Call it. (ppc_elf_check_relocs): Correct has_sda_refs and non_got_refs. Create sdata syms for all SDA relocs. (ppc_elf_adjust_dynamic_symbol): Don't special case _SDA_BASE_ and _SDA2_BASE_. (ppc_elf_set_sdata_syms): Delete. * elflink.c (bfd_elf_size_dynamic_sections): Don't create DT_INIT and DT_FINI tags unless associated section has input. (bfd_elf_set_symbol, _bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in.h (_bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in2.h: Regenerate. ld/ * ldemul.c (ldemul_do_assignments, do_assignments_default): Delete. * ldemul.h (ldemul_do_assignments, do_assignments_default): Delete. (struct ld_emulation_xfer_struct): Remove do_assignments field. * ldlang.c (lang_do_assignments): Don't call ldemul_do_assignments. * emulparams/elf32ppc.sh (SDATA_START_SYMBOLS): New. (SDATA2_START_SYMBOLS, SBSS_START_SYMBOLS, SBSS_END_SYMBOLS): New. * emultempl/aix.em (ld_*_emulation): Delete do_assignments init. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/elf32.em: Likewise. (gld*_provide_bound_symbols): Delete. (gld*_provide_init_fini_syms): Delete. (gld*_before_allocation): Don't call ldemul_do_assignments. * emultempl/ppc32elf.em (ppc_do_assignments): Delete. (LDEMUL_DO_ASSIGNMENTS): Delete. * scripttempl/elf.sc: Provide init/fini syms. Add SBSS_START_SYMBOLS, SBSS_END_SYMBOLS, SDATA2_START_SYMBOLS.
2005-08-04 08:22:14 +02:00
s = bfd_get_section_by_name (output_bfd, ".preinit_array");
if (s != NULL && s->linker_has_input)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
/* DT_PREINIT_ARRAY is not allowed in shared library. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (! bfd_link_executable (info))
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
bfd *sub;
asection *o;
for (sub = info->input_bfds; sub != NULL;
sub = sub->link.next)
if (bfd_get_flavour (sub) == bfd_target_elf_flavour)
for (o = sub->sections; o != NULL; o = o->next)
if (elf_section_data (o)->this_hdr.sh_type
== SHT_PREINIT_ARRAY)
{
(*_bfd_error_handler)
(_("%B: .preinit_array section is not allowed in DSO"),
sub);
break;
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
bfd_set_error (bfd_error_nonrepresentable_section);
return FALSE;
}
if (!_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAY, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAYSZ, 0))
return FALSE;
}
bfd/ * elf32-ppc.c (struct elf_linker_section): Replace sym_val field with sym. (ppc_elf_relocate_section): Adjust for above. (create_sdata_sym): New function. (ppc_elf_create_linker_section): Call it. (ppc_elf_check_relocs): Correct has_sda_refs and non_got_refs. Create sdata syms for all SDA relocs. (ppc_elf_adjust_dynamic_symbol): Don't special case _SDA_BASE_ and _SDA2_BASE_. (ppc_elf_set_sdata_syms): Delete. * elflink.c (bfd_elf_size_dynamic_sections): Don't create DT_INIT and DT_FINI tags unless associated section has input. (bfd_elf_set_symbol, _bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in.h (_bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in2.h: Regenerate. ld/ * ldemul.c (ldemul_do_assignments, do_assignments_default): Delete. * ldemul.h (ldemul_do_assignments, do_assignments_default): Delete. (struct ld_emulation_xfer_struct): Remove do_assignments field. * ldlang.c (lang_do_assignments): Don't call ldemul_do_assignments. * emulparams/elf32ppc.sh (SDATA_START_SYMBOLS): New. (SDATA2_START_SYMBOLS, SBSS_START_SYMBOLS, SBSS_END_SYMBOLS): New. * emultempl/aix.em (ld_*_emulation): Delete do_assignments init. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/elf32.em: Likewise. (gld*_provide_bound_symbols): Delete. (gld*_provide_init_fini_syms): Delete. (gld*_before_allocation): Don't call ldemul_do_assignments. * emultempl/ppc32elf.em (ppc_do_assignments): Delete. (LDEMUL_DO_ASSIGNMENTS): Delete. * scripttempl/elf.sc: Provide init/fini syms. Add SBSS_START_SYMBOLS, SBSS_END_SYMBOLS, SDATA2_START_SYMBOLS.
2005-08-04 08:22:14 +02:00
s = bfd_get_section_by_name (output_bfd, ".init_array");
if (s != NULL && s->linker_has_input)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
if (!_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAY, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAYSZ, 0))
return FALSE;
}
bfd/ * elf32-ppc.c (struct elf_linker_section): Replace sym_val field with sym. (ppc_elf_relocate_section): Adjust for above. (create_sdata_sym): New function. (ppc_elf_create_linker_section): Call it. (ppc_elf_check_relocs): Correct has_sda_refs and non_got_refs. Create sdata syms for all SDA relocs. (ppc_elf_adjust_dynamic_symbol): Don't special case _SDA_BASE_ and _SDA2_BASE_. (ppc_elf_set_sdata_syms): Delete. * elflink.c (bfd_elf_size_dynamic_sections): Don't create DT_INIT and DT_FINI tags unless associated section has input. (bfd_elf_set_symbol, _bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in.h (_bfd_elf_provide_symbol): Delete. (_bfd_elf_provide_section_bound_symbols): Delete. * bfd-in2.h: Regenerate. ld/ * ldemul.c (ldemul_do_assignments, do_assignments_default): Delete. * ldemul.h (ldemul_do_assignments, do_assignments_default): Delete. (struct ld_emulation_xfer_struct): Remove do_assignments field. * ldlang.c (lang_do_assignments): Don't call ldemul_do_assignments. * emulparams/elf32ppc.sh (SDATA_START_SYMBOLS): New. (SDATA2_START_SYMBOLS, SBSS_START_SYMBOLS, SBSS_END_SYMBOLS): New. * emultempl/aix.em (ld_*_emulation): Delete do_assignments init. * emultempl/armcoff.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/elf32.em: Likewise. (gld*_provide_bound_symbols): Delete. (gld*_provide_init_fini_syms): Delete. (gld*_before_allocation): Don't call ldemul_do_assignments. * emultempl/ppc32elf.em (ppc_do_assignments): Delete. (LDEMUL_DO_ASSIGNMENTS): Delete. * scripttempl/elf.sc: Provide init/fini syms. Add SBSS_START_SYMBOLS, SBSS_END_SYMBOLS, SDATA2_START_SYMBOLS.
2005-08-04 08:22:14 +02:00
s = bfd_get_section_by_name (output_bfd, ".fini_array");
if (s != NULL && s->linker_has_input)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
if (!_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAY, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAYSZ, 0))
return FALSE;
}
2012-06-29 16:46:03 +02:00
dynstr = bfd_get_linker_section (dynobj, ".dynstr");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* If .dynstr is excluded from the link, we don't want any of
these tags. Strictly, we should be checking each section
individually; This quick check covers for the case where
someone does a /DISCARD/ : { *(*) }. */
if (dynstr != NULL && dynstr->output_section != bfd_abs_section_ptr)
{
bfd_size_type strsize;
strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if ((info->emit_hash
&& !_bfd_elf_add_dynamic_entry (info, DT_HASH, 0))
|| (info->emit_gnu_hash
&& !_bfd_elf_add_dynamic_entry (info, DT_GNU_HASH, 0))
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
|| !_bfd_elf_add_dynamic_entry (info, DT_STRTAB, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_SYMTAB, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_STRSZ, strsize)
|| !_bfd_elf_add_dynamic_entry (info, DT_SYMENT,
bed->s->sizeof_sym))
return FALSE;
}
}
if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
return FALSE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* The backend must work out the sizes of all the other dynamic
sections. */
if (dynobj != NULL
&& bed->elf_backend_size_dynamic_sections != NULL
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
&& ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info))
return FALSE;
if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
unsigned long section_sym_count;
struct bfd_elf_version_tree *verdefs;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
asection *s;
/* Set up the version definition section. */
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".gnu.version_d");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
BFD_ASSERT (s != NULL);
/* We may have created additional version definitions if we are
just linking a regular application. */
verdefs = info->version_info;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Skip anonymous version tag. */
if (verdefs != NULL && verdefs->vernum == 0)
verdefs = verdefs->next;
if (verdefs == NULL && !info->create_default_symver)
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
s->flags |= SEC_EXCLUDE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
else
{
unsigned int cdefs;
bfd_size_type size;
struct bfd_elf_version_tree *t;
bfd_byte *p;
Elf_Internal_Verdef def;
Elf_Internal_Verdaux defaux;
struct bfd_link_hash_entry *bh;
struct elf_link_hash_entry *h;
const char *name;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
cdefs = 0;
size = 0;
/* Make space for the base version. */
size += sizeof (Elf_External_Verdef);
size += sizeof (Elf_External_Verdaux);
++cdefs;
/* Make space for the default version. */
if (info->create_default_symver)
{
size += sizeof (Elf_External_Verdef);
++cdefs;
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
for (t = verdefs; t != NULL; t = t->next)
{
struct bfd_elf_version_deps *n;
ld: * Makefile.am (ALL_EMULATIONS): Add eelf32_sparc_sol2.o, eelf_i386_sol2.o. (ALL_64_EMULATIONS): Add eelf_x86_64_sol2.o, eelf64_sparc_sol2.o. (eelf32_sparc_sol2.c): New rule. (eelf64_sparc_sol2.c): Likewise. (eelf_x86_64_sol2.c): Likewise. (eelf_i386_sol2.c): Likewise. * Makefile.in: Regenerate. * configure.tgt (i[3-7]86-*-solaris2*): Change targ_emul to elf_i386_sol2. Add elf_i386_ldso, elf_x86_64_sol2 to targ_extra_emuls. (x86_64-*-solaris2*): Change targ_emul to elf_x86_64_sol2. Add elf_x86_64, elf_i386_sol2, elf_i386 to targ_extra_emuls. (sparc-*-solaris2.[0-6]*): Change targ_emul to elf32_sparc_sol2. Add target_extra_emuls. (sparc-*-solaris2*): Change targ_emul to elf32_sparc_sol2. Add elf32_sparc, elf64_sparc_sol2 to targ_extra_emuls. (sparcv9-*-solaris2*): Change targ_emul to elf64_sparc_sol2. Add elf64_sparc, elf32_sparc_sol2 to target_extra_emuls. * emulparams/elf32_sparc_sol2.sh: New file. * emulparams/elf64_sparc_sol2.sh: New file. * emulparams/elf_i386_sol2.sh: New file. * emulparams/elf_x86_64_sol2.sh: New file. * emultempl/solaris2.em: New file. bfd: * elflink.c (bfd_elf_size_dynamic_sections): Don't emit base version twice. Skip it when constructing def.vd_next. * elf32-i386.c (TARGET_LITTLE_SYM): Redefine to bfd_elf32_i386_sol2_vec. (TARGET_LITTLE_NAME): Redefine to elf32-i386-sol2. (elf32_bed): Redefine to elf32_i386_sol2_bed. (elf_backend_want_plt_sym): Redefine to 1. * elf64-x86-64.c (TARGET_LITTLE_SYM): Redefine to bfd_elf64_x86_64_sol2_vec. (TARGET_LITTLE_NAME): Redefine to elf64-x86-64-sol2. (elf64_bed): Redefine to elf64_x86_64_sol2_bed. (elf_backend_want_plt_sym): Redefine to 1. * config.bfd (i[3-7]86-*-solaris2*): Set targ_defvec to bfd_elf32_i386_sol2_vec. Replace bfd_elf64_x86_64_vec by bfd_elf64_x86_64_sol2_vec in targ64_selvecs. (x86_64-*-solaris2*): Set targ_defvec to bfd_elf32_i386_sol2_vec. Replace bfd_elf64_x86_64_vec by bfd_elf64_x86_64_sol2_vec in targ_selvecs. * configure.in: Handle bfd_elf32_i386_sol2_vec, bfd_elf64_x86_64_sol2_vec. * configure: Regenerate. * targets.c (bfd_elf32_i386_sol2_vec): Declare. (bfd_elf64_x86_64_sol2_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_sol2_vec, bfd_elf64_x86_64_sol2_vec.
2010-03-05 20:49:00 +01:00
/* Don't emit base version twice. */
if (t->vernum == 0)
continue;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
size += sizeof (Elf_External_Verdef);
size += sizeof (Elf_External_Verdaux);
++cdefs;
for (n = t->deps; n != NULL; n = n->next)
size += sizeof (Elf_External_Verdaux);
}
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
s->size = size;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
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 (s->contents == NULL && s->size != 0)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
return FALSE;
/* Fill in the version definition section. */
p = s->contents;
def.vd_version = VER_DEF_CURRENT;
def.vd_flags = VER_FLG_BASE;
def.vd_ndx = 1;
def.vd_cnt = 1;
if (info->create_default_symver)
{
def.vd_aux = 2 * sizeof (Elf_External_Verdef);
def.vd_next = sizeof (Elf_External_Verdef);
}
else
{
def.vd_aux = sizeof (Elf_External_Verdef);
def.vd_next = (sizeof (Elf_External_Verdef)
+ sizeof (Elf_External_Verdaux));
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (soname_indx != (bfd_size_type) -1)
{
_bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
soname_indx);
def.vd_hash = bfd_elf_hash (soname);
defaux.vda_name = soname_indx;
name = soname;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
else
{
bfd_size_type indx;
name = lbasename (output_bfd->filename);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
def.vd_hash = bfd_elf_hash (name);
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
name, FALSE);
if (indx == (bfd_size_type) -1)
return FALSE;
defaux.vda_name = indx;
}
defaux.vda_next = 0;
_bfd_elf_swap_verdef_out (output_bfd, &def,
(Elf_External_Verdef *) p);
p += sizeof (Elf_External_Verdef);
if (info->create_default_symver)
{
/* Add a symbol representing this version. */
bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, dynobj, name, BSF_GLOBAL, bfd_abs_section_ptr,
0, NULL, FALSE,
get_elf_backend_data (dynobj)->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->non_elf = 0;
h->def_regular = 1;
h->type = STT_OBJECT;
h->verinfo.vertree = NULL;
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
/* Create a duplicate of the base version with the same
aux block, but different flags. */
def.vd_flags = 0;
def.vd_ndx = 2;
def.vd_aux = sizeof (Elf_External_Verdef);
if (verdefs)
def.vd_next = (sizeof (Elf_External_Verdef)
+ sizeof (Elf_External_Verdaux));
else
def.vd_next = 0;
_bfd_elf_swap_verdef_out (output_bfd, &def,
(Elf_External_Verdef *) p);
p += sizeof (Elf_External_Verdef);
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
_bfd_elf_swap_verdaux_out (output_bfd, &defaux,
(Elf_External_Verdaux *) p);
p += sizeof (Elf_External_Verdaux);
for (t = verdefs; t != NULL; t = t->next)
{
unsigned int cdeps;
struct bfd_elf_version_deps *n;
ld: * Makefile.am (ALL_EMULATIONS): Add eelf32_sparc_sol2.o, eelf_i386_sol2.o. (ALL_64_EMULATIONS): Add eelf_x86_64_sol2.o, eelf64_sparc_sol2.o. (eelf32_sparc_sol2.c): New rule. (eelf64_sparc_sol2.c): Likewise. (eelf_x86_64_sol2.c): Likewise. (eelf_i386_sol2.c): Likewise. * Makefile.in: Regenerate. * configure.tgt (i[3-7]86-*-solaris2*): Change targ_emul to elf_i386_sol2. Add elf_i386_ldso, elf_x86_64_sol2 to targ_extra_emuls. (x86_64-*-solaris2*): Change targ_emul to elf_x86_64_sol2. Add elf_x86_64, elf_i386_sol2, elf_i386 to targ_extra_emuls. (sparc-*-solaris2.[0-6]*): Change targ_emul to elf32_sparc_sol2. Add target_extra_emuls. (sparc-*-solaris2*): Change targ_emul to elf32_sparc_sol2. Add elf32_sparc, elf64_sparc_sol2 to targ_extra_emuls. (sparcv9-*-solaris2*): Change targ_emul to elf64_sparc_sol2. Add elf64_sparc, elf32_sparc_sol2 to target_extra_emuls. * emulparams/elf32_sparc_sol2.sh: New file. * emulparams/elf64_sparc_sol2.sh: New file. * emulparams/elf_i386_sol2.sh: New file. * emulparams/elf_x86_64_sol2.sh: New file. * emultempl/solaris2.em: New file. bfd: * elflink.c (bfd_elf_size_dynamic_sections): Don't emit base version twice. Skip it when constructing def.vd_next. * elf32-i386.c (TARGET_LITTLE_SYM): Redefine to bfd_elf32_i386_sol2_vec. (TARGET_LITTLE_NAME): Redefine to elf32-i386-sol2. (elf32_bed): Redefine to elf32_i386_sol2_bed. (elf_backend_want_plt_sym): Redefine to 1. * elf64-x86-64.c (TARGET_LITTLE_SYM): Redefine to bfd_elf64_x86_64_sol2_vec. (TARGET_LITTLE_NAME): Redefine to elf64-x86-64-sol2. (elf64_bed): Redefine to elf64_x86_64_sol2_bed. (elf_backend_want_plt_sym): Redefine to 1. * config.bfd (i[3-7]86-*-solaris2*): Set targ_defvec to bfd_elf32_i386_sol2_vec. Replace bfd_elf64_x86_64_vec by bfd_elf64_x86_64_sol2_vec in targ64_selvecs. (x86_64-*-solaris2*): Set targ_defvec to bfd_elf32_i386_sol2_vec. Replace bfd_elf64_x86_64_vec by bfd_elf64_x86_64_sol2_vec in targ_selvecs. * configure.in: Handle bfd_elf32_i386_sol2_vec, bfd_elf64_x86_64_sol2_vec. * configure: Regenerate. * targets.c (bfd_elf32_i386_sol2_vec): Declare. (bfd_elf64_x86_64_sol2_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_sol2_vec, bfd_elf64_x86_64_sol2_vec.
2010-03-05 20:49:00 +01:00
/* Don't emit the base version twice. */
if (t->vernum == 0)
continue;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
cdeps = 0;
for (n = t->deps; n != NULL; n = n->next)
++cdeps;
/* Add a symbol representing this version. */
bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr,
0, NULL, FALSE,
get_elf_backend_data (dynobj)->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
2004-09-16 16:52:12 +02:00
h->non_elf = 0;
h->def_regular = 1;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
h->type = STT_OBJECT;
h->verinfo.vertree = t;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! bfd_elf_link_record_dynamic_symbol (info, h))
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
return FALSE;
def.vd_version = VER_DEF_CURRENT;
def.vd_flags = 0;
if (t->globals.list == NULL
&& t->locals.list == NULL
&& ! t->used)
def.vd_flags |= VER_FLG_WEAK;
def.vd_ndx = t->vernum + (info->create_default_symver ? 2 : 1);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
def.vd_cnt = cdeps + 1;
def.vd_hash = bfd_elf_hash (t->name);
def.vd_aux = sizeof (Elf_External_Verdef);
def.vd_next = 0;
ld: * Makefile.am (ALL_EMULATIONS): Add eelf32_sparc_sol2.o, eelf_i386_sol2.o. (ALL_64_EMULATIONS): Add eelf_x86_64_sol2.o, eelf64_sparc_sol2.o. (eelf32_sparc_sol2.c): New rule. (eelf64_sparc_sol2.c): Likewise. (eelf_x86_64_sol2.c): Likewise. (eelf_i386_sol2.c): Likewise. * Makefile.in: Regenerate. * configure.tgt (i[3-7]86-*-solaris2*): Change targ_emul to elf_i386_sol2. Add elf_i386_ldso, elf_x86_64_sol2 to targ_extra_emuls. (x86_64-*-solaris2*): Change targ_emul to elf_x86_64_sol2. Add elf_x86_64, elf_i386_sol2, elf_i386 to targ_extra_emuls. (sparc-*-solaris2.[0-6]*): Change targ_emul to elf32_sparc_sol2. Add target_extra_emuls. (sparc-*-solaris2*): Change targ_emul to elf32_sparc_sol2. Add elf32_sparc, elf64_sparc_sol2 to targ_extra_emuls. (sparcv9-*-solaris2*): Change targ_emul to elf64_sparc_sol2. Add elf64_sparc, elf32_sparc_sol2 to target_extra_emuls. * emulparams/elf32_sparc_sol2.sh: New file. * emulparams/elf64_sparc_sol2.sh: New file. * emulparams/elf_i386_sol2.sh: New file. * emulparams/elf_x86_64_sol2.sh: New file. * emultempl/solaris2.em: New file. bfd: * elflink.c (bfd_elf_size_dynamic_sections): Don't emit base version twice. Skip it when constructing def.vd_next. * elf32-i386.c (TARGET_LITTLE_SYM): Redefine to bfd_elf32_i386_sol2_vec. (TARGET_LITTLE_NAME): Redefine to elf32-i386-sol2. (elf32_bed): Redefine to elf32_i386_sol2_bed. (elf_backend_want_plt_sym): Redefine to 1. * elf64-x86-64.c (TARGET_LITTLE_SYM): Redefine to bfd_elf64_x86_64_sol2_vec. (TARGET_LITTLE_NAME): Redefine to elf64-x86-64-sol2. (elf64_bed): Redefine to elf64_x86_64_sol2_bed. (elf_backend_want_plt_sym): Redefine to 1. * config.bfd (i[3-7]86-*-solaris2*): Set targ_defvec to bfd_elf32_i386_sol2_vec. Replace bfd_elf64_x86_64_vec by bfd_elf64_x86_64_sol2_vec in targ64_selvecs. (x86_64-*-solaris2*): Set targ_defvec to bfd_elf32_i386_sol2_vec. Replace bfd_elf64_x86_64_vec by bfd_elf64_x86_64_sol2_vec in targ_selvecs. * configure.in: Handle bfd_elf32_i386_sol2_vec, bfd_elf64_x86_64_sol2_vec. * configure: Regenerate. * targets.c (bfd_elf32_i386_sol2_vec): Declare. (bfd_elf64_x86_64_sol2_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_sol2_vec, bfd_elf64_x86_64_sol2_vec.
2010-03-05 20:49:00 +01:00
/* If a basever node is next, it *must* be the last node in
the chain, otherwise Verdef construction breaks. */
if (t->next != NULL && t->next->vernum == 0)
BFD_ASSERT (t->next->next == NULL);
if (t->next != NULL && t->next->vernum != 0)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
def.vd_next = (sizeof (Elf_External_Verdef)
+ (cdeps + 1) * sizeof (Elf_External_Verdaux));
_bfd_elf_swap_verdef_out (output_bfd, &def,
(Elf_External_Verdef *) p);
p += sizeof (Elf_External_Verdef);
defaux.vda_name = h->dynstr_index;
_bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
h->dynstr_index);
defaux.vda_next = 0;
if (t->deps != NULL)
defaux.vda_next = sizeof (Elf_External_Verdaux);
t->name_indx = defaux.vda_name;
_bfd_elf_swap_verdaux_out (output_bfd, &defaux,
(Elf_External_Verdaux *) p);
p += sizeof (Elf_External_Verdaux);
for (n = t->deps; n != NULL; n = n->next)
{
if (n->version_needed == NULL)
{
/* This can happen if there was an error in the
version script. */
defaux.vda_name = 0;
}
else
{
defaux.vda_name = n->version_needed->name_indx;
_bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
defaux.vda_name);
}
if (n->next == NULL)
defaux.vda_next = 0;
else
defaux.vda_next = sizeof (Elf_External_Verdaux);
_bfd_elf_swap_verdaux_out (output_bfd, &defaux,
(Elf_External_Verdaux *) p);
p += sizeof (Elf_External_Verdaux);
}
}
if (!_bfd_elf_add_dynamic_entry (info, DT_VERDEF, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs))
return FALSE;
elf_tdata (output_bfd)->cverdefs = cdefs;
}
if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS))
{
if (!_bfd_elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
return FALSE;
}
else if (info->flags & DF_BIND_NOW)
{
if (!_bfd_elf_add_dynamic_entry (info, DT_BIND_NOW, 0))
return FALSE;
}
if (info->flags_1)
{
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_executable (info))
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
info->flags_1 &= ~ (DF_1_INITFIRST
| DF_1_NODELETE
| DF_1_NOOPEN);
if (!_bfd_elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1))
return FALSE;
}
/* Work out the size of the version reference section. */
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".gnu.version_r");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
BFD_ASSERT (s != NULL);
{
struct elf_find_verdep_info sinfo;
sinfo.info = info;
sinfo.vers = elf_tdata (output_bfd)->cverdefs;
if (sinfo.vers == 0)
sinfo.vers = 1;
sinfo.failed = FALSE;
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_link_find_version_dependencies,
&sinfo);
if (sinfo.failed)
return FALSE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (elf_tdata (output_bfd)->verref == NULL)
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
s->flags |= SEC_EXCLUDE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
else
{
Elf_Internal_Verneed *t;
unsigned int size;
unsigned int crefs;
bfd_byte *p;
ld: * Makefile.am (ALL_EMULATIONS): Add eelf32_sparc_sol2.o, eelf_i386_sol2.o. (ALL_64_EMULATIONS): Add eelf_x86_64_sol2.o, eelf64_sparc_sol2.o. (eelf32_sparc_sol2.c): New rule. (eelf64_sparc_sol2.c): Likewise. (eelf_x86_64_sol2.c): Likewise. (eelf_i386_sol2.c): Likewise. * Makefile.in: Regenerate. * configure.tgt (i[3-7]86-*-solaris2*): Change targ_emul to elf_i386_sol2. Add elf_i386_ldso, elf_x86_64_sol2 to targ_extra_emuls. (x86_64-*-solaris2*): Change targ_emul to elf_x86_64_sol2. Add elf_x86_64, elf_i386_sol2, elf_i386 to targ_extra_emuls. (sparc-*-solaris2.[0-6]*): Change targ_emul to elf32_sparc_sol2. Add target_extra_emuls. (sparc-*-solaris2*): Change targ_emul to elf32_sparc_sol2. Add elf32_sparc, elf64_sparc_sol2 to targ_extra_emuls. (sparcv9-*-solaris2*): Change targ_emul to elf64_sparc_sol2. Add elf64_sparc, elf32_sparc_sol2 to target_extra_emuls. * emulparams/elf32_sparc_sol2.sh: New file. * emulparams/elf64_sparc_sol2.sh: New file. * emulparams/elf_i386_sol2.sh: New file. * emulparams/elf_x86_64_sol2.sh: New file. * emultempl/solaris2.em: New file. bfd: * elflink.c (bfd_elf_size_dynamic_sections): Don't emit base version twice. Skip it when constructing def.vd_next. * elf32-i386.c (TARGET_LITTLE_SYM): Redefine to bfd_elf32_i386_sol2_vec. (TARGET_LITTLE_NAME): Redefine to elf32-i386-sol2. (elf32_bed): Redefine to elf32_i386_sol2_bed. (elf_backend_want_plt_sym): Redefine to 1. * elf64-x86-64.c (TARGET_LITTLE_SYM): Redefine to bfd_elf64_x86_64_sol2_vec. (TARGET_LITTLE_NAME): Redefine to elf64-x86-64-sol2. (elf64_bed): Redefine to elf64_x86_64_sol2_bed. (elf_backend_want_plt_sym): Redefine to 1. * config.bfd (i[3-7]86-*-solaris2*): Set targ_defvec to bfd_elf32_i386_sol2_vec. Replace bfd_elf64_x86_64_vec by bfd_elf64_x86_64_sol2_vec in targ64_selvecs. (x86_64-*-solaris2*): Set targ_defvec to bfd_elf32_i386_sol2_vec. Replace bfd_elf64_x86_64_vec by bfd_elf64_x86_64_sol2_vec in targ_selvecs. * configure.in: Handle bfd_elf32_i386_sol2_vec, bfd_elf64_x86_64_sol2_vec. * configure: Regenerate. * targets.c (bfd_elf32_i386_sol2_vec): Declare. (bfd_elf64_x86_64_sol2_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_sol2_vec, bfd_elf64_x86_64_sol2_vec.
2010-03-05 20:49:00 +01:00
/* Build the version dependency section. */
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
size = 0;
crefs = 0;
for (t = elf_tdata (output_bfd)->verref;
t != NULL;
t = t->vn_nextref)
{
Elf_Internal_Vernaux *a;
size += sizeof (Elf_External_Verneed);
++crefs;
for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
size += sizeof (Elf_External_Vernaux);
}
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
s->size = size;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (s->contents == NULL)
return FALSE;
p = s->contents;
for (t = elf_tdata (output_bfd)->verref;
t != NULL;
t = t->vn_nextref)
{
unsigned int caux;
Elf_Internal_Vernaux *a;
bfd_size_type indx;
caux = 0;
for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
++caux;
t->vn_version = VER_NEED_CURRENT;
t->vn_cnt = caux;
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
elf_dt_name (t->vn_bfd) != NULL
? elf_dt_name (t->vn_bfd)
: lbasename (t->vn_bfd->filename),
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
FALSE);
if (indx == (bfd_size_type) -1)
return FALSE;
t->vn_file = indx;
t->vn_aux = sizeof (Elf_External_Verneed);
if (t->vn_nextref == NULL)
t->vn_next = 0;
else
t->vn_next = (sizeof (Elf_External_Verneed)
+ caux * sizeof (Elf_External_Vernaux));
_bfd_elf_swap_verneed_out (output_bfd, t,
(Elf_External_Verneed *) p);
p += sizeof (Elf_External_Verneed);
for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
{
a->vna_hash = bfd_elf_hash (a->vna_nodename);
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
a->vna_nodename, FALSE);
if (indx == (bfd_size_type) -1)
return FALSE;
a->vna_name = indx;
if (a->vna_nextptr == NULL)
a->vna_next = 0;
else
a->vna_next = sizeof (Elf_External_Vernaux);
_bfd_elf_swap_vernaux_out (output_bfd, a,
(Elf_External_Vernaux *) p);
p += sizeof (Elf_External_Vernaux);
}
}
if (!_bfd_elf_add_dynamic_entry (info, DT_VERNEED, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs))
return FALSE;
elf_tdata (output_bfd)->cverrefs = crefs;
}
}
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
if ((elf_tdata (output_bfd)->cverrefs == 0
&& elf_tdata (output_bfd)->cverdefs == 0)
|| _bfd_elf_link_renumber_dynsyms (output_bfd, info,
&section_sym_count) == 0)
{
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".gnu.version");
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
s->flags |= SEC_EXCLUDE;
}
}
return TRUE;
}
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
/* Find the first non-excluded output section. We'll use its
section symbol for some emitted relocs. */
void
_bfd_elf_init_1_index_section (bfd *output_bfd, struct bfd_link_info *info)
{
asection *s;
for (s = output_bfd->sections; s != NULL; s = s->next)
if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC
&& !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
{
elf_hash_table (info)->text_index_section = s;
break;
}
}
/* Find two non-excluded output sections, one for code, one for data.
We'll use their section symbols for some emitted relocs. */
void
_bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info)
{
asection *s;
/* Data first, since setting text_index_section changes
_bfd_elf_link_omit_section_dynsym. */
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
for (s = output_bfd->sections; s != NULL; s = s->next)
if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC)
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
&& !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
{
elf_hash_table (info)->data_index_section = s;
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
break;
}
for (s = output_bfd->sections; s != NULL; s = s->next)
if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY))
== (SEC_ALLOC | SEC_READONLY))
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
&& !_bfd_elf_link_omit_section_dynsym (output_bfd, info, s))
{
elf_hash_table (info)->text_index_section = s;
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
break;
}
if (elf_hash_table (info)->text_index_section == NULL)
elf_hash_table (info)->text_index_section
= elf_hash_table (info)->data_index_section;
}
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
bfd_boolean
bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
{
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
const struct elf_backend_data *bed;
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
if (!is_elf_hash_table (info->hash))
return TRUE;
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
bed = get_elf_backend_data (output_bfd);
(*bed->elf_backend_init_index_section) (output_bfd, info);
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
if (elf_hash_table (info)->dynamic_sections_created)
{
bfd *dynobj;
asection *s;
bfd_size_type dynsymcount;
unsigned long section_sym_count;
unsigned int dtagcount;
dynobj = elf_hash_table (info)->dynobj;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Assign dynsym indicies. In a shared library we generate a
section symbol for each output section, which come first.
Next come all of the back-end allocated local dynamic syms,
followed by the rest of the global symbols. */
dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info,
&section_sym_count);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Work out the size of the symbol version section. */
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".gnu.version");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
BFD_ASSERT (s != NULL);
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
if (dynsymcount != 0
&& (s->flags & SEC_EXCLUDE) == 0)
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
{
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
s->size = dynsymcount * sizeof (Elf_External_Versym);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
s->contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (s->contents == NULL)
return FALSE;
if (!_bfd_elf_add_dynamic_entry (info, DT_VERSYM, 0))
return FALSE;
}
/* Set the size of the .dynsym and .hash sections. We counted
the number of dynamic symbols in elf_link_add_object_symbols.
We will build the contents of .dynsym and .hash when we build
the final symbol table, because until then we do not know the
correct value to give the symbols. We built the .dynstr
section as we went along in elf_link_add_object_symbols. */
s = elf_hash_table (info)->dynsym;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
BFD_ASSERT (s != NULL);
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
s->size = dynsymcount * bed->s->sizeof_sym;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
if (dynsymcount != 0)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* The first entry in .dynsym is a dummy symbol.
Clear all the section syms, in case we don't output them all. */
++section_sym_count;
memset (s->contents, 0, section_sym_count * bed->s->sizeof_sym);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
}
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
elf_hash_table (info)->bucketcount = 0;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
/* Compute the size of the hashing table. As a side effect this
computes the hash values for all the names we export. */
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (info->emit_hash)
{
unsigned long int *hashcodes;
struct hash_codes_info hashinf;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
bfd_size_type amt;
unsigned long int nsyms;
size_t bucketcount;
size_t hash_entry_size;
/* Compute the hash values for all exported symbols. At the same
time store the values in an array so that we could use them for
optimizations. */
amt = dynsymcount * sizeof (unsigned long int);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
hashcodes = (unsigned long int *) bfd_malloc (amt);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (hashcodes == NULL)
return FALSE;
hashinf.hashcodes = hashcodes;
hashinf.error = FALSE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
/* Put all hash values in HASHCODES. */
elf_link_hash_traverse (elf_hash_table (info),
elf_collect_hash_codes, &hashinf);
if (hashinf.error)
{
free (hashcodes);
return FALSE;
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
nsyms = hashinf.hashcodes - hashcodes;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
bucketcount
= compute_bucket_count (info, hashcodes, nsyms, 0);
free (hashcodes);
if (bucketcount == 0)
return FALSE;
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
elf_hash_table (info)->bucketcount = bucketcount;
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".hash");
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
BFD_ASSERT (s != NULL);
hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
s->contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (s->contents == NULL)
return FALSE;
bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents);
bfd_put (8 * hash_entry_size, output_bfd, dynsymcount,
s->contents + hash_entry_size);
}
if (info->emit_gnu_hash)
{
size_t i, cnt;
unsigned char *contents;
struct collect_gnu_hash_codes cinfo;
bfd_size_type amt;
size_t bucketcount;
memset (&cinfo, 0, sizeof (cinfo));
/* Compute the hash values for all exported symbols. At the same
time store the values in an array so that we could use them for
optimizations. */
amt = dynsymcount * 2 * sizeof (unsigned long int);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
cinfo.hashcodes = (long unsigned int *) bfd_malloc (amt);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (cinfo.hashcodes == NULL)
return FALSE;
cinfo.hashval = cinfo.hashcodes + dynsymcount;
cinfo.min_dynindx = -1;
cinfo.output_bfd = output_bfd;
cinfo.bed = bed;
/* Put all hash values in HASHCODES. */
elf_link_hash_traverse (elf_hash_table (info),
elf_collect_gnu_hash_codes, &cinfo);
if (cinfo.error)
{
free (cinfo.hashcodes);
return FALSE;
}
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
bucketcount
= compute_bucket_count (info, cinfo.hashcodes, cinfo.nsyms, 1);
if (bucketcount == 0)
{
free (cinfo.hashcodes);
return FALSE;
}
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".gnu.hash");
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
BFD_ASSERT (s != NULL);
if (cinfo.nsyms == 0)
{
/* Empty .gnu.hash section is special. */
BFD_ASSERT (cinfo.min_dynindx == -1);
free (cinfo.hashcodes);
s->size = 5 * 4 + bed->s->arch_size / 8;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (contents == NULL)
return FALSE;
s->contents = contents;
/* 1 empty bucket. */
bfd_put_32 (output_bfd, 1, contents);
/* SYMIDX above the special symbol 0. */
bfd_put_32 (output_bfd, 1, contents + 4);
/* Just one word for bitmask. */
bfd_put_32 (output_bfd, 1, contents + 8);
/* Only hash fn bloom filter. */
bfd_put_32 (output_bfd, 0, contents + 12);
/* No hashes are valid - empty bitmask. */
bfd_put (bed->s->arch_size, output_bfd, 0, contents + 16);
/* No hashes in the only bucket. */
bfd_put_32 (output_bfd, 0,
contents + 16 + bed->s->arch_size / 8);
}
else
{
unsigned long int maskwords, maskbitslog2, x;
BFD_ASSERT (cinfo.min_dynindx != -1);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
x = cinfo.nsyms;
maskbitslog2 = 1;
while ((x >>= 1) != 0)
++maskbitslog2;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (maskbitslog2 < 3)
maskbitslog2 = 5;
else if ((1 << (maskbitslog2 - 2)) & cinfo.nsyms)
maskbitslog2 = maskbitslog2 + 3;
else
maskbitslog2 = maskbitslog2 + 2;
if (bed->s->arch_size == 64)
{
if (maskbitslog2 == 5)
maskbitslog2 = 6;
cinfo.shift1 = 6;
}
else
cinfo.shift1 = 5;
cinfo.mask = (1 << cinfo.shift1) - 1;
cinfo.shift2 = maskbitslog2;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
cinfo.maskbits = 1 << maskbitslog2;
maskwords = 1 << (maskbitslog2 - cinfo.shift1);
amt = bucketcount * sizeof (unsigned long int) * 2;
amt += maskwords * sizeof (bfd_vma);
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
cinfo.bitmask = (bfd_vma *) bfd_malloc (amt);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (cinfo.bitmask == NULL)
{
free (cinfo.hashcodes);
return FALSE;
}
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
cinfo.counts = (long unsigned int *) (cinfo.bitmask + maskwords);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
cinfo.indx = cinfo.counts + bucketcount;
cinfo.symindx = dynsymcount - cinfo.nsyms;
memset (cinfo.bitmask, 0, maskwords * sizeof (bfd_vma));
/* Determine how often each hash bucket is used. */
memset (cinfo.counts, 0, bucketcount * sizeof (cinfo.counts[0]));
for (i = 0; i < cinfo.nsyms; ++i)
++cinfo.counts[cinfo.hashcodes[i] % bucketcount];
for (i = 0, cnt = cinfo.symindx; i < bucketcount; ++i)
if (cinfo.counts[i] != 0)
{
cinfo.indx[i] = cnt;
cnt += cinfo.counts[i];
}
BFD_ASSERT (cnt == dynsymcount);
cinfo.bucketcount = bucketcount;
cinfo.local_indx = cinfo.min_dynindx;
s->size = (4 + bucketcount + cinfo.nsyms) * 4;
s->size += cinfo.maskbits / 8;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
if (contents == NULL)
{
free (cinfo.bitmask);
free (cinfo.hashcodes);
return FALSE;
}
s->contents = contents;
bfd_put_32 (output_bfd, bucketcount, contents);
bfd_put_32 (output_bfd, cinfo.symindx, contents + 4);
bfd_put_32 (output_bfd, maskwords, contents + 8);
bfd_put_32 (output_bfd, cinfo.shift2, contents + 12);
contents += 16 + cinfo.maskbits / 8;
for (i = 0; i < bucketcount; ++i)
{
if (cinfo.counts[i] == 0)
bfd_put_32 (output_bfd, 0, contents);
else
bfd_put_32 (output_bfd, cinfo.indx[i], contents);
contents += 4;
}
cinfo.contents = contents;
/* Renumber dynamic symbols, populate .gnu.hash section. */
elf_link_hash_traverse (elf_hash_table (info),
elf_renumber_gnu_hash_syms, &cinfo);
contents = s->contents + 16;
for (i = 0; i < maskwords; ++i)
{
bfd_put (bed->s->arch_size, output_bfd, cinfo.bitmask[i],
contents);
contents += bed->s->arch_size / 8;
}
free (cinfo.bitmask);
free (cinfo.hashcodes);
}
}
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
2012-06-29 16:46:03 +02:00
s = bfd_get_linker_section (dynobj, ".dynstr");
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
BFD_ASSERT (s != NULL);
elf_finalize_dynstr (output_bfd, info);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
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
s->size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
bfd/ * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed and chained shared libs only if dynsym. Clear dynsym on forced-local. * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. (_bfd_elf_add_dt_needed_tag): Declare. (_bfd_elf_sort_symbol): Declare. (_bfd_elf_finalize_dynstr): Declare. (RELOC_FOR_GLOBAL_SYM): Formatting. * elfcode.h (elf_add_dynamic_entry): Delete. * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding elflink.h function converted to use elf_size_info. (_bfd_elf_add_dt_needed_tag): Likewise. (_bfd_elf_sort_symbol): Likewise. (_bfd_elf_finalize_dynstr): Likewise. (compute_bucket_count): Likewise. (bfd_elf_size_dynamic_sections): Likewise. Check result of _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. * elflink.h: ..here. (sort_symbol, add_dt_needed_tag): Delete. (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. Update all users. * elf32-arm.h (add_dynamic_entry): Update. Remove casts. * elf32-cris.c (add_dynamic_entry): Likewise. * elf32-hppa.c (add_dynamic_entry): Likewise. * elf32-i370.c (add_dynamic_entry): Likewise. * elf32-i386.c (add_dynamic_entry): Likewise. * elf32-m32r.c (add_dynamic_entry): Likewise. * elf32-m68k.c (add_dynamic_entry): Likewise. * elf32-ppc.c (add_dynamic_entry): Likewise. * elf32-s390.c (add_dynamic_entry): Likewise. * elf32-sh.c (add_dynamic_entry): Likewise. * elf32-sparc.c (add_dynamic_entry): Likewise. * elf32-vax.c (add_dynamic_entry): Likewise. * elf32-xtensa.c (add_dynamic_entry): Likewise. * elf64-alpha.c (add_dynamic_entry): Likewise. * elf64-hppa.c (add_dynamic_entry): Likewise. * elf64-ppc.c (add_dynamic_entry): Likewise. * elf64-s390.c (add_dynamic_entry): Likewise. * elf64-sparc.c (add_dynamic_entry): Likewise. * elf64-x86-64.c (add_dynamic_entry): Likewise. * elfxx-ia64.c (add_dynamic_entry): Likewise. * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Update size_dynamic_sections call.
2004-03-25 13:48:45 +01:00
for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
if (!_bfd_elf_add_dynamic_entry (info, DT_NULL, 0))
return FALSE;
}
return TRUE;
}
/* Make sure sec_info_type is cleared if sec_info is cleared too. */
static void
merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec)
{
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
BFD_ASSERT (sec->sec_info_type == SEC_INFO_TYPE_MERGE);
sec->sec_info_type = SEC_INFO_TYPE_NONE;
}
/* Finish SHF_MERGE section merging. */
bfd_boolean
_bfd_elf_merge_sections (bfd *obfd, struct bfd_link_info *info)
{
bfd *ibfd;
asection *sec;
if (!is_elf_hash_table (info->hash))
return FALSE;
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
if ((ibfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (ibfd) == bfd_target_elf_flavour
&& (elf_elfheader (ibfd)->e_ident[EI_CLASS]
== get_elf_backend_data (obfd)->s->elfclass))
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
if ((sec->flags & SEC_MERGE) != 0
&& !bfd_is_abs_section (sec->output_section))
{
struct bfd_elf_section_data *secdata;
secdata = elf_section_data (sec);
if (! _bfd_add_merge_section (obfd,
&elf_hash_table (info)->merge_info,
sec, &secdata->sec_info))
return FALSE;
else if (secdata->sec_info)
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
sec->sec_info_type = SEC_INFO_TYPE_MERGE;
}
if (elf_hash_table (info)->merge_info != NULL)
_bfd_merge_sections (obfd, info, elf_hash_table (info)->merge_info,
merge_sections_remove_hook);
return TRUE;
}
/* Create an entry in an ELF linker hash table. */
struct bfd_hash_entry *
_bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
struct bfd_hash_table *table,
const char *string)
{
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (entry == NULL)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
entry = (struct bfd_hash_entry *)
bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
if (entry == NULL)
return entry;
}
/* Call the allocation method of the superclass. */
entry = _bfd_link_hash_newfunc (entry, table, string);
if (entry != NULL)
{
struct elf_link_hash_entry *ret = (struct elf_link_hash_entry *) entry;
struct elf_link_hash_table *htab = (struct elf_link_hash_table *) table;
/* Set local fields. */
ret->indx = -1;
ret->dynindx = -1;
ret->got = htab->init_got_refcount;
ret->plt = htab->init_plt_refcount;
memset (&ret->size, 0, (sizeof (struct elf_link_hash_entry)
- offsetof (struct elf_link_hash_entry, size)));
/* Assume that we have been called by a non-ELF symbol reader.
This flag is then reset by the code which reads an ELF input
file. This ensures that a symbol created by a non-ELF symbol
reader will have the flag set correctly. */
ret->non_elf = 1;
}
return entry;
}
/* Copy data from an indirect symbol to its direct symbol, hiding the
old indirect symbol. Also used for copying flags to a weakdef. */
void
_bfd_elf_link_hash_copy_indirect (struct bfd_link_info *info,
struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *ind)
{
struct elf_link_hash_table *htab;
/* Copy down any references that we may have already seen to the
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
symbol which just became indirect if DIR isn't a hidden versioned
symbol. */
if (dir->versioned != versioned_hidden)
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
{
dir->ref_dynamic |= ind->ref_dynamic;
dir->ref_regular |= ind->ref_regular;
dir->ref_regular_nonweak |= ind->ref_regular_nonweak;
dir->non_got_ref |= ind->non_got_ref;
dir->needs_plt |= ind->needs_plt;
dir->pointer_equality_needed |= ind->pointer_equality_needed;
}
if (ind->root.type != bfd_link_hash_indirect)
return;
/* Copy over the global and procedure linkage table refcount entries.
These may have been already set up by a check_relocs routine. */
htab = elf_hash_table (info);
if (ind->got.refcount > htab->init_got_refcount.refcount)
{
if (dir->got.refcount < 0)
dir->got.refcount = 0;
dir->got.refcount += ind->got.refcount;
ind->got.refcount = htab->init_got_refcount.refcount;
}
if (ind->plt.refcount > htab->init_plt_refcount.refcount)
{
if (dir->plt.refcount < 0)
dir->plt.refcount = 0;
dir->plt.refcount += ind->plt.refcount;
ind->plt.refcount = htab->init_plt_refcount.refcount;
}
if (ind->dynindx != -1)
{
if (dir->dynindx != -1)
_bfd_elf_strtab_delref (htab->dynstr, dir->dynstr_index);
dir->dynindx = ind->dynindx;
dir->dynstr_index = ind->dynstr_index;
ind->dynindx = -1;
ind->dynstr_index = 0;
}
}
void
_bfd_elf_link_hash_hide_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *h,
bfd_boolean force_local)
{
/* STT_GNU_IFUNC symbol must go through PLT. */
if (h->type != STT_GNU_IFUNC)
{
h->plt = elf_hash_table (info)->init_plt_offset;
h->needs_plt = 0;
}
if (force_local)
{
h->forced_local = 1;
if (h->dynindx != -1)
{
h->dynindx = -1;
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
h->dynstr_index);
}
}
}
* coff-arm.c (coff_arm_link_hash_table_create): Use bfd_zmalloc. * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise. * m68klinux.c (linux_link_hash_table_create): Likewise. * sparclinux.c (linux_link_hash_table_create): Likewise. * sunos.c (sunos_link_hash_table_create): Likewise. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise. * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise. * elf32-arm.c (elf32_arm_link_hash_table_create): Likewise. * elf32-avr.c (elf32_avr_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-hppa.c (elf32_hppa_link_hash_table_create): Likewise. * elf32-i386.c (elf_i386_link_hash_table_create): Likewise. * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise. * elf32-m32r.c (m32r_elf_link_hash_table_create): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_create): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-metag.c (elf_metag_link_hash_table_create): Likewise. * elf32-nios2.c (nios2_elf32_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create): Likewise. * elf32-score.c (elf32_score_link_hash_table_create): Likewise. * elf32-spu.c (spu_elf_link_hash_table_create): Likewise. * elf32-tic6x.c (elf32_tic6x_link_hash_table_create): Likewise. * elf32-vax.c (elf_vax_link_hash_table_create): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_create): Likewise. * elf32-xtensa.c (elf_xtensa_link_hash_table_create): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_create): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create): Likewise. * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_create): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise. * elflink.c (_bfd_elf_link_hash_table_create): Likewise. (_bfd_elf_link_hash_table_init): Assume zero fill table on entry.
2013-02-10 05:36:33 +01:00
/* Initialize an ELF linker hash table. *TABLE has been zeroed by our
caller. */
bfd_boolean
_bfd_elf_link_hash_table_init
(struct elf_link_hash_table *table,
bfd *abfd,
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *),
* elf-bfd.h (emum elf_object_id): Rename to elf_target_id. Add entries for other architectures. (struct elf_link_hash_table): Add hash_table_id field. (elf_hash_table_id): New accessor macro. * elflink.c (_bfd_elf_link_hash_table_init): Add target_id parameter. * elf-m10300.c (elf32_mn10300_hash_table): Check table id before returning cast pointer. (elf32_mn10300_link_hash_table_create): Identify new table as containing MN10300 extensions. (mn10300_elf_relax_section): Check pointer returned by elf32_mn10300_hash_table. * elf32-arm.c: Likewise, except using ARM extensions. * elf32-avr.c: Likewise, except using AVR extensions. * elf32-bfin.c: Likewise, except using BFIN extensions. * elf32-cris.c: Likewise, except using CRIS extensions. * elf32-frv.c: Likewise, except using FRV extensions. * elf32-hppa.c: Likewise, except using HPPA32 extensions. * elf32-i386.c: Likewise, except using I386 extensions. * elf32-lm32.c: Likewise, except using LM32 extensions. * elf32-m32r.c: Likewise, except using M32RM extensions. * elf32-m68hc11.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.h: Likewise, except using M68HC11 extensions. * elf32-m68k.c: Likewise, except using M68K extensions. * elf32-microblaze.c: Likewise, except using MICROBLAZE extensions. * elf32-ppc.c: Likewise, except using PPC32 extensions. * elf32-s390.c: Likewise, except using S390 extensions. * elf32-sh.c: Likewise, except using SH extensions. * elf32-spu.c: Likewise, except using SPU extensions. * elf32-xtensa.c: Likewise, except using XTENSA extensions. * elf64-alpha.c: Likewise, except using ALPHA extensions. * elf64-hppa.c: Likewise, except using HPPA64 extensions. * elf64-ppc.c: Likewise, except using PPC64 extensions. * elf64-s390.c: Likewise, except using S390 extensions. * elf64-x86-64.c: Likewise, except using X86_64 extensions. * elfxx-ia64.c: Likewise, except using IA64 extensions. * elfxx-mips.c: Likewise, except using MIPS extensions. * elfxx-sparc.c: Likewise, except using SPARC extensions. * elfxx-sparc.h: Likewise, except using SPARC extensions. * elf32-cr16.c (struct elf32_cr16_link_hash_table): Delete redundant structure. (elf32_cr16_hash_table): Delete unused macro. (elf32_cr16_link_hash_traverse): Delete unused macro. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-vax.c: Likewise. * elf64-sh64.c: Likewise. * emultempl/alphaelf.em: Update value expected from elf_object_id. * emultempl/hppaelf.em: Likewise. * emultempl/mipself.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise.
2010-02-04 10:16:43 +01:00
unsigned int entsize,
enum elf_target_id target_id)
{
bfd_boolean ret;
int can_refcount = get_elf_backend_data (abfd)->can_refcount;
table->init_got_refcount.refcount = can_refcount - 1;
table->init_plt_refcount.refcount = can_refcount - 1;
table->init_got_offset.offset = -(bfd_vma) 1;
table->init_plt_offset.offset = -(bfd_vma) 1;
/* The first dynamic symbol is a dummy. */
table->dynsymcount = 1;
ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
* elf-bfd.h (emum elf_object_id): Rename to elf_target_id. Add entries for other architectures. (struct elf_link_hash_table): Add hash_table_id field. (elf_hash_table_id): New accessor macro. * elflink.c (_bfd_elf_link_hash_table_init): Add target_id parameter. * elf-m10300.c (elf32_mn10300_hash_table): Check table id before returning cast pointer. (elf32_mn10300_link_hash_table_create): Identify new table as containing MN10300 extensions. (mn10300_elf_relax_section): Check pointer returned by elf32_mn10300_hash_table. * elf32-arm.c: Likewise, except using ARM extensions. * elf32-avr.c: Likewise, except using AVR extensions. * elf32-bfin.c: Likewise, except using BFIN extensions. * elf32-cris.c: Likewise, except using CRIS extensions. * elf32-frv.c: Likewise, except using FRV extensions. * elf32-hppa.c: Likewise, except using HPPA32 extensions. * elf32-i386.c: Likewise, except using I386 extensions. * elf32-lm32.c: Likewise, except using LM32 extensions. * elf32-m32r.c: Likewise, except using M32RM extensions. * elf32-m68hc11.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.h: Likewise, except using M68HC11 extensions. * elf32-m68k.c: Likewise, except using M68K extensions. * elf32-microblaze.c: Likewise, except using MICROBLAZE extensions. * elf32-ppc.c: Likewise, except using PPC32 extensions. * elf32-s390.c: Likewise, except using S390 extensions. * elf32-sh.c: Likewise, except using SH extensions. * elf32-spu.c: Likewise, except using SPU extensions. * elf32-xtensa.c: Likewise, except using XTENSA extensions. * elf64-alpha.c: Likewise, except using ALPHA extensions. * elf64-hppa.c: Likewise, except using HPPA64 extensions. * elf64-ppc.c: Likewise, except using PPC64 extensions. * elf64-s390.c: Likewise, except using S390 extensions. * elf64-x86-64.c: Likewise, except using X86_64 extensions. * elfxx-ia64.c: Likewise, except using IA64 extensions. * elfxx-mips.c: Likewise, except using MIPS extensions. * elfxx-sparc.c: Likewise, except using SPARC extensions. * elfxx-sparc.h: Likewise, except using SPARC extensions. * elf32-cr16.c (struct elf32_cr16_link_hash_table): Delete redundant structure. (elf32_cr16_hash_table): Delete unused macro. (elf32_cr16_link_hash_traverse): Delete unused macro. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-vax.c: Likewise. * elf64-sh64.c: Likewise. * emultempl/alphaelf.em: Update value expected from elf_object_id. * emultempl/hppaelf.em: Likewise. * emultempl/mipself.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise.
2010-02-04 10:16:43 +01:00
table->root.type = bfd_link_elf_hash_table;
* elf-bfd.h (emum elf_object_id): Rename to elf_target_id. Add entries for other architectures. (struct elf_link_hash_table): Add hash_table_id field. (elf_hash_table_id): New accessor macro. * elflink.c (_bfd_elf_link_hash_table_init): Add target_id parameter. * elf-m10300.c (elf32_mn10300_hash_table): Check table id before returning cast pointer. (elf32_mn10300_link_hash_table_create): Identify new table as containing MN10300 extensions. (mn10300_elf_relax_section): Check pointer returned by elf32_mn10300_hash_table. * elf32-arm.c: Likewise, except using ARM extensions. * elf32-avr.c: Likewise, except using AVR extensions. * elf32-bfin.c: Likewise, except using BFIN extensions. * elf32-cris.c: Likewise, except using CRIS extensions. * elf32-frv.c: Likewise, except using FRV extensions. * elf32-hppa.c: Likewise, except using HPPA32 extensions. * elf32-i386.c: Likewise, except using I386 extensions. * elf32-lm32.c: Likewise, except using LM32 extensions. * elf32-m32r.c: Likewise, except using M32RM extensions. * elf32-m68hc11.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.h: Likewise, except using M68HC11 extensions. * elf32-m68k.c: Likewise, except using M68K extensions. * elf32-microblaze.c: Likewise, except using MICROBLAZE extensions. * elf32-ppc.c: Likewise, except using PPC32 extensions. * elf32-s390.c: Likewise, except using S390 extensions. * elf32-sh.c: Likewise, except using SH extensions. * elf32-spu.c: Likewise, except using SPU extensions. * elf32-xtensa.c: Likewise, except using XTENSA extensions. * elf64-alpha.c: Likewise, except using ALPHA extensions. * elf64-hppa.c: Likewise, except using HPPA64 extensions. * elf64-ppc.c: Likewise, except using PPC64 extensions. * elf64-s390.c: Likewise, except using S390 extensions. * elf64-x86-64.c: Likewise, except using X86_64 extensions. * elfxx-ia64.c: Likewise, except using IA64 extensions. * elfxx-mips.c: Likewise, except using MIPS extensions. * elfxx-sparc.c: Likewise, except using SPARC extensions. * elfxx-sparc.h: Likewise, except using SPARC extensions. * elf32-cr16.c (struct elf32_cr16_link_hash_table): Delete redundant structure. (elf32_cr16_hash_table): Delete unused macro. (elf32_cr16_link_hash_traverse): Delete unused macro. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-vax.c: Likewise. * elf64-sh64.c: Likewise. * emultempl/alphaelf.em: Update value expected from elf_object_id. * emultempl/hppaelf.em: Likewise. * emultempl/mipself.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise.
2010-02-04 10:16:43 +01:00
table->hash_table_id = target_id;
return ret;
}
/* Create an ELF linker hash table. */
struct bfd_link_hash_table *
_bfd_elf_link_hash_table_create (bfd *abfd)
{
struct elf_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_link_hash_table);
* coff-arm.c (coff_arm_link_hash_table_create): Use bfd_zmalloc. * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise. * m68klinux.c (linux_link_hash_table_create): Likewise. * sparclinux.c (linux_link_hash_table_create): Likewise. * sunos.c (sunos_link_hash_table_create): Likewise. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise. * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise. * elf32-arm.c (elf32_arm_link_hash_table_create): Likewise. * elf32-avr.c (elf32_avr_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-hppa.c (elf32_hppa_link_hash_table_create): Likewise. * elf32-i386.c (elf_i386_link_hash_table_create): Likewise. * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise. * elf32-m32r.c (m32r_elf_link_hash_table_create): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_create): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-metag.c (elf_metag_link_hash_table_create): Likewise. * elf32-nios2.c (nios2_elf32_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create): Likewise. * elf32-score.c (elf32_score_link_hash_table_create): Likewise. * elf32-spu.c (spu_elf_link_hash_table_create): Likewise. * elf32-tic6x.c (elf32_tic6x_link_hash_table_create): Likewise. * elf32-vax.c (elf_vax_link_hash_table_create): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_create): Likewise. * elf32-xtensa.c (elf_xtensa_link_hash_table_create): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_create): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create): Likewise. * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_create): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise. * elflink.c (_bfd_elf_link_hash_table_create): Likewise. (_bfd_elf_link_hash_table_init): Assume zero fill table on entry.
2013-02-10 05:36:33 +01:00
ret = (struct elf_link_hash_table *) bfd_zmalloc (amt);
if (ret == NULL)
return NULL;
if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc,
* elf-bfd.h (emum elf_object_id): Rename to elf_target_id. Add entries for other architectures. (struct elf_link_hash_table): Add hash_table_id field. (elf_hash_table_id): New accessor macro. * elflink.c (_bfd_elf_link_hash_table_init): Add target_id parameter. * elf-m10300.c (elf32_mn10300_hash_table): Check table id before returning cast pointer. (elf32_mn10300_link_hash_table_create): Identify new table as containing MN10300 extensions. (mn10300_elf_relax_section): Check pointer returned by elf32_mn10300_hash_table. * elf32-arm.c: Likewise, except using ARM extensions. * elf32-avr.c: Likewise, except using AVR extensions. * elf32-bfin.c: Likewise, except using BFIN extensions. * elf32-cris.c: Likewise, except using CRIS extensions. * elf32-frv.c: Likewise, except using FRV extensions. * elf32-hppa.c: Likewise, except using HPPA32 extensions. * elf32-i386.c: Likewise, except using I386 extensions. * elf32-lm32.c: Likewise, except using LM32 extensions. * elf32-m32r.c: Likewise, except using M32RM extensions. * elf32-m68hc11.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.c: Likewise, except using M68HC11 extensions. * elf32-m68hc1x.h: Likewise, except using M68HC11 extensions. * elf32-m68k.c: Likewise, except using M68K extensions. * elf32-microblaze.c: Likewise, except using MICROBLAZE extensions. * elf32-ppc.c: Likewise, except using PPC32 extensions. * elf32-s390.c: Likewise, except using S390 extensions. * elf32-sh.c: Likewise, except using SH extensions. * elf32-spu.c: Likewise, except using SPU extensions. * elf32-xtensa.c: Likewise, except using XTENSA extensions. * elf64-alpha.c: Likewise, except using ALPHA extensions. * elf64-hppa.c: Likewise, except using HPPA64 extensions. * elf64-ppc.c: Likewise, except using PPC64 extensions. * elf64-s390.c: Likewise, except using S390 extensions. * elf64-x86-64.c: Likewise, except using X86_64 extensions. * elfxx-ia64.c: Likewise, except using IA64 extensions. * elfxx-mips.c: Likewise, except using MIPS extensions. * elfxx-sparc.c: Likewise, except using SPARC extensions. * elfxx-sparc.h: Likewise, except using SPARC extensions. * elf32-cr16.c (struct elf32_cr16_link_hash_table): Delete redundant structure. (elf32_cr16_hash_table): Delete unused macro. (elf32_cr16_link_hash_traverse): Delete unused macro. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf32-vax.c: Likewise. * elf64-sh64.c: Likewise. * emultempl/alphaelf.em: Update value expected from elf_object_id. * emultempl/hppaelf.em: Likewise. * emultempl/mipself.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise.
2010-02-04 10:16:43 +01:00
sizeof (struct elf_link_hash_entry),
GENERIC_ELF_DATA))
{
free (ret);
return NULL;
}
Free linker hash table from bfd_close. Also tidies numerous error exit paths in various link_hash_table_create functions that failed to free memory. include/ * bfdlink.h (struct bfd_link_hash_table): Add hash_table_free field. bfd/ * archive.c: Include bfdlink.h. (_bfd_archive_close_and_cleanup): Call linker hash_table_free. * bfd.c (struct bfd): Add is_linker_output field. * elf-bfd.h (_bfd_elf_link_hash_table_free): Update prototype. * linker.c (_bfd_link_hash_table_init): Set up hash_table_free, link.hash and is_linker_output. (_bfd_generic_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. Assert is_linker_output and link.hash, and clear them before exit. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. Hack is_linker_output and link.hash so we can free two linker hash tables. (elf32_mn10300_link_hash_table_create): Create static_hash_table first. Clean up on errors. Set hash_table_free pointer. * elf32-arm.c (elf32_arm_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. (elf32_arm_link_hash_table_create): Clean up on errors. Set hash_table_free pointer. * elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-sparc.c, * xcofflink.c: Similarly. * simple.c (bfd_simple_get_relocated_section_contents): Save and clear link.next before creating linker hash table. Clean up on errors, and restore link.next on exit. * elf32-m68hc1x.h (m68hc11_elf_bfd_link_hash_table_free): Delete. * elf32-xgate.h (xgate_elf_bfd_link_hash_table_free): Delete. * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table_free): Delete. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Delete. * hash.c (bfd_hash_table_init_n): Free table on error. * libbfd-in.h (_bfd_generic_link_hash_table_free): Update proto. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-06-13 11:41:39 +02:00
ret->root.hash_table_free = _bfd_elf_link_hash_table_free;
return &ret->root;
}
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
/* Destroy an ELF linker hash table. */
void
Free linker hash table from bfd_close. Also tidies numerous error exit paths in various link_hash_table_create functions that failed to free memory. include/ * bfdlink.h (struct bfd_link_hash_table): Add hash_table_free field. bfd/ * archive.c: Include bfdlink.h. (_bfd_archive_close_and_cleanup): Call linker hash_table_free. * bfd.c (struct bfd): Add is_linker_output field. * elf-bfd.h (_bfd_elf_link_hash_table_free): Update prototype. * linker.c (_bfd_link_hash_table_init): Set up hash_table_free, link.hash and is_linker_output. (_bfd_generic_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. Assert is_linker_output and link.hash, and clear them before exit. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. Hack is_linker_output and link.hash so we can free two linker hash tables. (elf32_mn10300_link_hash_table_create): Create static_hash_table first. Clean up on errors. Set hash_table_free pointer. * elf32-arm.c (elf32_arm_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. (elf32_arm_link_hash_table_create): Clean up on errors. Set hash_table_free pointer. * elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-sparc.c, * xcofflink.c: Similarly. * simple.c (bfd_simple_get_relocated_section_contents): Save and clear link.next before creating linker hash table. Clean up on errors, and restore link.next on exit. * elf32-m68hc1x.h (m68hc11_elf_bfd_link_hash_table_free): Delete. * elf32-xgate.h (xgate_elf_bfd_link_hash_table_free): Delete. * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table_free): Delete. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Delete. * hash.c (bfd_hash_table_init_n): Free table on error. * libbfd-in.h (_bfd_generic_link_hash_table_free): Update proto. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-06-13 11:41:39 +02:00
_bfd_elf_link_hash_table_free (bfd *obfd)
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
{
Free linker hash table from bfd_close. Also tidies numerous error exit paths in various link_hash_table_create functions that failed to free memory. include/ * bfdlink.h (struct bfd_link_hash_table): Add hash_table_free field. bfd/ * archive.c: Include bfdlink.h. (_bfd_archive_close_and_cleanup): Call linker hash_table_free. * bfd.c (struct bfd): Add is_linker_output field. * elf-bfd.h (_bfd_elf_link_hash_table_free): Update prototype. * linker.c (_bfd_link_hash_table_init): Set up hash_table_free, link.hash and is_linker_output. (_bfd_generic_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. Assert is_linker_output and link.hash, and clear them before exit. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. Hack is_linker_output and link.hash so we can free two linker hash tables. (elf32_mn10300_link_hash_table_create): Create static_hash_table first. Clean up on errors. Set hash_table_free pointer. * elf32-arm.c (elf32_arm_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. (elf32_arm_link_hash_table_create): Clean up on errors. Set hash_table_free pointer. * elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-sparc.c, * xcofflink.c: Similarly. * simple.c (bfd_simple_get_relocated_section_contents): Save and clear link.next before creating linker hash table. Clean up on errors, and restore link.next on exit. * elf32-m68hc1x.h (m68hc11_elf_bfd_link_hash_table_free): Delete. * elf32-xgate.h (xgate_elf_bfd_link_hash_table_free): Delete. * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table_free): Delete. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Delete. * hash.c (bfd_hash_table_init_n): Free table on error. * libbfd-in.h (_bfd_generic_link_hash_table_free): Update proto. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-06-13 11:41:39 +02:00
struct elf_link_hash_table *htab;
htab = (struct elf_link_hash_table *) obfd->link.hash;
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
if (htab->dynstr != NULL)
_bfd_elf_strtab_free (htab->dynstr);
_bfd_merge_sections_free (htab->merge_info);
Free linker hash table from bfd_close. Also tidies numerous error exit paths in various link_hash_table_create functions that failed to free memory. include/ * bfdlink.h (struct bfd_link_hash_table): Add hash_table_free field. bfd/ * archive.c: Include bfdlink.h. (_bfd_archive_close_and_cleanup): Call linker hash_table_free. * bfd.c (struct bfd): Add is_linker_output field. * elf-bfd.h (_bfd_elf_link_hash_table_free): Update prototype. * linker.c (_bfd_link_hash_table_init): Set up hash_table_free, link.hash and is_linker_output. (_bfd_generic_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. Assert is_linker_output and link.hash, and clear them before exit. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. Hack is_linker_output and link.hash so we can free two linker hash tables. (elf32_mn10300_link_hash_table_create): Create static_hash_table first. Clean up on errors. Set hash_table_free pointer. * elf32-arm.c (elf32_arm_link_hash_table_free): Replace bfd_link_hash_table* param with bfd*. (elf32_arm_link_hash_table_create): Clean up on errors. Set hash_table_free pointer. * elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-sparc.c, * xcofflink.c: Similarly. * simple.c (bfd_simple_get_relocated_section_contents): Save and clear link.next before creating linker hash table. Clean up on errors, and restore link.next on exit. * elf32-m68hc1x.h (m68hc11_elf_bfd_link_hash_table_free): Delete. * elf32-xgate.h (xgate_elf_bfd_link_hash_table_free): Delete. * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table_free): Delete. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Delete. * hash.c (bfd_hash_table_init_n): Free table on error. * libbfd-in.h (_bfd_generic_link_hash_table_free): Update proto. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2014-06-13 11:41:39 +02:00
_bfd_generic_link_hash_table_free (obfd);
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
}
/* This is a hook for the ELF emulation code in the generic linker to
tell the backend linker what file name to use for the DT_NEEDED
entry for a dynamic object. */
void
bfd_elf_set_dt_needed_name (bfd *abfd, const char *name)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
elf_dt_name (abfd) = name;
}
int
bfd_elf_get_dyn_lib_class (bfd *abfd)
{
int lib_class;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
lib_class = elf_dyn_lib_class (abfd);
else
lib_class = 0;
return lib_class;
}
void
bfd_elf_set_dyn_lib_class (bfd *abfd, enum dynamic_lib_link_class lib_class)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
elf_dyn_lib_class (abfd) = lib_class;
}
/* Get the list of DT_NEEDED entries for a link. This is a hook for
the linker ELF emulation code. */
struct bfd_link_needed_list *
bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
if (! is_elf_hash_table (info->hash))
return NULL;
return elf_hash_table (info)->needed;
}
/* Get the list of DT_RPATH/DT_RUNPATH entries for a link. This is a
hook for the linker ELF emulation code. */
struct bfd_link_needed_list *
bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
if (! is_elf_hash_table (info->hash))
return NULL;
return elf_hash_table (info)->runpath;
}
/* Get the name actually used for a dynamic object for a link. This
is the SONAME entry if there is one. Otherwise, it is the string
passed to bfd_elf_set_dt_needed_name, or it is the filename. */
const char *
bfd_elf_get_dt_soname (bfd *abfd)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& bfd_get_format (abfd) == bfd_object)
return elf_dt_name (abfd);
return NULL;
}
/* Get the list of DT_NEEDED entries from a BFD. This is a hook for
the ELF linker emulation code. */
bfd_boolean
bfd_elf_get_bfd_needed_list (bfd *abfd,
struct bfd_link_needed_list **pneeded)
{
asection *s;
bfd_byte *dynbuf = NULL;
unsigned int elfsec;
unsigned long shlink;
bfd_byte *extdyn, *extdynend;
size_t extdynsize;
void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *);
*pneeded = NULL;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour
|| bfd_get_format (abfd) != bfd_object)
return TRUE;
s = bfd_get_section_by_name (abfd, ".dynamic");
if (s == NULL || s->size == 0)
return TRUE;
if (!bfd_malloc_and_get_section (abfd, s, &dynbuf))
goto error_return;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
if (elfsec == SHN_BAD)
goto error_return;
shlink = elf_elfsections (abfd)[elfsec]->sh_link;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn;
swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in;
extdyn = dynbuf;
extdynend = extdyn + s->size;
for (; extdyn < extdynend; extdyn += extdynsize)
{
Elf_Internal_Dyn dyn;
(*swap_dyn_in) (abfd, extdyn, &dyn);
if (dyn.d_tag == DT_NULL)
break;
if (dyn.d_tag == DT_NEEDED)
{
const char *string;
struct bfd_link_needed_list *l;
unsigned int tagv = dyn.d_un.d_val;
bfd_size_type amt;
string = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (string == NULL)
goto error_return;
amt = sizeof *l;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
l = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
if (l == NULL)
goto error_return;
l->by = abfd;
l->name = string;
l->next = *pneeded;
*pneeded = l;
}
}
free (dynbuf);
return TRUE;
error_return:
if (dynbuf != NULL)
free (dynbuf);
return FALSE;
}
struct elf_symbuf_symbol
{
unsigned long st_name; /* Symbol name, index in string tbl */
unsigned char st_info; /* Type and binding attributes */
unsigned char st_other; /* Visibilty, and target specific */
};
struct elf_symbuf_head
{
struct elf_symbuf_symbol *ssym;
bfd_size_type count;
unsigned int st_shndx;
};
struct elf_symbol
{
union
{
Elf_Internal_Sym *isym;
struct elf_symbuf_symbol *ssym;
} u;
const char *name;
};
/* Sort references to symbols by ascending section number. */
static int
elf_sort_elf_symbol (const void *arg1, const void *arg2)
{
const Elf_Internal_Sym *s1 = *(const Elf_Internal_Sym **) arg1;
const Elf_Internal_Sym *s2 = *(const Elf_Internal_Sym **) arg2;
return s1->st_shndx - s2->st_shndx;
}
static int
elf_sym_name_compare (const void *arg1, const void *arg2)
{
const struct elf_symbol *s1 = (const struct elf_symbol *) arg1;
const struct elf_symbol *s2 = (const struct elf_symbol *) arg2;
return strcmp (s1->name, s2->name);
}
static struct elf_symbuf_head *
elf_create_symbuf (bfd_size_type symcount, Elf_Internal_Sym *isymbuf)
{
Elf_Internal_Sym **ind, **indbufend, **indbuf;
struct elf_symbuf_symbol *ssym;
struct elf_symbuf_head *ssymbuf, *ssymhead;
bfd_size_type i, shndx_count, total_size;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
indbuf = (Elf_Internal_Sym **) bfd_malloc2 (symcount, sizeof (*indbuf));
if (indbuf == NULL)
return NULL;
for (ind = indbuf, i = 0; i < symcount; i++)
if (isymbuf[i].st_shndx != SHN_UNDEF)
*ind++ = &isymbuf[i];
indbufend = ind;
qsort (indbuf, indbufend - indbuf, sizeof (Elf_Internal_Sym *),
elf_sort_elf_symbol);
shndx_count = 0;
if (indbufend > indbuf)
for (ind = indbuf, shndx_count++; ind < indbufend - 1; ind++)
if (ind[0]->st_shndx != ind[1]->st_shndx)
shndx_count++;
total_size = ((shndx_count + 1) * sizeof (*ssymbuf)
+ (indbufend - indbuf) * sizeof (*ssym));
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
ssymbuf = (struct elf_symbuf_head *) bfd_malloc (total_size);
if (ssymbuf == NULL)
{
free (indbuf);
return NULL;
}
ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count + 1);
ssymbuf->ssym = NULL;
ssymbuf->count = shndx_count;
ssymbuf->st_shndx = 0;
for (ssymhead = ssymbuf, ind = indbuf; ind < indbufend; ssym++, ind++)
{
if (ind == indbuf || ssymhead->st_shndx != (*ind)->st_shndx)
{
ssymhead++;
ssymhead->ssym = ssym;
ssymhead->count = 0;
ssymhead->st_shndx = (*ind)->st_shndx;
}
ssym->st_name = (*ind)->st_name;
ssym->st_info = (*ind)->st_info;
ssym->st_other = (*ind)->st_other;
ssymhead->count++;
}
BFD_ASSERT ((bfd_size_type) (ssymhead - ssymbuf) == shndx_count
&& (((bfd_hostptr_t) ssym - (bfd_hostptr_t) ssymbuf)
== total_size));
free (indbuf);
return ssymbuf;
}
/* Check if 2 sections define the same set of local and global
symbols. */
static bfd_boolean
bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
struct bfd_link_info *info)
{
bfd *bfd1, *bfd2;
const struct elf_backend_data *bed1, *bed2;
Elf_Internal_Shdr *hdr1, *hdr2;
bfd_size_type symcount1, symcount2;
Elf_Internal_Sym *isymbuf1, *isymbuf2;
struct elf_symbuf_head *ssymbuf1, *ssymbuf2;
Elf_Internal_Sym *isym, *isymend;
struct elf_symbol *symtable1 = NULL, *symtable2 = NULL;
bfd_size_type count1, count2, i;
unsigned int shndx1, shndx2;
bfd_boolean result;
bfd1 = sec1->owner;
bfd2 = sec2->owner;
/* Both sections have to be in ELF. */
if (bfd_get_flavour (bfd1) != bfd_target_elf_flavour
|| bfd_get_flavour (bfd2) != bfd_target_elf_flavour)
return FALSE;
if (elf_section_type (sec1) != elf_section_type (sec2))
return FALSE;
shndx1 = _bfd_elf_section_from_bfd_section (bfd1, sec1);
shndx2 = _bfd_elf_section_from_bfd_section (bfd2, sec2);
if (shndx1 == SHN_BAD || shndx2 == SHN_BAD)
return FALSE;
bed1 = get_elf_backend_data (bfd1);
bed2 = get_elf_backend_data (bfd2);
hdr1 = &elf_tdata (bfd1)->symtab_hdr;
symcount1 = hdr1->sh_size / bed1->s->sizeof_sym;
hdr2 = &elf_tdata (bfd2)->symtab_hdr;
symcount2 = hdr2->sh_size / bed2->s->sizeof_sym;
if (symcount1 == 0 || symcount2 == 0)
return FALSE;
result = FALSE;
isymbuf1 = NULL;
isymbuf2 = NULL;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
ssymbuf1 = (struct elf_symbuf_head *) elf_tdata (bfd1)->symbuf;
ssymbuf2 = (struct elf_symbuf_head *) elf_tdata (bfd2)->symbuf;
if (ssymbuf1 == NULL)
{
isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0,
NULL, NULL, NULL);
if (isymbuf1 == NULL)
goto done;
if (!info->reduce_memory_overheads)
elf_tdata (bfd1)->symbuf = ssymbuf1
= elf_create_symbuf (symcount1, isymbuf1);
}
if (ssymbuf1 == NULL || ssymbuf2 == NULL)
{
isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0,
NULL, NULL, NULL);
if (isymbuf2 == NULL)
goto done;
if (ssymbuf1 != NULL && !info->reduce_memory_overheads)
elf_tdata (bfd2)->symbuf = ssymbuf2
= elf_create_symbuf (symcount2, isymbuf2);
}
if (ssymbuf1 != NULL && ssymbuf2 != NULL)
{
/* Optimized faster version. */
bfd_size_type lo, hi, mid;
struct elf_symbol *symp;
struct elf_symbuf_symbol *ssym, *ssymend;
lo = 0;
hi = ssymbuf1->count;
ssymbuf1++;
count1 = 0;
while (lo < hi)
{
mid = (lo + hi) / 2;
if (shndx1 < ssymbuf1[mid].st_shndx)
hi = mid;
else if (shndx1 > ssymbuf1[mid].st_shndx)
lo = mid + 1;
else
{
count1 = ssymbuf1[mid].count;
ssymbuf1 += mid;
break;
}
}
lo = 0;
hi = ssymbuf2->count;
ssymbuf2++;
count2 = 0;
while (lo < hi)
{
mid = (lo + hi) / 2;
if (shndx2 < ssymbuf2[mid].st_shndx)
hi = mid;
else if (shndx2 > ssymbuf2[mid].st_shndx)
lo = mid + 1;
else
{
count2 = ssymbuf2[mid].count;
ssymbuf2 += mid;
break;
}
}
if (count1 == 0 || count2 == 0 || count1 != count2)
goto done;
symtable1
= (struct elf_symbol *) bfd_malloc (count1 * sizeof (*symtable1));
symtable2
= (struct elf_symbol *) bfd_malloc (count2 * sizeof (*symtable2));
if (symtable1 == NULL || symtable2 == NULL)
goto done;
symp = symtable1;
for (ssym = ssymbuf1->ssym, ssymend = ssym + count1;
ssym < ssymend; ssym++, symp++)
{
symp->u.ssym = ssym;
symp->name = bfd_elf_string_from_elf_section (bfd1,
hdr1->sh_link,
ssym->st_name);
}
symp = symtable2;
for (ssym = ssymbuf2->ssym, ssymend = ssym + count2;
ssym < ssymend; ssym++, symp++)
{
symp->u.ssym = ssym;
symp->name = bfd_elf_string_from_elf_section (bfd2,
hdr2->sh_link,
ssym->st_name);
}
/* Sort symbol by name. */
qsort (symtable1, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
qsort (symtable2, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
for (i = 0; i < count1; i++)
/* Two symbols must have the same binding, type and name. */
if (symtable1 [i].u.ssym->st_info != symtable2 [i].u.ssym->st_info
|| symtable1 [i].u.ssym->st_other != symtable2 [i].u.ssym->st_other
|| strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
goto done;
result = TRUE;
goto done;
}
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
symtable1 = (struct elf_symbol *)
bfd_malloc (symcount1 * sizeof (struct elf_symbol));
symtable2 = (struct elf_symbol *)
bfd_malloc (symcount2 * sizeof (struct elf_symbol));
if (symtable1 == NULL || symtable2 == NULL)
goto done;
/* Count definitions in the section. */
count1 = 0;
for (isym = isymbuf1, isymend = isym + symcount1; isym < isymend; isym++)
if (isym->st_shndx == shndx1)
symtable1[count1++].u.isym = isym;
count2 = 0;
for (isym = isymbuf2, isymend = isym + symcount2; isym < isymend; isym++)
if (isym->st_shndx == shndx2)
symtable2[count2++].u.isym = isym;
if (count1 == 0 || count2 == 0 || count1 != count2)
goto done;
for (i = 0; i < count1; i++)
symtable1[i].name
= bfd_elf_string_from_elf_section (bfd1, hdr1->sh_link,
symtable1[i].u.isym->st_name);
for (i = 0; i < count2; i++)
symtable2[i].name
= bfd_elf_string_from_elf_section (bfd2, hdr2->sh_link,
symtable2[i].u.isym->st_name);
/* Sort symbol by name. */
qsort (symtable1, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
qsort (symtable2, count1, sizeof (struct elf_symbol),
elf_sym_name_compare);
for (i = 0; i < count1; i++)
/* Two symbols must have the same binding, type and name. */
if (symtable1 [i].u.isym->st_info != symtable2 [i].u.isym->st_info
|| symtable1 [i].u.isym->st_other != symtable2 [i].u.isym->st_other
|| strcmp (symtable1 [i].name, symtable2 [i].name) != 0)
goto done;
result = TRUE;
done:
if (symtable1)
free (symtable1);
if (symtable2)
free (symtable2);
if (isymbuf1)
free (isymbuf1);
if (isymbuf2)
free (isymbuf2);
return result;
}
/* Return TRUE if 2 section types are compatible. */
bfd_boolean
_bfd_elf_match_sections_by_type (bfd *abfd, const asection *asec,
bfd *bbfd, const asection *bsec)
{
if (asec == NULL
|| bsec == NULL
|| abfd->xvec->flavour != bfd_target_elf_flavour
|| bbfd->xvec->flavour != bfd_target_elf_flavour)
return TRUE;
return elf_section_type (asec) == elf_section_type (bsec);
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Final phase of ELF linker. */
/* A structure we use to avoid passing large numbers of arguments. */
struct elf_final_link_info
{
/* General link information. */
struct bfd_link_info *info;
/* Output BFD. */
bfd *output_bfd;
/* Symbol string table. */
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
struct elf_strtab_hash *symstrtab;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* .hash section. */
asection *hash_sec;
/* symbol version section (.gnu.version). */
asection *symver_sec;
/* Buffer large enough to hold contents of any section. */
bfd_byte *contents;
/* Buffer large enough to hold external relocs of any section. */
void *external_relocs;
/* Buffer large enough to hold internal relocs of any section. */
Elf_Internal_Rela *internal_relocs;
/* Buffer large enough to hold external local symbols of any input
BFD. */
bfd_byte *external_syms;
/* And a buffer for symbol section indices. */
Elf_External_Sym_Shndx *locsym_shndx;
/* Buffer large enough to hold internal local symbols of any input
BFD. */
Elf_Internal_Sym *internal_syms;
/* Array large enough to hold a symbol index for each local symbol
of any input BFD. */
long *indices;
/* Array large enough to hold a section pointer for each local
symbol of any input BFD. */
asection **sections;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
/* Buffer for SHT_SYMTAB_SHNDX section. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
Elf_External_Sym_Shndx *symshndxbuf;
/* Number of STT_FILE syms seen. */
size_t filesym_count;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
};
/* This struct is used to pass information to elf_link_output_extsym. */
struct elf_outext_info
{
bfd_boolean failed;
bfd_boolean localsyms;
ld/ELF: refine fake STT_FILE symbol emission There's no real need to emit these always: They're needed only if we indeed want to emit a localized symbol. Hence defer emission until we at least did the basic early checks that would lead to no such symbol getting emitted. This in particular avoids emitting such a symbol in the majority of (if not all) "ld -r" cases. I hope my set of cross build tests caught all the test cases needing adjustment - please forgive if I missed a few. bfd/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * elflink.c (struct elf_outext_info): Add field file_sym_done. (bfd_elf_final_link): Initialize new field. Move fake STT_FILE symbol emission from here ... (elf_link_output_extsym): ... to here. gas/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * gas/microblaze/relax_size.elf: Drop expectation of no longer present STT_FILE symbol. * gas/microblaze/relax_size2.elf: Likewise. ld/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * ld-cris/tls-e-tpoffcomm1.d: Drop expectation of no longer present STT_FILE symbol. * ld-mmix/bpo-18.d: Likewise. * ld-mmix/bpo-22.d: Likewise. * ld-mmix/greg-6.d: Likewise. * ld-mmix/greg-7.d: Likewise. * ld-mmix/loc4.d: Likewise. * ld-mmix/local1.d: Likewise. * ld-mmix/local3.d: Likewise. * ld-mmix/local5.d: Likewise. * ld-mmix/local7.d: Likewise. * ld-mmix/loct-1.d: Likewise. * ld-sh/sh64/abi32.xd: Likewise. * ld-sh/sh64/abi64.xd: Likewise. * ld-sh/sh64/cmpct1.xd: Likewise. * ld-sh/sh64/crange1.rd: Likewise. * ld-sh/sh64/crange2.rd: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crange3.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-sh/sh64/mix1.xd: Likewise. * ld-sh/sh64/mix2.xd: Likewise. * ld-sh/sh64/shdl32.xd: Likewise. * ld-sh/sh64/shdl64.xd: Likewise.
2013-10-29 17:52:24 +01:00
bfd_boolean file_sym_done;
struct elf_final_link_info *flinfo;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
};
/* Support for evaluating a complex relocation.
Complex relocations are generalized, self-describing relocations. The
implementation of them consists of two parts: complex symbols, and the
2007-09-30 15:43:23 +02:00
relocations themselves.
The relocations are use a reserved elf-wide relocation type code (R_RELC
external / BFD_RELOC_RELC internal) and an encoding of relocation field
information (start bit, end bit, word width, etc) into the addend. This
information is extracted from CGEN-generated operand tables within gas.
Complex symbols are mangled symbols (BSF_RELC external / STT_RELC
internal) representing prefix-notation expressions, including but not
limited to those sorts of expressions normally encoded as addends in the
addend field. The symbol mangling format is:
<node> := <literal>
| <unary-operator> ':' <node>
| <binary-operator> ':' <node> ':' <node>
;
<literal> := 's' <digits=N> ':' <N character symbol name>
| 'S' <digits=N> ':' <N character section name>
| '#' <hexdigits>
;
<binary-operator> := as in C
<unary-operator> := as in C, plus "0-" for unambiguous negation. */
static void
2007-09-30 15:43:23 +02:00
set_symbol_value (bfd *bfd_with_globals,
Elf_Internal_Sym *isymbuf,
size_t locsymcount,
size_t symidx,
bfd_vma val)
{
struct elf_link_hash_entry **sym_hashes;
struct elf_link_hash_entry *h;
size_t extsymoff = locsymcount;
if (symidx < locsymcount)
{
Elf_Internal_Sym *sym;
sym = isymbuf + symidx;
if (ELF_ST_BIND (sym->st_info) == STB_LOCAL)
{
/* It is a local symbol: move it to the
"absolute" section and give it a value. */
sym->st_shndx = SHN_ABS;
sym->st_value = val;
return;
}
BFD_ASSERT (elf_bad_symtab (bfd_with_globals));
extsymoff = 0;
}
/* It is a global symbol: set its link type
to "defined" and give it a value. */
sym_hashes = elf_sym_hashes (bfd_with_globals);
h = sym_hashes [symidx - extsymoff];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
h->root.type = bfd_link_hash_defined;
h->root.u.def.value = val;
h->root.u.def.section = bfd_abs_section_ptr;
}
2007-09-30 15:43:23 +02:00
static bfd_boolean
resolve_symbol (const char *name,
bfd *input_bfd,
struct elf_final_link_info *flinfo,
2007-09-30 15:43:23 +02:00
bfd_vma *result,
Elf_Internal_Sym *isymbuf,
size_t locsymcount)
{
2007-09-30 15:43:23 +02:00
Elf_Internal_Sym *sym;
struct bfd_link_hash_entry *global_entry;
const char *candidate = NULL;
Elf_Internal_Shdr *symtab_hdr;
size_t i;
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
for (i = 0; i < locsymcount; ++ i)
{
sym = isymbuf + i;
if (ELF_ST_BIND (sym->st_info) != STB_LOCAL)
continue;
candidate = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
sym->st_name);
#ifdef DEBUG
printf ("Comparing string: '%s' vs. '%s' = 0x%lx\n",
name, candidate, (unsigned long) sym->st_value);
#endif
if (candidate && strcmp (candidate, name) == 0)
{
asection *sec = flinfo->sections [i];
*result = _bfd_elf_rel_local_sym (input_bfd, sym, &sec, 0);
*result += sec->output_offset + sec->output_section->vma;
#ifdef DEBUG
printf ("Found symbol with value %8.8lx\n",
(unsigned long) *result);
#endif
return TRUE;
}
}
/* Hmm, haven't found it yet. perhaps it is a global. */
global_entry = bfd_link_hash_lookup (flinfo->info->hash, name,
2007-09-30 15:43:23 +02:00
FALSE, FALSE, TRUE);
if (!global_entry)
return FALSE;
2007-09-30 15:43:23 +02:00
if (global_entry->type == bfd_link_hash_defined
|| global_entry->type == bfd_link_hash_defweak)
{
2007-09-30 15:43:23 +02:00
*result = (global_entry->u.def.value
+ global_entry->u.def.section->output_section->vma
+ global_entry->u.def.section->output_offset);
#ifdef DEBUG
printf ("Found GLOBAL symbol '%s' with value %8.8lx\n",
global_entry->root.string, (unsigned long) *result);
#endif
return TRUE;
2007-09-30 15:43:23 +02:00
}
return FALSE;
}
static bfd_boolean
2007-09-30 15:43:23 +02:00
resolve_section (const char *name,
asection *sections,
bfd_vma *result)
{
2007-09-30 15:43:23 +02:00
asection *curr;
unsigned int len;
2007-09-30 15:43:23 +02:00
for (curr = sections; curr; curr = curr->next)
if (strcmp (curr->name, name) == 0)
{
*result = curr->vma;
return TRUE;
}
/* Hmm. still haven't found it. try pseudo-section names. */
2007-09-30 15:43:23 +02:00
for (curr = sections; curr; curr = curr->next)
{
len = strlen (curr->name);
2007-09-30 15:43:23 +02:00
if (len > strlen (name))
continue;
if (strncmp (curr->name, name, len) == 0)
{
if (strncmp (".end", name + len, 4) == 0)
{
*result = curr->vma + curr->size;
return TRUE;
}
/* Insert more pseudo-section names here, if you like. */
}
}
2007-09-30 15:43:23 +02:00
return FALSE;
}
static void
2007-09-30 15:43:23 +02:00
undefined_reference (const char *reftype, const char *name)
{
2007-09-30 15:43:23 +02:00
_bfd_error_handler (_("undefined %s reference in complex symbol: %s"),
reftype, name);
}
static bfd_boolean
2007-09-30 15:43:23 +02:00
eval_symbol (bfd_vma *result,
const char **symp,
bfd *input_bfd,
struct elf_final_link_info *flinfo,
2007-09-30 15:43:23 +02:00
bfd_vma dot,
Elf_Internal_Sym *isymbuf,
size_t locsymcount,
int signed_p)
{
size_t len;
size_t symlen;
2007-09-30 15:43:23 +02:00
bfd_vma a;
bfd_vma b;
char symbuf[4096];
const char *sym = *symp;
2007-09-30 15:43:23 +02:00
const char *symend;
bfd_boolean symbol_is_section = FALSE;
len = strlen (sym);
symend = sym + len;
if (len < 1 || len > sizeof (symbuf))
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
2007-09-30 15:43:23 +02:00
switch (* sym)
{
case '.':
*result = dot;
*symp = sym + 1;
return TRUE;
case '#':
++sym;
*result = strtoul (sym, (char **) symp, 16);
return TRUE;
case 'S':
symbol_is_section = TRUE;
2007-09-30 15:43:23 +02:00
case 's':
++sym;
symlen = strtol (sym, (char **) symp, 10);
sym = *symp + 1; /* Skip the trailing ':'. */
if (symend < sym || symlen + 1 > sizeof (symbuf))
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
memcpy (symbuf, sym, symlen);
2007-09-30 15:43:23 +02:00
symbuf[symlen] = '\0';
*symp = sym + symlen;
2007-09-30 15:43:23 +02:00
/* Is it always possible, with complex symbols, that gas "mis-guessed"
the symbol as a section, or vice-versa. so we're pretty liberal in our
interpretation here; section means "try section first", not "must be a
section", and likewise with symbol. */
2007-09-30 15:43:23 +02:00
if (symbol_is_section)
{
if (!resolve_section (symbuf, flinfo->output_bfd->sections, result)
&& !resolve_symbol (symbuf, input_bfd, flinfo, result,
isymbuf, locsymcount))
{
undefined_reference ("section", symbuf);
return FALSE;
}
2007-09-30 15:43:23 +02:00
}
else
{
if (!resolve_symbol (symbuf, input_bfd, flinfo, result,
isymbuf, locsymcount)
&& !resolve_section (symbuf, flinfo->output_bfd->sections,
result))
{
undefined_reference ("symbol", symbuf);
return FALSE;
}
}
return TRUE;
2007-09-30 15:43:23 +02:00
/* All that remains are operators. */
#define UNARY_OP(op) \
if (strncmp (sym, #op, strlen (#op)) == 0) \
{ \
sym += strlen (#op); \
2007-09-30 15:43:23 +02:00
if (*sym == ':') \
++sym; \
*symp = sym; \
if (!eval_symbol (&a, symp, input_bfd, flinfo, dot, \
isymbuf, locsymcount, signed_p)) \
2007-09-30 15:43:23 +02:00
return FALSE; \
if (signed_p) \
*result = op ((bfd_signed_vma) a); \
2007-09-30 15:43:23 +02:00
else \
*result = op a; \
return TRUE; \
}
#define BINARY_OP(op) \
if (strncmp (sym, #op, strlen (#op)) == 0) \
{ \
sym += strlen (#op); \
2007-09-30 15:43:23 +02:00
if (*sym == ':') \
++sym; \
*symp = sym; \
if (!eval_symbol (&a, symp, input_bfd, flinfo, dot, \
isymbuf, locsymcount, signed_p)) \
2007-09-30 15:43:23 +02:00
return FALSE; \
++*symp; \
if (!eval_symbol (&b, symp, input_bfd, flinfo, dot, \
isymbuf, locsymcount, signed_p)) \
2007-09-30 15:43:23 +02:00
return FALSE; \
if (signed_p) \
*result = ((bfd_signed_vma) a) op ((bfd_signed_vma) b); \
2007-09-30 15:43:23 +02:00
else \
*result = a op b; \
return TRUE; \
}
default:
UNARY_OP (0-);
BINARY_OP (<<);
BINARY_OP (>>);
BINARY_OP (==);
BINARY_OP (!=);
BINARY_OP (<=);
BINARY_OP (>=);
BINARY_OP (&&);
BINARY_OP (||);
UNARY_OP (~);
UNARY_OP (!);
BINARY_OP (*);
BINARY_OP (/);
BINARY_OP (%);
BINARY_OP (^);
BINARY_OP (|);
BINARY_OP (&);
BINARY_OP (+);
BINARY_OP (-);
BINARY_OP (<);
BINARY_OP (>);
#undef UNARY_OP
#undef BINARY_OP
_bfd_error_handler (_("unknown operator '%c' in complex symbol"), * sym);
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
}
static void
2007-09-30 15:43:23 +02:00
put_value (bfd_vma size,
unsigned long chunksz,
bfd *input_bfd,
bfd_vma x,
bfd_byte *location)
{
location += (size - chunksz);
for (; size; size -= chunksz, location -= chunksz)
{
switch (chunksz)
{
case 1:
bfd_put_8 (input_bfd, x, location);
x >>= 8;
break;
case 2:
bfd_put_16 (input_bfd, x, location);
x >>= 16;
break;
case 4:
bfd_put_32 (input_bfd, x, location);
/* Computed this way because x >>= 32 is undefined if x is a 32-bit value. */
x >>= 16;
x >>= 16;
break;
#ifdef BFD64
case 8:
bfd_put_64 (input_bfd, x, location);
/* Computed this way because x >>= 64 is undefined if x is a 64-bit value. */
x >>= 32;
x >>= 32;
break;
#endif
default:
abort ();
break;
}
}
}
2007-09-30 15:43:23 +02:00
static bfd_vma
get_value (bfd_vma size,
unsigned long chunksz,
bfd *input_bfd,
bfd_byte *location)
{
int shift;
bfd_vma x = 0;
/* Sanity checks. */
BFD_ASSERT (chunksz <= sizeof (x)
&& size >= chunksz
&& chunksz != 0
&& (size % chunksz) == 0
&& input_bfd != NULL
&& location != NULL);
if (chunksz == sizeof (x))
{
BFD_ASSERT (size == chunksz);
/* Make sure that we do not perform an undefined shift operation.
We know that size == chunksz so there will only be one iteration
of the loop below. */
shift = 0;
}
else
shift = 8 * chunksz;
2007-09-30 15:43:23 +02:00
for (; size; size -= chunksz, location += chunksz)
{
switch (chunksz)
{
case 1:
x = (x << shift) | bfd_get_8 (input_bfd, location);
break;
case 2:
x = (x << shift) | bfd_get_16 (input_bfd, location);
break;
case 4:
x = (x << shift) | bfd_get_32 (input_bfd, location);
break;
#ifdef BFD64
case 8:
x = (x << shift) | bfd_get_64 (input_bfd, location);
break;
#endif
default:
abort ();
}
}
return x;
}
2007-09-30 15:43:23 +02:00
static void
decode_complex_addend (unsigned long *start, /* in bits */
unsigned long *oplen, /* in bits */
unsigned long *len, /* in bits */
unsigned long *wordsz, /* in bytes */
unsigned long *chunksz, /* in bytes */
unsigned long *lsb0_p,
unsigned long *signed_p,
unsigned long *trunc_p,
unsigned long encoded)
{
* start = encoded & 0x3F;
* len = (encoded >> 6) & 0x3F;
* oplen = (encoded >> 12) & 0x3F;
* wordsz = (encoded >> 18) & 0xF;
* chunksz = (encoded >> 22) & 0xF;
* lsb0_p = (encoded >> 27) & 1;
* signed_p = (encoded >> 28) & 1;
* trunc_p = (encoded >> 29) & 1;
}
bfd_reloc_status_type
bfd_elf_perform_complex_relocation (bfd *input_bfd,
asection *input_section ATTRIBUTE_UNUSED,
bfd_byte *contents,
Elf_Internal_Rela *rel,
bfd_vma relocation)
{
bfd_vma shift, x, mask;
unsigned long start, oplen, len, wordsz, chunksz, lsb0_p, signed_p, trunc_p;
bfd_reloc_status_type r;
/* Perform this reloc, since it is complex.
(this is not to say that it necessarily refers to a complex
symbol; merely that it is a self-describing CGEN based reloc.
i.e. the addend has the complete reloc information (bit start, end,
2007-09-30 15:43:23 +02:00
word size, etc) encoded within it.). */
2007-09-30 15:43:23 +02:00
decode_complex_addend (&start, &oplen, &len, &wordsz,
&chunksz, &lsb0_p, &signed_p,
&trunc_p, rel->r_addend);
mask = (((1L << (len - 1)) - 1) << 1) | 1;
if (lsb0_p)
shift = (start + 1) - len;
else
shift = (8 * wordsz) - (start + len);
/* FIXME: octets_per_byte. */
2007-09-30 15:43:23 +02:00
x = get_value (wordsz, chunksz, input_bfd, contents + rel->r_offset);
#ifdef DEBUG
printf ("Doing complex reloc: "
"lsb0? %ld, signed? %ld, trunc? %ld, wordsz %ld, "
"chunksz %ld, start %ld, len %ld, oplen %ld\n"
" dest: %8.8lx, mask: %8.8lx, reloc: %8.8lx\n",
lsb0_p, signed_p, trunc_p, wordsz, chunksz, start, len,
2010-10-08 16:00:50 +02:00
oplen, (unsigned long) x, (unsigned long) mask,
(unsigned long) relocation);
#endif
r = bfd_reloc_ok;
if (! trunc_p)
/* Now do an overflow check. */
r = bfd_check_overflow ((signed_p
? complain_overflow_signed
: complain_overflow_unsigned),
len, 0, (8 * wordsz),
relocation);
2007-09-30 15:43:23 +02:00
/* Do the deed. */
x = (x & ~(mask << shift)) | ((relocation & mask) << shift);
#ifdef DEBUG
printf (" relocation: %8.8lx\n"
" shifted mask: %8.8lx\n"
" shifted/masked reloc: %8.8lx\n"
" result: %8.8lx\n",
2010-10-08 16:00:50 +02:00
(unsigned long) relocation, (unsigned long) (mask << shift),
(unsigned long) ((relocation & mask) << shift), (unsigned long) x);
#endif
/* FIXME: octets_per_byte. */
put_value (wordsz, chunksz, input_bfd, x, contents + rel->r_offset);
return r;
}
/* Functions to read r_offset from external (target order) reloc
entry. Faster than bfd_getl32 et al, because we let the compiler
know the value is aligned. */
static bfd_vma
ext32l_r_offset (const void *p)
{
union aligned32
{
uint32_t v;
unsigned char c[4];
};
const union aligned32 *a
= (const union aligned32 *) &((const Elf32_External_Rel *) p)->r_offset;
uint32_t aval = ( (uint32_t) a->c[0]
| (uint32_t) a->c[1] << 8
| (uint32_t) a->c[2] << 16
| (uint32_t) a->c[3] << 24);
return aval;
}
static bfd_vma
ext32b_r_offset (const void *p)
{
union aligned32
{
uint32_t v;
unsigned char c[4];
};
const union aligned32 *a
= (const union aligned32 *) &((const Elf32_External_Rel *) p)->r_offset;
uint32_t aval = ( (uint32_t) a->c[0] << 24
| (uint32_t) a->c[1] << 16
| (uint32_t) a->c[2] << 8
| (uint32_t) a->c[3]);
return aval;
}
#ifdef BFD_HOST_64_BIT
static bfd_vma
ext64l_r_offset (const void *p)
{
union aligned64
{
uint64_t v;
unsigned char c[8];
};
const union aligned64 *a
= (const union aligned64 *) &((const Elf64_External_Rel *) p)->r_offset;
uint64_t aval = ( (uint64_t) a->c[0]
| (uint64_t) a->c[1] << 8
| (uint64_t) a->c[2] << 16
| (uint64_t) a->c[3] << 24
| (uint64_t) a->c[4] << 32
| (uint64_t) a->c[5] << 40
| (uint64_t) a->c[6] << 48
| (uint64_t) a->c[7] << 56);
return aval;
}
static bfd_vma
ext64b_r_offset (const void *p)
{
union aligned64
{
uint64_t v;
unsigned char c[8];
};
const union aligned64 *a
= (const union aligned64 *) &((const Elf64_External_Rel *) p)->r_offset;
uint64_t aval = ( (uint64_t) a->c[0] << 56
| (uint64_t) a->c[1] << 48
| (uint64_t) a->c[2] << 40
| (uint64_t) a->c[3] << 32
| (uint64_t) a->c[4] << 24
| (uint64_t) a->c[5] << 16
| (uint64_t) a->c[6] << 8
| (uint64_t) a->c[7]);
return aval;
}
#endif
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* When performing a relocatable link, the input relocations are
preserved. But, if they reference global symbols, the indices
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
referenced must be updated. Update all the relocations found in
RELDATA. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
static bfd_boolean
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
elf_link_adjust_relocs (bfd *abfd,
struct bfd_elf_section_reloc_data *reldata,
bfd_boolean sort)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
unsigned int i;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_byte *erela;
void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
bfd_vma r_type_mask;
int r_sym_shift;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
unsigned int count = reldata->count;
struct elf_link_hash_entry **rel_hash = reldata->hashes;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (reldata->hdr->sh_entsize == bed->s->sizeof_rel)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
swap_in = bed->s->swap_reloc_in;
swap_out = bed->s->swap_reloc_out;
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
else if (reldata->hdr->sh_entsize == bed->s->sizeof_rela)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
swap_in = bed->s->swap_reloca_in;
swap_out = bed->s->swap_reloca_out;
}
else
abort ();
if (bed->s->int_rels_per_ext_rel > MAX_INT_RELS_PER_EXT_REL)
abort ();
if (bed->s->arch_size == 32)
{
r_type_mask = 0xff;
r_sym_shift = 8;
}
else
{
r_type_mask = 0xffffffff;
r_sym_shift = 32;
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
erela = reldata->hdr->contents;
for (i = 0; i < count; i++, rel_hash++, erela += reldata->hdr->sh_entsize)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
Elf_Internal_Rela irela[MAX_INT_RELS_PER_EXT_REL];
unsigned int j;
if (*rel_hash == NULL)
continue;
BFD_ASSERT ((*rel_hash)->indx >= 0);
(*swap_in) (abfd, erela, irela);
for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
irela[j].r_info = ((bfd_vma) (*rel_hash)->indx << r_sym_shift
| (irela[j].r_info & r_type_mask));
(*swap_out) (abfd, irela, erela);
}
if (sort && count != 0)
{
bfd_vma (*ext_r_off) (const void *);
bfd_vma r_off;
size_t elt_size;
bfd_byte *base, *end, *p, *loc;
bfd_byte *buf = NULL;
if (bed->s->arch_size == 32)
{
if (abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
ext_r_off = ext32l_r_offset;
else if (abfd->xvec->header_byteorder == BFD_ENDIAN_BIG)
ext_r_off = ext32b_r_offset;
else
abort ();
}
else
{
#ifdef BFD_HOST_64_BIT
if (abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
ext_r_off = ext64l_r_offset;
else if (abfd->xvec->header_byteorder == BFD_ENDIAN_BIG)
ext_r_off = ext64b_r_offset;
else
#endif
abort ();
}
/* Must use a stable sort here. A modified insertion sort,
since the relocs are mostly sorted already. */
elt_size = reldata->hdr->sh_entsize;
base = reldata->hdr->contents;
end = base + count * elt_size;
if (elt_size > sizeof (Elf64_External_Rela))
abort ();
/* Ensure the first element is lowest. This acts as a sentinel,
speeding the main loop below. */
r_off = (*ext_r_off) (base);
for (p = loc = base; (p += elt_size) < end; )
{
bfd_vma r_off2 = (*ext_r_off) (p);
if (r_off > r_off2)
{
r_off = r_off2;
loc = p;
}
}
if (loc != base)
{
/* Don't just swap *base and *loc as that changes the order
of the original base[0] and base[1] if they happen to
have the same r_offset. */
bfd_byte onebuf[sizeof (Elf64_External_Rela)];
memcpy (onebuf, loc, elt_size);
memmove (base + elt_size, base, loc - base);
memcpy (base, onebuf, elt_size);
}
for (p = base + elt_size; (p += elt_size) < end; )
{
/* base to p is sorted, *p is next to insert. */
r_off = (*ext_r_off) (p);
/* Search the sorted region for location to insert. */
loc = p - elt_size;
while (r_off < (*ext_r_off) (loc))
loc -= elt_size;
loc += elt_size;
if (loc != p)
{
/* Chances are there is a run of relocs to insert here,
from one of more input files. Files are not always
linked in order due to the way elf_link_input_bfd is
called. See pr17666. */
size_t sortlen = p - loc;
bfd_vma r_off2 = (*ext_r_off) (loc);
size_t runlen = elt_size;
size_t buf_size = 96 * 1024;
while (p + runlen < end
&& (sortlen <= buf_size
|| runlen + elt_size <= buf_size)
&& r_off2 > (*ext_r_off) (p + runlen))
runlen += elt_size;
if (buf == NULL)
{
buf = bfd_malloc (buf_size);
if (buf == NULL)
return FALSE;
}
if (runlen < sortlen)
{
memcpy (buf, p, runlen);
memmove (loc + runlen, loc, sortlen);
memcpy (loc, buf, runlen);
}
else
{
memcpy (buf, loc, sortlen);
memmove (loc, p, runlen);
memcpy (loc + runlen, buf, sortlen);
}
p += runlen - elt_size;
}
}
/* Hashes are no longer valid. */
free (reldata->hashes);
reldata->hashes = NULL;
free (buf);
}
return TRUE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
struct elf_link_sort_rela
{
union {
bfd_vma offset;
bfd_vma sym_mask;
} u;
enum elf_reloc_type_class type;
/* We use this as an array of size int_rels_per_ext_rel. */
Elf_Internal_Rela rela[1];
};
static int
elf_link_sort_cmp1 (const void *A, const void *B)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
const struct elf_link_sort_rela *a = (const struct elf_link_sort_rela *) A;
const struct elf_link_sort_rela *b = (const struct elf_link_sort_rela *) B;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
int relativea, relativeb;
relativea = a->type == reloc_class_relative;
relativeb = b->type == reloc_class_relative;
if (relativea < relativeb)
return 1;
if (relativea > relativeb)
return -1;
if ((a->rela->r_info & a->u.sym_mask) < (b->rela->r_info & b->u.sym_mask))
return -1;
if ((a->rela->r_info & a->u.sym_mask) > (b->rela->r_info & b->u.sym_mask))
return 1;
if (a->rela->r_offset < b->rela->r_offset)
return -1;
if (a->rela->r_offset > b->rela->r_offset)
return 1;
return 0;
}
static int
elf_link_sort_cmp2 (const void *A, const void *B)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
const struct elf_link_sort_rela *a = (const struct elf_link_sort_rela *) A;
const struct elf_link_sort_rela *b = (const struct elf_link_sort_rela *) B;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (a->type < b->type)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return -1;
if (a->type > b->type)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return 1;
if (a->u.offset < b->u.offset)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return -1;
if (a->u.offset > b->u.offset)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return 1;
if (a->rela->r_offset < b->rela->r_offset)
return -1;
if (a->rela->r_offset > b->rela->r_offset)
return 1;
return 0;
}
static size_t
elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
{
asection *dynamic_relocs;
asection *rela_dyn;
asection *rel_dyn;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_size_type count, size;
size_t i, ret, sort_elt, ext_size;
bfd_byte *sort, *s_non_relative, *p;
struct elf_link_sort_rela *sq;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
int i2e = bed->s->int_rels_per_ext_rel;
void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
struct bfd_link_order *lo;
bfd_vma r_sym_mask;
bfd_boolean use_rela;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Find a dynamic reloc section. */
rela_dyn = bfd_get_section_by_name (abfd, ".rela.dyn");
rel_dyn = bfd_get_section_by_name (abfd, ".rel.dyn");
if (rela_dyn != NULL && rela_dyn->size > 0
&& rel_dyn != NULL && rel_dyn->size > 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd_boolean use_rela_initialised = FALSE;
/* This is just here to stop gcc from complaining.
It's initialization checking code is not perfect. */
use_rela = TRUE;
/* Both sections are present. Examine the sizes
of the indirect sections to help us choose. */
for (lo = rela_dyn->map_head.link_order; lo != NULL; lo = lo->next)
if (lo->type == bfd_indirect_link_order)
{
asection *o = lo->u.indirect.section;
if ((o->size % bed->s->sizeof_rela) == 0)
{
if ((o->size % bed->s->sizeof_rel) == 0)
/* Section size is divisible by both rel and rela sizes.
It is of no help to us. */
;
else
{
/* Section size is only divisible by rela. */
if (use_rela_initialised && (use_rela == FALSE))
{
_bfd_error_handler
(_("%B: Unable to sort relocs - they are in more than one size"), abfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
else
{
use_rela = TRUE;
use_rela_initialised = TRUE;
}
}
}
else if ((o->size % bed->s->sizeof_rel) == 0)
{
/* Section size is only divisible by rel. */
if (use_rela_initialised && (use_rela == TRUE))
{
_bfd_error_handler
(_("%B: Unable to sort relocs - they are in more than one size"), abfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
else
{
use_rela = FALSE;
use_rela_initialised = TRUE;
}
}
else
{
/* The section size is not divisible by either - something is wrong. */
_bfd_error_handler
(_("%B: Unable to sort relocs - they are of an unknown size"), abfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
}
for (lo = rel_dyn->map_head.link_order; lo != NULL; lo = lo->next)
if (lo->type == bfd_indirect_link_order)
{
asection *o = lo->u.indirect.section;
if ((o->size % bed->s->sizeof_rela) == 0)
{
if ((o->size % bed->s->sizeof_rel) == 0)
/* Section size is divisible by both rel and rela sizes.
It is of no help to us. */
;
else
{
/* Section size is only divisible by rela. */
if (use_rela_initialised && (use_rela == FALSE))
{
_bfd_error_handler
(_("%B: Unable to sort relocs - they are in more than one size"), abfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
else
{
use_rela = TRUE;
use_rela_initialised = TRUE;
}
}
}
else if ((o->size % bed->s->sizeof_rel) == 0)
{
/* Section size is only divisible by rel. */
if (use_rela_initialised && (use_rela == TRUE))
{
_bfd_error_handler
(_("%B: Unable to sort relocs - they are in more than one size"), abfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
else
{
use_rela = FALSE;
use_rela_initialised = TRUE;
}
}
else
{
/* The section size is not divisible by either - something is wrong. */
_bfd_error_handler
(_("%B: Unable to sort relocs - they are of an unknown size"), abfd);
bfd_set_error (bfd_error_invalid_operation);
return 0;
}
}
if (! use_rela_initialised)
/* Make a guess. */
use_rela = TRUE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
else if (rela_dyn != NULL && rela_dyn->size > 0)
use_rela = TRUE;
else if (rel_dyn != NULL && rel_dyn->size > 0)
use_rela = FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
else
return 0;
if (use_rela)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
dynamic_relocs = rela_dyn;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
ext_size = bed->s->sizeof_rela;
swap_in = bed->s->swap_reloca_in;
swap_out = bed->s->swap_reloca_out;
}
else
{
dynamic_relocs = rel_dyn;
ext_size = bed->s->sizeof_rel;
swap_in = bed->s->swap_reloc_in;
swap_out = bed->s->swap_reloc_out;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
size = 0;
for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (lo->type == bfd_indirect_link_order)
size += lo->u.indirect.section->size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (size != dynamic_relocs->size)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return 0;
sort_elt = (sizeof (struct elf_link_sort_rela)
+ (i2e - 1) * sizeof (Elf_Internal_Rela));
count = dynamic_relocs->size / ext_size;
if (count == 0)
return 0;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
sort = (bfd_byte *) bfd_zmalloc (sort_elt * count);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (sort == NULL)
{
(*info->callbacks->warning)
(info, _("Not enough memory to sort relocations"), 0, abfd, 0, 0);
return 0;
}
if (bed->s->arch_size == 32)
r_sym_mask = ~(bfd_vma) 0xff;
else
r_sym_mask = ~(bfd_vma) 0xffffffff;
for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (lo->type == bfd_indirect_link_order)
{
bfd_byte *erel, *erelend;
asection *o = lo->u.indirect.section;
if (o->contents == NULL && o->size != 0)
{
/* This is a reloc section that is being handled as a normal
section. See bfd_section_from_shdr. We can't combine
relocs in this case. */
free (sort);
return 0;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
erel = o->contents;
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
erelend = o->contents + o->size;
/* FIXME: octets_per_byte. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
p = sort + o->output_offset / ext_size * sort_elt;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
while (erel < erelend)
{
struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
(*swap_in) (abfd, erel, s->rela);
s->type = (*bed->elf_backend_reloc_type_class) (info, o, s->rela);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
s->u.sym_mask = r_sym_mask;
p += sort_elt;
erel += ext_size;
}
}
qsort (sort, count, sort_elt, elf_link_sort_cmp1);
for (i = 0, p = sort; i < count; i++, p += sort_elt)
{
struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
if (s->type != reloc_class_relative)
break;
}
ret = i;
s_non_relative = p;
sq = (struct elf_link_sort_rela *) s_non_relative;
for (; i < count; i++, p += sort_elt)
{
struct elf_link_sort_rela *sp = (struct elf_link_sort_rela *) p;
if (((sp->rela->r_info ^ sq->rela->r_info) & r_sym_mask) != 0)
sq = sp;
sp->u.offset = sq->rela->r_offset;
}
qsort (s_non_relative, count - ret, sort_elt, elf_link_sort_cmp2);
for (lo = dynamic_relocs->map_head.link_order; lo != NULL; lo = lo->next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (lo->type == bfd_indirect_link_order)
{
bfd_byte *erel, *erelend;
asection *o = lo->u.indirect.section;
erel = o->contents;
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
erelend = o->contents + o->size;
/* FIXME: octets_per_byte. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
p = sort + o->output_offset / ext_size * sort_elt;
while (erel < erelend)
{
struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
(*swap_out) (abfd, s->rela, erel);
p += sort_elt;
erel += ext_size;
}
}
free (sort);
*psec = dynamic_relocs;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return ret;
}
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
/* Add a symbol to the output symbol string table. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
static int
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
elf_link_output_symstrtab (struct elf_final_link_info *flinfo,
const char *name,
Elf_Internal_Sym *elfsym,
asection *input_sec,
struct elf_link_hash_entry *h)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
int (*output_symbol_hook)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
(struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
struct elf_link_hash_entry *);
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
struct elf_link_hash_table *hash_table;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
const struct elf_backend_data *bed;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
bfd_size_type strtabsize;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
BFD_ASSERT (elf_onesymtab (flinfo->output_bfd));
bed = get_elf_backend_data (flinfo->output_bfd);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
output_symbol_hook = bed->elf_backend_link_output_symbol_hook;
if (output_symbol_hook != NULL)
{
int ret = (*output_symbol_hook) (flinfo->info, name, elfsym, input_sec, h);
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
if (ret != 1)
return ret;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
if (name == NULL
|| *name == '\0'
|| (input_sec->flags & SEC_EXCLUDE))
elfsym->st_name = (unsigned long) -1;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
else
{
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
/* Call _bfd_elf_strtab_offset after _bfd_elf_strtab_finalize
to get the final offset for st_name. */
elfsym->st_name
= (unsigned long) _bfd_elf_strtab_add (flinfo->symstrtab,
name, FALSE);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (elfsym->st_name == (unsigned long) -1)
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
return 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
hash_table = elf_hash_table (flinfo->info);
strtabsize = hash_table->strtabsize;
if (strtabsize <= hash_table->strtabcount)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
strtabsize += strtabsize;
hash_table->strtabsize = strtabsize;
strtabsize *= sizeof (*hash_table->strtab);
hash_table->strtab
= (struct elf_sym_strtab *) bfd_realloc (hash_table->strtab,
strtabsize);
if (hash_table->strtab == NULL)
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
return 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
hash_table->strtab[hash_table->strtabcount].sym = *elfsym;
hash_table->strtab[hash_table->strtabcount].dest_index
= hash_table->strtabcount;
hash_table->strtab[hash_table->strtabcount].destshndx_index
= flinfo->symshndxbuf ? bfd_get_symcount (flinfo->output_bfd) : 0;
bfd_get_symcount (flinfo->output_bfd) += 1;
hash_table->strtabcount += 1;
return 1;
}
/* Swap symbols out to the symbol table and flush the output symbols to
the file. */
static bfd_boolean
elf_link_swap_symbols_out (struct elf_final_link_info *flinfo)
{
struct elf_link_hash_table *hash_table = elf_hash_table (flinfo->info);
bfd_size_type amt, i;
const struct elf_backend_data *bed;
bfd_byte *symbuf;
Elf_Internal_Shdr *hdr;
file_ptr pos;
bfd_boolean ret;
if (!hash_table->strtabcount)
return TRUE;
BFD_ASSERT (elf_onesymtab (flinfo->output_bfd));
bed = get_elf_backend_data (flinfo->output_bfd);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
amt = bed->s->sizeof_sym * hash_table->strtabcount;
symbuf = (bfd_byte *) bfd_malloc (amt);
if (symbuf == NULL)
return FALSE;
2015-08-12 13:32:43 +02:00
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
if (flinfo->symshndxbuf)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
amt = (sizeof (Elf_External_Sym_Shndx)
* (bfd_get_symcount (flinfo->output_bfd)));
flinfo->symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt);
if (flinfo->symshndxbuf == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
free (symbuf);
return FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
for (i = 0; i < hash_table->strtabcount; i++)
{
struct elf_sym_strtab *elfsym = &hash_table->strtab[i];
if (elfsym->sym.st_name == (unsigned long) -1)
elfsym->sym.st_name = 0;
else
elfsym->sym.st_name
= (unsigned long) _bfd_elf_strtab_offset (flinfo->symstrtab,
elfsym->sym.st_name);
bed->s->swap_symbol_out (flinfo->output_bfd, &elfsym->sym,
((bfd_byte *) symbuf
+ (elfsym->dest_index
* bed->s->sizeof_sym)),
(flinfo->symshndxbuf
+ elfsym->destshndx_index));
}
hdr = &elf_tdata (flinfo->output_bfd)->symtab_hdr;
pos = hdr->sh_offset + hdr->sh_size;
amt = hash_table->strtabcount * bed->s->sizeof_sym;
if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) == 0
&& bfd_bwrite (symbuf, amt, flinfo->output_bfd) == amt)
{
hdr->sh_size += amt;
ret = TRUE;
}
else
ret = FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
free (symbuf);
free (hash_table->strtab);
hash_table->strtab = NULL;
return ret;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
/* Return TRUE if the dynamic symbol SYM in ABFD is supported. */
static bfd_boolean
check_dynsym (bfd *abfd, Elf_Internal_Sym *sym)
{
include/elf/ PR 5900 * common.h (SHN_BAD): Delete. (SHN_LORESERVE .. SHN_HIRESERVE): Move to.. * external.h: ..here. * internal.h (SHN_LORESERVE, SHN_HIRESERVE): Define. (SHN_LOPROC, SHN_HIPROC, SHN_LOOS, SHN_HIOS): Define. (SHN_ABS, SHN_COMMON, SHN_XINDEX, SHN_BAD): Define. bfd/ PR 5900 * elf-bfd.h: Include elf/internal.h after elf/external.h. * elfcode.h (elf_swap_symbol_in): Map reserved shndx range. (elf_swap_symbol_out): Adjust SHN_XINDEX test. (elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. (valid_section_index_p): Delete. (elf_object_p): Don't increment section numbers over reserved range. Simplify test for valid sh_link, sh_info and e_shstrndx fields. (elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. Don't increment section numbers over reserved range. * elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx. (bfd_section_from_shdr): Likewise. (group_signature): Range check before accessing elf_elfsections. (_bfd_elf_setup_sections): Likewise. (bfd_section_from_shdr): Likewise. (bfd_section_from_shdr): Don't increment section number over reserved sections. (assign_file_positions_for_non_load_sections): Likewise. (assign_file_positions_except_relocs): Likewise. (_bfd_elf_write_object_contents): Likewise. (assign_section_numbers): Likewise. Adjust for changed SHN_*. (prep_headers): Delete unused variable. * elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust for changed SHN_* values. (check_dynsym, elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. Don't skip over reserved section range. (elf_fixup_link_order): Check that sh_link field is valid. * elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned. * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before accesssing elf_elfsections. * elf32-avr.c (elf32_avr_size_stubs): Likewise. * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise. * elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed SHN_* defines. Test for SHN_BAD return from _bfd_elf_section_from_bfd_section binutils/ PR 5900 * readelf.c (SECTION_HEADER_INDEX, SECTION_HEADER_NUM): Delete. Remove use throughout file. (SECTION_HEADER): Likewise. (dump_relocations): Don't adjust st_shndx for reserved range. (process_file_header): Mask SHN_XINDEX to values seen in external elf structs. Simplify valid section index tests. (get_32bit_elf_symbols, get_64bit_elf_symbols): Mask SHN_XINDEX. Map reserved st_shndx to internal form. (process_section_groups): Test that group symbol st_shndx is in range, not just non-zero. Delete reserved range check. (get_symbol_index_type): Mask "type" to 16 bits when printing PRC, OS or RSV. gdb/ PR 5900 * elfread.c (elf_symtab_read): Make shndx an unsigned int. * mipsread.c: Include elf/internal.h. (read_alphacoff_dynamic_symtab): Map external reserved sym_shndx to internal range. ld/testsuite/ PR 5900 * ld-elf/sec64k.exp: Update.
2008-03-12 09:37:09 +01:00
if (sym->st_shndx >= (SHN_LORESERVE & 0xffff)
&& sym->st_shndx < SHN_LORESERVE)
{
/* The gABI doesn't support dynamic symbols in output sections
2007-09-30 15:43:23 +02:00
beyond 64k. */
(*_bfd_error_handler)
(_("%B: Too many sections: %d (>= %d)"),
include/elf/ PR 5900 * common.h (SHN_BAD): Delete. (SHN_LORESERVE .. SHN_HIRESERVE): Move to.. * external.h: ..here. * internal.h (SHN_LORESERVE, SHN_HIRESERVE): Define. (SHN_LOPROC, SHN_HIPROC, SHN_LOOS, SHN_HIOS): Define. (SHN_ABS, SHN_COMMON, SHN_XINDEX, SHN_BAD): Define. bfd/ PR 5900 * elf-bfd.h: Include elf/internal.h after elf/external.h. * elfcode.h (elf_swap_symbol_in): Map reserved shndx range. (elf_swap_symbol_out): Adjust SHN_XINDEX test. (elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. (valid_section_index_p): Delete. (elf_object_p): Don't increment section numbers over reserved range. Simplify test for valid sh_link, sh_info and e_shstrndx fields. (elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. Don't increment section numbers over reserved range. * elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx. (bfd_section_from_shdr): Likewise. (group_signature): Range check before accessing elf_elfsections. (_bfd_elf_setup_sections): Likewise. (bfd_section_from_shdr): Likewise. (bfd_section_from_shdr): Don't increment section number over reserved sections. (assign_file_positions_for_non_load_sections): Likewise. (assign_file_positions_except_relocs): Likewise. (_bfd_elf_write_object_contents): Likewise. (assign_section_numbers): Likewise. Adjust for changed SHN_*. (prep_headers): Delete unused variable. * elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust for changed SHN_* values. (check_dynsym, elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. Don't skip over reserved section range. (elf_fixup_link_order): Check that sh_link field is valid. * elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned. * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before accesssing elf_elfsections. * elf32-avr.c (elf32_avr_size_stubs): Likewise. * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise. * elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed SHN_* defines. Test for SHN_BAD return from _bfd_elf_section_from_bfd_section binutils/ PR 5900 * readelf.c (SECTION_HEADER_INDEX, SECTION_HEADER_NUM): Delete. Remove use throughout file. (SECTION_HEADER): Likewise. (dump_relocations): Don't adjust st_shndx for reserved range. (process_file_header): Mask SHN_XINDEX to values seen in external elf structs. Simplify valid section index tests. (get_32bit_elf_symbols, get_64bit_elf_symbols): Mask SHN_XINDEX. Map reserved st_shndx to internal form. (process_section_groups): Test that group symbol st_shndx is in range, not just non-zero. Delete reserved range check. (get_symbol_index_type): Mask "type" to 16 bits when printing PRC, OS or RSV. gdb/ PR 5900 * elfread.c (elf_symtab_read): Make shndx an unsigned int. * mipsread.c: Include elf/internal.h. (read_alphacoff_dynamic_symtab): Map external reserved sym_shndx to internal range. ld/testsuite/ PR 5900 * ld-elf/sec64k.exp: Update.
2008-03-12 09:37:09 +01:00
abfd, bfd_count_sections (abfd), SHN_LORESERVE & 0xffff);
bfd_set_error (bfd_error_nonrepresentable_section);
return FALSE;
}
return TRUE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in
allowing an unsatisfied unversioned symbol in the DSO to match a
versioned symbol that would normally require an explicit version.
We also handle the case that a DSO references a hidden symbol
which may be satisfied by a versioned symbol in another DSO. */
static bfd_boolean
elf_link_check_versioned_symbol (struct bfd_link_info *info,
const struct elf_backend_data *bed,
struct elf_link_hash_entry *h)
{
bfd *abfd;
struct elf_link_loaded_list *loaded;
if (!is_elf_hash_table (info->hash))
return FALSE;
/* Check indirect symbol. */
while (h->root.type == bfd_link_hash_indirect)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
switch (h->root.type)
{
default:
abfd = NULL;
break;
case bfd_link_hash_undefined:
case bfd_link_hash_undefweak:
abfd = h->root.u.undef.abfd;
if ((abfd->flags & DYNAMIC) == 0
|| (elf_dyn_lib_class (abfd) & DYN_DT_NEEDED) == 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
break;
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
abfd = h->root.u.def.section->owner;
break;
case bfd_link_hash_common:
abfd = h->root.u.c.p->section->owner;
break;
}
BFD_ASSERT (abfd != NULL);
for (loaded = elf_hash_table (info)->loaded;
loaded != NULL;
loaded = loaded->next)
{
bfd *input;
Elf_Internal_Shdr *hdr;
bfd_size_type symcount;
bfd_size_type extsymcount;
bfd_size_type extsymoff;
Elf_Internal_Shdr *versymhdr;
Elf_Internal_Sym *isym;
Elf_Internal_Sym *isymend;
Elf_Internal_Sym *isymbuf;
Elf_External_Versym *ever;
Elf_External_Versym *extversym;
input = loaded->abfd;
/* We check each DSO for a possible hidden versioned definition. */
if (input == abfd
|| (input->flags & DYNAMIC) == 0
|| elf_dynversym (input) == 0)
continue;
hdr = &elf_tdata (input)->dynsymtab_hdr;
symcount = hdr->sh_size / bed->s->sizeof_sym;
if (elf_bad_symtab (input))
{
extsymcount = symcount;
extsymoff = 0;
}
else
{
extsymcount = symcount - hdr->sh_info;
extsymoff = hdr->sh_info;
}
if (extsymcount == 0)
continue;
isymbuf = bfd_elf_get_elf_syms (input, hdr, extsymcount, extsymoff,
NULL, NULL, NULL);
if (isymbuf == NULL)
return FALSE;
/* Read in any version definitions. */
versymhdr = &elf_tdata (input)->dynversym_hdr;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (extversym == NULL)
goto error_ret;
if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0
|| (bfd_bread (extversym, versymhdr->sh_size, input)
!= versymhdr->sh_size))
{
free (extversym);
error_ret:
free (isymbuf);
return FALSE;
}
ever = extversym + extsymoff;
isymend = isymbuf + extsymcount;
for (isym = isymbuf; isym < isymend; isym++, ever++)
{
const char *name;
Elf_Internal_Versym iver;
unsigned short version_index;
if (ELF_ST_BIND (isym->st_info) == STB_LOCAL
|| isym->st_shndx == SHN_UNDEF)
continue;
name = bfd_elf_string_from_elf_section (input,
hdr->sh_link,
isym->st_name);
if (strcmp (name, h->root.root.string) != 0)
continue;
_bfd_elf_swap_versym_in (input, ever, &iver);
if ((iver.vs_vers & VERSYM_HIDDEN) == 0
&& !(h->def_regular
&& h->forced_local))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
/* If we have a non-hidden versioned sym, then it should
have provided a definition for the undefined sym unless
it is defined in a non-shared object and forced local.
*/
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
abort ();
}
version_index = iver.vs_vers & VERSYM_VERSION;
if (version_index == 1 || version_index == 2)
{
/* This is the base or first version. We can use it. */
free (extversym);
free (isymbuf);
return TRUE;
}
}
free (extversym);
free (isymbuf);
}
return FALSE;
}
Properly implement STT_COMMON The BFD configure option, --enable-elf-stt-common, can't be to used to verify STT_COMMON implementation with the normal binutils build. Instead, this patch removes it from BFD. It adds --elf-stt-common=[no|yes] to ELF assembler/objcopy and adds -z common/-z nocommon to ld. A configure option, --enable-elf-stt-common, is added to gas to specify whether ELF assembler should generate common symbols with the STT_COMMON type by default. Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF common symbols. bfd/ PR ld/19645 * bfd.c (bfd): Change flags to 20 bits. (BFD_CONVERT_ELF_COMMON): New. (BFD_USE_ELF_STT_COMMON): Likewise. (BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * configure.ac: Remove --enable-elf-stt-common. * elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. * elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for STT_COMMON. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check STT_COMMON. (elf_link_convert_common_type): New function. (elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. Set sym.st_info after sym.st_shndx. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON to object_flags. (TARGET_LITTLE_SYM): Likewise. * syms.c (BSF_KEEP_G): Renamed to ... (BSF_ELF_COMMON): This. * bfd-in2.h: Regenerated. * config.in: Likewise. * configure: Likewise. binutils/ PR ld/19645 * NEWS: Mention --elf-stt-common= for objcopy. * doc/binutils.texi: Document --elf-stt-common= for objcopy. * objcopy.c (do_elf_stt_common): New. (command_line_switch): Add OPTION_ELF_STT_COMMON. (copy_options): Add --elf-stt-common=. (copy_usage): Add --elf-stt-common=. (copy_object): Also check do_elf_stt_common for ELF targets. (copy_file): Handle do_elf_stt_common. (copy_main): Handle OPTION_ELF_STT_COMMON. * readelf.c (apply_relocations): Support STT_COMMON. * testsuite/binutils-all/common-1.s: New file. * testsuite/binutils-all/common-1a.d: Likewise. * testsuite/binutils-all/common-1b.d: Likewise. * testsuite/binutils-all/common-1c.d: Likewise. * testsuite/binutils-all/common-1d.d: Likewise. * testsuite/binutils-all/common-1e.d: Likewise. * testsuite/binutils-all/common-1f.d: Likewise. * testsuite/binutils-all/common-2.s: Likewise. * testsuite/binutils-all/common-2a.d: Likewise. * testsuite/binutils-all/common-2b.d: Likewise. * testsuite/binutils-all/common-2c.d: Likewise. * testsuite/binutils-all/common-2d.d: Likewise. * testsuite/binutils-all/common-2e.d: Likewise. * testsuite/binutils-all/common-2f.d: Likewise. * testsuite/binutils-all/objcopy.exp (objcopy_test_elf_common_symbols): New proc. Run objcopy_test_elf_common_symbols for ELF targets gas/ PR ld/19645 * NEWS: Mention --enable-elf-stt-common and --elf-stt-common= for ELF assemblers. * as.c (flag_use_elf_stt_common): New. (show_usage): Add --elf-stt-common=. (option_values): Add OPTION_ELF_STT_COMMON. (std_longopts): Add --elf-stt-common=. (parse_args): Handle --elf-stt-common=. * as.h (flag_use_elf_stt_common): New. * config.in: Regenerated. * configure: Likewise. * configure.ac: Add --enable-elf-stt-common and define DEFAULT_GENERATE_ELF_STT_COMMON. * gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set. * doc/as.texinfo: Document --elf-stt-common=. * testsuite/gas/elf/common3.s: New file. * testsuite/gas/elf/common3a.d: Likewise. * testsuite/gas/elf/common3b.d: Likewise. * testsuite/gas/elf/common4.s: Likewise. * testsuite/gas/elf/common4a.d: Likewise. * testsuite/gas/elf/common4b.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a and common4b. * testsuite/gas/i386/dw2-compress-3.d: Renamed to ... * testsuite/gas/i386/dw2-compress-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/dw2-compressed-3.d: Renamed to ... * testsuite/gas/i386/dw2-compressed-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/i386.exp: Run dw2-compress-3a, dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead of dw2-compress-3 and dw2-compressed-3. include/ PR ld/19645 * bfdlink.h (bfd_link_elf_stt_common): New enum. (bfd_link_info): Add elf_stt_common. ld/ PR ld/19645 * NEWS: Mention -z common/-z nocommon for ELF targets. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z common and -z nocommon. * ld.texinfo: Document -z common/-z nocommon. * lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon. * testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and --elf-stt-common=yes with assembler. * testsuite/ld-elfcomm/common-1.s: New file. * testsuite/ld-elfcomm/common-1a.d: Likewise. * testsuite/ld-elfcomm/common-1b.d: Likewise. * testsuite/ld-elfcomm/common-1c.d: Likewise. * testsuite/ld-elfcomm/common-1d.d: Likewise. * testsuite/ld-elfcomm/common-1e.d: Likewise. * testsuite/ld-elfcomm/common-1f.d: Likewise. * testsuite/ld-elfcomm/common-2.s: Likewise. * testsuite/ld-elfcomm/common-2a.d: Likewise. * testsuite/ld-elfcomm/common-2b.d: Likewise. * testsuite/ld-elfcomm/common-2c.d: Likewise. * testsuite/ld-elfcomm/common-2d.d: Likewise. * testsuite/ld-elfcomm/common-2e.d: Likewise. * testsuite/ld-elfcomm/common-2f.d: Likewise. * testsuite/ld-elfcomm/common-3a.rd: Likewise. * testsuite/ld-elfcomm/common-3b.rd: Likewise. * testsuite/ld-i386/pr19645.d: Likewise. * testsuite/ld-i386/pr19645.s: Likewise. * testsuite/ld-x86-64/largecomm-1.s: Likewise. * testsuite/ld-x86-64/largecomm-1a.d: Likewise. * testsuite/ld-x86-64/largecomm-1b.d: Likewise. * testsuite/ld-x86-64/largecomm-1c.d: Likewise. * testsuite/ld-x86-64/largecomm-1d.d: Likewise. * testsuite/ld-x86-64/largecomm-1e.d: Likewise. * testsuite/ld-x86-64/largecomm-1f.d: Likewise. * testsuite/ld-x86-64/pr19645.d: Likewise. * testsuite/ld-x86-64/pr19645.s: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes with assembler. (assembler_generates_commons): Removed. Run -z common/-z nocommon tests. Run *.d tests. * testsuite/ld-i386/i386.exp: Run pr19645. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with assembler. Test STT_COMMON with readelf.
2016-02-22 18:18:52 +01:00
/* Convert ELF common symbol TYPE. */
static int
elf_link_convert_common_type (struct bfd_link_info *info, int type)
{
/* Commom symbol can only appear in relocatable link. */
if (!bfd_link_relocatable (info))
abort ();
switch (info->elf_stt_common)
{
case unchanged:
break;
case elf_stt_common:
type = STT_COMMON;
break;
case no_elf_stt_common:
type = STT_OBJECT;
break;
}
return type;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Add an external symbol to the symbol table. This is called from
the hash table traversal routine. When generating a shared object,
we go through the symbol table twice. The first time we output
anything that might have been forced to local scope in a version
script. The second time we output the symbols that are still
global symbols. */
static bfd_boolean
* linker.c (bfd_link_hash_traverse): Follow warning symbol link. (_bfd_generic_link_write_global_symbol, fix_syms): Don't handle warning symbols here. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.c (allocate_dynrelocs_for_symbol, elf32_arm_readonly_dynrelocs): Likewise. * elf32-bfin.c (bfin_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): Likewise. * elf32-hppa.c (allocate_plt_static, allocate_dynrelocs, clobber_millicode_symbols, readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-i386.c (elf_i386_allocate_dynrelocs, elf_i386_readonly_dynrelocs): Likewise. * elf32-lm32.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m32c.c (m32c_relax_plt_check, m32c_relax_plt_realloc): Likewise. * elf32-m32r.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-microblaze.c (allocate_dynrelocs): Likewise. * elf32-ppc.c (allocate_dynrelocs, maybe_set_textrel): Likewise. * elf32-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-score.c (score_elf_sort_hash_table_f): Likewise. * elf32-score7.c (score_elf_sort_hash_table_f): Likewise. * elf32-sh.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-tic6x.c (elf32_tic6x_allocate_dynrelocs, elf32_tic6x_readonly_dynrelocs): Likewise. * elf32-vax.c (elf_vax_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check, xstormy16_relax_plt_realloc): Likewise. * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_1): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions, allocate_global_data_opd, elf64_hppa_mark_milli_and_exported_functions, elf_hppa_unmark_useless_dynamic_symbols, elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref, func_desc_adjust, adjust_opd_syms, adjust_toc_syms, allocate_dynrelocs, readonly_dynrelocs, merge_global_got, reallocate_got, undo_symbol_twiddle): Likewise. * elf64-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs, elf_x86_64_readonly_dynrelocs): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms, elf_link_renumber_local_hash_table_dynsyms, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms, elf_adjust_dynstr_offsets, elf_collect_hash_codes, elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, elf_gc_sweep_symbol, elf_gc_propagate_vtable_entries_used, elf_gc_smash_unused_vtentry_relocs, bfd_elf_gc_mark_dynamic_ref_symbol, elf_gc_allocate_got_offsets): Likewise. * elfnn-ia64.c (elfNN_ia64_global_dyn_info_free, elfNN_ia64_global_dyn_sym_thunk): Likewise. * elfxx-mips.c (mips_elf_check_symbols, mips_elf_output_extsym, mips_elf_sort_hash_table_f, allocate_dynrelocs): Likewise. * elfxx-sparc.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_post_gc_symbol): Likewise. * elflink.c (elf_link_output_extsym): Make it a bfd_hash_traverse function. Update all callers. * aoutx.h (aout_link_write_other_symbol): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * ecoff.c (ecoff_link_write_external): Likewise. * xcofflink.c (xcoff_write_global_symbol): Likewise. * vms-alpha.c (alpha_vms_link_output_symbol): Likewise. Handle warning symbols. * ecoff.c (ecoff_link_hash_traverse): Delete. * coff-ppc.c (ppc_bfd_coff_final_link): Use bfd_hash_traverse for _bfd_coff_write_global_sym. * libcoff-in.h (_bfd_coff_write_global_sym): Update prototype. * libcoff.h: Regenerate.
2011-06-13 02:59:15 +02:00
elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
* linker.c (bfd_link_hash_traverse): Follow warning symbol link. (_bfd_generic_link_write_global_symbol, fix_syms): Don't handle warning symbols here. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.c (allocate_dynrelocs_for_symbol, elf32_arm_readonly_dynrelocs): Likewise. * elf32-bfin.c (bfin_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): Likewise. * elf32-hppa.c (allocate_plt_static, allocate_dynrelocs, clobber_millicode_symbols, readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-i386.c (elf_i386_allocate_dynrelocs, elf_i386_readonly_dynrelocs): Likewise. * elf32-lm32.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m32c.c (m32c_relax_plt_check, m32c_relax_plt_realloc): Likewise. * elf32-m32r.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-microblaze.c (allocate_dynrelocs): Likewise. * elf32-ppc.c (allocate_dynrelocs, maybe_set_textrel): Likewise. * elf32-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-score.c (score_elf_sort_hash_table_f): Likewise. * elf32-score7.c (score_elf_sort_hash_table_f): Likewise. * elf32-sh.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-tic6x.c (elf32_tic6x_allocate_dynrelocs, elf32_tic6x_readonly_dynrelocs): Likewise. * elf32-vax.c (elf_vax_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check, xstormy16_relax_plt_realloc): Likewise. * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_1): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions, allocate_global_data_opd, elf64_hppa_mark_milli_and_exported_functions, elf_hppa_unmark_useless_dynamic_symbols, elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref, func_desc_adjust, adjust_opd_syms, adjust_toc_syms, allocate_dynrelocs, readonly_dynrelocs, merge_global_got, reallocate_got, undo_symbol_twiddle): Likewise. * elf64-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs, elf_x86_64_readonly_dynrelocs): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms, elf_link_renumber_local_hash_table_dynsyms, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms, elf_adjust_dynstr_offsets, elf_collect_hash_codes, elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, elf_gc_sweep_symbol, elf_gc_propagate_vtable_entries_used, elf_gc_smash_unused_vtentry_relocs, bfd_elf_gc_mark_dynamic_ref_symbol, elf_gc_allocate_got_offsets): Likewise. * elfnn-ia64.c (elfNN_ia64_global_dyn_info_free, elfNN_ia64_global_dyn_sym_thunk): Likewise. * elfxx-mips.c (mips_elf_check_symbols, mips_elf_output_extsym, mips_elf_sort_hash_table_f, allocate_dynrelocs): Likewise. * elfxx-sparc.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_post_gc_symbol): Likewise. * elflink.c (elf_link_output_extsym): Make it a bfd_hash_traverse function. Update all callers. * aoutx.h (aout_link_write_other_symbol): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * ecoff.c (ecoff_link_write_external): Likewise. * xcofflink.c (xcoff_write_global_symbol): Likewise. * vms-alpha.c (alpha_vms_link_output_symbol): Likewise. Handle warning symbols. * ecoff.c (ecoff_link_hash_traverse): Delete. * coff-ppc.c (ppc_bfd_coff_final_link): Use bfd_hash_traverse for _bfd_coff_write_global_sym. * libcoff-in.h (_bfd_coff_write_global_sym): Update prototype. * libcoff.h: Regenerate.
2011-06-13 02:59:15 +02:00
struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) bh;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
struct elf_final_link_info *flinfo = eoinfo->flinfo;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_boolean strip;
Elf_Internal_Sym sym;
asection *input_sec;
const struct elf_backend_data *bed;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
long indx;
int ret;
Properly implement STT_COMMON The BFD configure option, --enable-elf-stt-common, can't be to used to verify STT_COMMON implementation with the normal binutils build. Instead, this patch removes it from BFD. It adds --elf-stt-common=[no|yes] to ELF assembler/objcopy and adds -z common/-z nocommon to ld. A configure option, --enable-elf-stt-common, is added to gas to specify whether ELF assembler should generate common symbols with the STT_COMMON type by default. Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF common symbols. bfd/ PR ld/19645 * bfd.c (bfd): Change flags to 20 bits. (BFD_CONVERT_ELF_COMMON): New. (BFD_USE_ELF_STT_COMMON): Likewise. (BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * configure.ac: Remove --enable-elf-stt-common. * elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. * elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for STT_COMMON. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check STT_COMMON. (elf_link_convert_common_type): New function. (elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. Set sym.st_info after sym.st_shndx. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON to object_flags. (TARGET_LITTLE_SYM): Likewise. * syms.c (BSF_KEEP_G): Renamed to ... (BSF_ELF_COMMON): This. * bfd-in2.h: Regenerated. * config.in: Likewise. * configure: Likewise. binutils/ PR ld/19645 * NEWS: Mention --elf-stt-common= for objcopy. * doc/binutils.texi: Document --elf-stt-common= for objcopy. * objcopy.c (do_elf_stt_common): New. (command_line_switch): Add OPTION_ELF_STT_COMMON. (copy_options): Add --elf-stt-common=. (copy_usage): Add --elf-stt-common=. (copy_object): Also check do_elf_stt_common for ELF targets. (copy_file): Handle do_elf_stt_common. (copy_main): Handle OPTION_ELF_STT_COMMON. * readelf.c (apply_relocations): Support STT_COMMON. * testsuite/binutils-all/common-1.s: New file. * testsuite/binutils-all/common-1a.d: Likewise. * testsuite/binutils-all/common-1b.d: Likewise. * testsuite/binutils-all/common-1c.d: Likewise. * testsuite/binutils-all/common-1d.d: Likewise. * testsuite/binutils-all/common-1e.d: Likewise. * testsuite/binutils-all/common-1f.d: Likewise. * testsuite/binutils-all/common-2.s: Likewise. * testsuite/binutils-all/common-2a.d: Likewise. * testsuite/binutils-all/common-2b.d: Likewise. * testsuite/binutils-all/common-2c.d: Likewise. * testsuite/binutils-all/common-2d.d: Likewise. * testsuite/binutils-all/common-2e.d: Likewise. * testsuite/binutils-all/common-2f.d: Likewise. * testsuite/binutils-all/objcopy.exp (objcopy_test_elf_common_symbols): New proc. Run objcopy_test_elf_common_symbols for ELF targets gas/ PR ld/19645 * NEWS: Mention --enable-elf-stt-common and --elf-stt-common= for ELF assemblers. * as.c (flag_use_elf_stt_common): New. (show_usage): Add --elf-stt-common=. (option_values): Add OPTION_ELF_STT_COMMON. (std_longopts): Add --elf-stt-common=. (parse_args): Handle --elf-stt-common=. * as.h (flag_use_elf_stt_common): New. * config.in: Regenerated. * configure: Likewise. * configure.ac: Add --enable-elf-stt-common and define DEFAULT_GENERATE_ELF_STT_COMMON. * gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set. * doc/as.texinfo: Document --elf-stt-common=. * testsuite/gas/elf/common3.s: New file. * testsuite/gas/elf/common3a.d: Likewise. * testsuite/gas/elf/common3b.d: Likewise. * testsuite/gas/elf/common4.s: Likewise. * testsuite/gas/elf/common4a.d: Likewise. * testsuite/gas/elf/common4b.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a and common4b. * testsuite/gas/i386/dw2-compress-3.d: Renamed to ... * testsuite/gas/i386/dw2-compress-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/dw2-compressed-3.d: Renamed to ... * testsuite/gas/i386/dw2-compressed-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/i386.exp: Run dw2-compress-3a, dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead of dw2-compress-3 and dw2-compressed-3. include/ PR ld/19645 * bfdlink.h (bfd_link_elf_stt_common): New enum. (bfd_link_info): Add elf_stt_common. ld/ PR ld/19645 * NEWS: Mention -z common/-z nocommon for ELF targets. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z common and -z nocommon. * ld.texinfo: Document -z common/-z nocommon. * lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon. * testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and --elf-stt-common=yes with assembler. * testsuite/ld-elfcomm/common-1.s: New file. * testsuite/ld-elfcomm/common-1a.d: Likewise. * testsuite/ld-elfcomm/common-1b.d: Likewise. * testsuite/ld-elfcomm/common-1c.d: Likewise. * testsuite/ld-elfcomm/common-1d.d: Likewise. * testsuite/ld-elfcomm/common-1e.d: Likewise. * testsuite/ld-elfcomm/common-1f.d: Likewise. * testsuite/ld-elfcomm/common-2.s: Likewise. * testsuite/ld-elfcomm/common-2a.d: Likewise. * testsuite/ld-elfcomm/common-2b.d: Likewise. * testsuite/ld-elfcomm/common-2c.d: Likewise. * testsuite/ld-elfcomm/common-2d.d: Likewise. * testsuite/ld-elfcomm/common-2e.d: Likewise. * testsuite/ld-elfcomm/common-2f.d: Likewise. * testsuite/ld-elfcomm/common-3a.rd: Likewise. * testsuite/ld-elfcomm/common-3b.rd: Likewise. * testsuite/ld-i386/pr19645.d: Likewise. * testsuite/ld-i386/pr19645.s: Likewise. * testsuite/ld-x86-64/largecomm-1.s: Likewise. * testsuite/ld-x86-64/largecomm-1a.d: Likewise. * testsuite/ld-x86-64/largecomm-1b.d: Likewise. * testsuite/ld-x86-64/largecomm-1c.d: Likewise. * testsuite/ld-x86-64/largecomm-1d.d: Likewise. * testsuite/ld-x86-64/largecomm-1e.d: Likewise. * testsuite/ld-x86-64/largecomm-1f.d: Likewise. * testsuite/ld-x86-64/pr19645.d: Likewise. * testsuite/ld-x86-64/pr19645.s: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes with assembler. (assembler_generates_commons): Removed. Run -z common/-z nocommon tests. Run *.d tests. * testsuite/ld-i386/i386.exp: Run pr19645. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with assembler. Test STT_COMMON with readelf.
2016-02-22 18:18:52 +01:00
unsigned int type;
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
/* A symbol is bound locally if it is forced local or it is locally
defined, hidden versioned, not referenced by shared library and
not exported when linking executable. */
bfd_boolean local_bind = (h->forced_local
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
|| (bfd_link_executable (flinfo->info)
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
&& !flinfo->info->export_dynamic
&& !h->dynamic
&& !h->ref_dynamic
&& h->def_regular
&& h->versioned == versioned_hidden));
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (h->root.type == bfd_link_hash_warning)
{
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if (h->root.type == bfd_link_hash_new)
return TRUE;
}
/* Decide whether to output this symbol in this pass. */
if (eoinfo->localsyms)
{
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
if (!local_bind)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
else
{
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
if (local_bind)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
bed = get_elf_backend_data (flinfo->output_bfd);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (h->root.type == bfd_link_hash_undefined)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
/* If we have an undefined symbol reference here then it must have
come from a shared library that is being linked in. (Undefined
references in regular files have already been handled unless
they are in unreferenced sections which are removed by garbage
collection). */
bfd_boolean ignore_undef = FALSE;
/* Some symbols may be special in that the fact that they're
undefined can be safely ignored - let backend determine that. */
if (bed->elf_backend_ignore_undef_symbol)
ignore_undef = bed->elf_backend_ignore_undef_symbol (h);
/* If we are reporting errors for this situation then do so now. */
if (!ignore_undef
&& h->ref_dynamic
&& (!h->ref_regular || flinfo->info->gc_sections)
&& !elf_link_check_versioned_symbol (flinfo->info, bed, h)
&& flinfo->info->unresolved_syms_in_shared_libs != RM_IGNORE)
{
if (!(flinfo->info->callbacks->undefined_symbol
(flinfo->info, h->root.root.string,
h->ref_regular ? NULL : h->root.u.undef.abfd,
NULL, 0,
(flinfo->info->unresolved_syms_in_shared_libs
== RM_GENERATE_ERROR))))
{
bfd_set_error (bfd_error_bad_value);
eoinfo->failed = TRUE;
return FALSE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
/* We should also warn if a forced local symbol is referenced from
shared libraries. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_executable (flinfo->info)
2004-09-16 16:52:12 +02:00
&& h->forced_local
&& h->ref_dynamic
&& h->def_regular
2004-09-16 16:52:12 +02:00
&& !h->dynamic_def
&& h->ref_dynamic_nonweak
&& !elf_link_check_versioned_symbol (flinfo->info, bed, h))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd *def_bfd;
const char *msg;
struct elf_link_hash_entry *hi = h;
/* Check indirect symbol. */
while (hi->root.type == bfd_link_hash_indirect)
hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL)
msg = _("%B: internal symbol `%s' in %B is referenced by DSO");
else if (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
msg = _("%B: hidden symbol `%s' in %B is referenced by DSO");
else
msg = _("%B: local symbol `%s' in %B is referenced by DSO");
def_bfd = flinfo->output_bfd;
if (hi->root.u.def.section != bfd_abs_section_ptr)
def_bfd = hi->root.u.def.section->owner;
(*_bfd_error_handler) (msg, flinfo->output_bfd, def_bfd,
h->root.root.string);
bfd_set_error (bfd_error_bad_value);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
eoinfo->failed = TRUE;
return FALSE;
}
/* We don't want to output symbols that have never been mentioned by
a regular file, or that we have been told to strip. However, if
h->indx is set to -2, the symbol is used by a reloc and we must
output it. */
strip = FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (h->indx == -2)
;
2004-09-16 16:52:12 +02:00
else if ((h->def_dynamic
|| h->ref_dynamic
|| h->root.type == bfd_link_hash_new)
2004-09-16 16:52:12 +02:00
&& !h->def_regular
&& !h->ref_regular)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
strip = TRUE;
else if (flinfo->info->strip == strip_all)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
strip = TRUE;
else if (flinfo->info->strip == strip_some
&& bfd_hash_lookup (flinfo->info->keep_hash,
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
h->root.root.string, FALSE, FALSE) == NULL)
strip = TRUE;
else if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& ((flinfo->info->strip_discarded
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
&& discarded_section (h->root.u.def.section))
|| ((h->root.u.def.section->flags & SEC_LINKER_CREATED) == 0
&& h->root.u.def.section->owner != NULL
&& (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0)))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
strip = TRUE;
PR ld/12365 PR ld/12672 bfd/ * bfd.c (BFD_PLUGIN): Define. (BFD_FLAGS_SAVED, BFD_FLAGS_FOR_BFD_USE_MASK): Add BFD_PLUGIN. * bfd-in2.h: Regenerate. * elflink.c (elf_link_output_extsym): Strip undefined plugin syms. * opncls.c (bfd_make_readable): Don't lose original bfd flags. ld/ * ldfile.c (ldfile_try_open_bfd): Don't attempt any plugin action when no_more_claiming. * ldmain.c (add_archive_element): Likewise. (multiple_definition): Remove plugin_multiple_definition call. (notice): Remove plugin_notice call. * ldlang.c (lang_list_insert_after, void lang_list_remove_tail): Move. Delete prototype. (plugin_insert): New static var. (open_input_bfds): Only rescan libs after plugin insert point. (lang_gc_sections): Omit plugin claimed files. (lang_process): Set plugin_insert. Only rescan when plugin adds objects. * plugin.h (no_more_claiming): Declare. (plugin_notice, plugin_multiple_definition): Don't declare. * plugin.c: Formatting. (orig_notice_all, orig_allow_multiple_defs, orig_callbacks, plugin_callbacks): New static vars. (no_more_claiming): Make global. (plugin_cached_allow_multiple_defs): Delete. (plugin_get_ir_dummy_bfd): Set SEC_EXCLUDE on dummy .text section, use newer bfd_make_section variant. Make COMMON section too. Error handling. Correct setting of gp size. (asymbol_from_plugin_symbol): Properly cast last arg of concat. (message): Likewise for ACONCAT. (asymbol_from_plugin_symbol): Use our COMMON section. (get_symbols): When report_plugin_symbols, show visibility too. (init_non_ironly_hash): Move. Don't test non_ironly_hash. (plugin_load_plugins): Save state of linker callbacks, set up to call plugin_notice instead. Call init_non_ironly_hash here. (plugin_call_all_symbols_read): Set plugin_multiple_definition in plugin callbacks. (plugin_notice): Rewrite. (plugin_multiple_definition): Make static, call original callback. ld/testsuite/ * ld-plugin/plugin-7.d: Adjust for plugin changes. * ld-plugin/plugin-8.d: Likewise. * ld-plugin/plugin.exp: Pass --verbose=2 for visibility test, and compare ld output to.. * ld-plugin/plugin-12.d: New.
2011-04-18 01:15:13 +02:00
else if ((h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
&& h->root.u.undef.abfd != NULL
&& (h->root.u.undef.abfd->flags & BFD_PLUGIN) != 0)
strip = TRUE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
Properly implement STT_COMMON The BFD configure option, --enable-elf-stt-common, can't be to used to verify STT_COMMON implementation with the normal binutils build. Instead, this patch removes it from BFD. It adds --elf-stt-common=[no|yes] to ELF assembler/objcopy and adds -z common/-z nocommon to ld. A configure option, --enable-elf-stt-common, is added to gas to specify whether ELF assembler should generate common symbols with the STT_COMMON type by default. Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF common symbols. bfd/ PR ld/19645 * bfd.c (bfd): Change flags to 20 bits. (BFD_CONVERT_ELF_COMMON): New. (BFD_USE_ELF_STT_COMMON): Likewise. (BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * configure.ac: Remove --enable-elf-stt-common. * elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. * elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for STT_COMMON. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check STT_COMMON. (elf_link_convert_common_type): New function. (elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. Set sym.st_info after sym.st_shndx. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON to object_flags. (TARGET_LITTLE_SYM): Likewise. * syms.c (BSF_KEEP_G): Renamed to ... (BSF_ELF_COMMON): This. * bfd-in2.h: Regenerated. * config.in: Likewise. * configure: Likewise. binutils/ PR ld/19645 * NEWS: Mention --elf-stt-common= for objcopy. * doc/binutils.texi: Document --elf-stt-common= for objcopy. * objcopy.c (do_elf_stt_common): New. (command_line_switch): Add OPTION_ELF_STT_COMMON. (copy_options): Add --elf-stt-common=. (copy_usage): Add --elf-stt-common=. (copy_object): Also check do_elf_stt_common for ELF targets. (copy_file): Handle do_elf_stt_common. (copy_main): Handle OPTION_ELF_STT_COMMON. * readelf.c (apply_relocations): Support STT_COMMON. * testsuite/binutils-all/common-1.s: New file. * testsuite/binutils-all/common-1a.d: Likewise. * testsuite/binutils-all/common-1b.d: Likewise. * testsuite/binutils-all/common-1c.d: Likewise. * testsuite/binutils-all/common-1d.d: Likewise. * testsuite/binutils-all/common-1e.d: Likewise. * testsuite/binutils-all/common-1f.d: Likewise. * testsuite/binutils-all/common-2.s: Likewise. * testsuite/binutils-all/common-2a.d: Likewise. * testsuite/binutils-all/common-2b.d: Likewise. * testsuite/binutils-all/common-2c.d: Likewise. * testsuite/binutils-all/common-2d.d: Likewise. * testsuite/binutils-all/common-2e.d: Likewise. * testsuite/binutils-all/common-2f.d: Likewise. * testsuite/binutils-all/objcopy.exp (objcopy_test_elf_common_symbols): New proc. Run objcopy_test_elf_common_symbols for ELF targets gas/ PR ld/19645 * NEWS: Mention --enable-elf-stt-common and --elf-stt-common= for ELF assemblers. * as.c (flag_use_elf_stt_common): New. (show_usage): Add --elf-stt-common=. (option_values): Add OPTION_ELF_STT_COMMON. (std_longopts): Add --elf-stt-common=. (parse_args): Handle --elf-stt-common=. * as.h (flag_use_elf_stt_common): New. * config.in: Regenerated. * configure: Likewise. * configure.ac: Add --enable-elf-stt-common and define DEFAULT_GENERATE_ELF_STT_COMMON. * gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set. * doc/as.texinfo: Document --elf-stt-common=. * testsuite/gas/elf/common3.s: New file. * testsuite/gas/elf/common3a.d: Likewise. * testsuite/gas/elf/common3b.d: Likewise. * testsuite/gas/elf/common4.s: Likewise. * testsuite/gas/elf/common4a.d: Likewise. * testsuite/gas/elf/common4b.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a and common4b. * testsuite/gas/i386/dw2-compress-3.d: Renamed to ... * testsuite/gas/i386/dw2-compress-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/dw2-compressed-3.d: Renamed to ... * testsuite/gas/i386/dw2-compressed-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/i386.exp: Run dw2-compress-3a, dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead of dw2-compress-3 and dw2-compressed-3. include/ PR ld/19645 * bfdlink.h (bfd_link_elf_stt_common): New enum. (bfd_link_info): Add elf_stt_common. ld/ PR ld/19645 * NEWS: Mention -z common/-z nocommon for ELF targets. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z common and -z nocommon. * ld.texinfo: Document -z common/-z nocommon. * lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon. * testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and --elf-stt-common=yes with assembler. * testsuite/ld-elfcomm/common-1.s: New file. * testsuite/ld-elfcomm/common-1a.d: Likewise. * testsuite/ld-elfcomm/common-1b.d: Likewise. * testsuite/ld-elfcomm/common-1c.d: Likewise. * testsuite/ld-elfcomm/common-1d.d: Likewise. * testsuite/ld-elfcomm/common-1e.d: Likewise. * testsuite/ld-elfcomm/common-1f.d: Likewise. * testsuite/ld-elfcomm/common-2.s: Likewise. * testsuite/ld-elfcomm/common-2a.d: Likewise. * testsuite/ld-elfcomm/common-2b.d: Likewise. * testsuite/ld-elfcomm/common-2c.d: Likewise. * testsuite/ld-elfcomm/common-2d.d: Likewise. * testsuite/ld-elfcomm/common-2e.d: Likewise. * testsuite/ld-elfcomm/common-2f.d: Likewise. * testsuite/ld-elfcomm/common-3a.rd: Likewise. * testsuite/ld-elfcomm/common-3b.rd: Likewise. * testsuite/ld-i386/pr19645.d: Likewise. * testsuite/ld-i386/pr19645.s: Likewise. * testsuite/ld-x86-64/largecomm-1.s: Likewise. * testsuite/ld-x86-64/largecomm-1a.d: Likewise. * testsuite/ld-x86-64/largecomm-1b.d: Likewise. * testsuite/ld-x86-64/largecomm-1c.d: Likewise. * testsuite/ld-x86-64/largecomm-1d.d: Likewise. * testsuite/ld-x86-64/largecomm-1e.d: Likewise. * testsuite/ld-x86-64/largecomm-1f.d: Likewise. * testsuite/ld-x86-64/pr19645.d: Likewise. * testsuite/ld-x86-64/pr19645.s: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes with assembler. (assembler_generates_commons): Removed. Run -z common/-z nocommon tests. Run *.d tests. * testsuite/ld-i386/i386.exp: Run pr19645. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with assembler. Test STT_COMMON with readelf.
2016-02-22 18:18:52 +01:00
type = h->type;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* If we're stripping it, and it's not a dynamic symbol, there's
nothing else to do. However, if it is a forced local symbol or
an ifunc symbol we need to give the backend finish_dynamic_symbol
function a chance to make it dynamic. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (strip
&& h->dynindx == -1
Properly implement STT_COMMON The BFD configure option, --enable-elf-stt-common, can't be to used to verify STT_COMMON implementation with the normal binutils build. Instead, this patch removes it from BFD. It adds --elf-stt-common=[no|yes] to ELF assembler/objcopy and adds -z common/-z nocommon to ld. A configure option, --enable-elf-stt-common, is added to gas to specify whether ELF assembler should generate common symbols with the STT_COMMON type by default. Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF common symbols. bfd/ PR ld/19645 * bfd.c (bfd): Change flags to 20 bits. (BFD_CONVERT_ELF_COMMON): New. (BFD_USE_ELF_STT_COMMON): Likewise. (BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * configure.ac: Remove --enable-elf-stt-common. * elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. * elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for STT_COMMON. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check STT_COMMON. (elf_link_convert_common_type): New function. (elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. Set sym.st_info after sym.st_shndx. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON to object_flags. (TARGET_LITTLE_SYM): Likewise. * syms.c (BSF_KEEP_G): Renamed to ... (BSF_ELF_COMMON): This. * bfd-in2.h: Regenerated. * config.in: Likewise. * configure: Likewise. binutils/ PR ld/19645 * NEWS: Mention --elf-stt-common= for objcopy. * doc/binutils.texi: Document --elf-stt-common= for objcopy. * objcopy.c (do_elf_stt_common): New. (command_line_switch): Add OPTION_ELF_STT_COMMON. (copy_options): Add --elf-stt-common=. (copy_usage): Add --elf-stt-common=. (copy_object): Also check do_elf_stt_common for ELF targets. (copy_file): Handle do_elf_stt_common. (copy_main): Handle OPTION_ELF_STT_COMMON. * readelf.c (apply_relocations): Support STT_COMMON. * testsuite/binutils-all/common-1.s: New file. * testsuite/binutils-all/common-1a.d: Likewise. * testsuite/binutils-all/common-1b.d: Likewise. * testsuite/binutils-all/common-1c.d: Likewise. * testsuite/binutils-all/common-1d.d: Likewise. * testsuite/binutils-all/common-1e.d: Likewise. * testsuite/binutils-all/common-1f.d: Likewise. * testsuite/binutils-all/common-2.s: Likewise. * testsuite/binutils-all/common-2a.d: Likewise. * testsuite/binutils-all/common-2b.d: Likewise. * testsuite/binutils-all/common-2c.d: Likewise. * testsuite/binutils-all/common-2d.d: Likewise. * testsuite/binutils-all/common-2e.d: Likewise. * testsuite/binutils-all/common-2f.d: Likewise. * testsuite/binutils-all/objcopy.exp (objcopy_test_elf_common_symbols): New proc. Run objcopy_test_elf_common_symbols for ELF targets gas/ PR ld/19645 * NEWS: Mention --enable-elf-stt-common and --elf-stt-common= for ELF assemblers. * as.c (flag_use_elf_stt_common): New. (show_usage): Add --elf-stt-common=. (option_values): Add OPTION_ELF_STT_COMMON. (std_longopts): Add --elf-stt-common=. (parse_args): Handle --elf-stt-common=. * as.h (flag_use_elf_stt_common): New. * config.in: Regenerated. * configure: Likewise. * configure.ac: Add --enable-elf-stt-common and define DEFAULT_GENERATE_ELF_STT_COMMON. * gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set. * doc/as.texinfo: Document --elf-stt-common=. * testsuite/gas/elf/common3.s: New file. * testsuite/gas/elf/common3a.d: Likewise. * testsuite/gas/elf/common3b.d: Likewise. * testsuite/gas/elf/common4.s: Likewise. * testsuite/gas/elf/common4a.d: Likewise. * testsuite/gas/elf/common4b.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a and common4b. * testsuite/gas/i386/dw2-compress-3.d: Renamed to ... * testsuite/gas/i386/dw2-compress-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/dw2-compressed-3.d: Renamed to ... * testsuite/gas/i386/dw2-compressed-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/i386.exp: Run dw2-compress-3a, dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead of dw2-compress-3 and dw2-compressed-3. include/ PR ld/19645 * bfdlink.h (bfd_link_elf_stt_common): New enum. (bfd_link_info): Add elf_stt_common. ld/ PR ld/19645 * NEWS: Mention -z common/-z nocommon for ELF targets. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z common and -z nocommon. * ld.texinfo: Document -z common/-z nocommon. * lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon. * testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and --elf-stt-common=yes with assembler. * testsuite/ld-elfcomm/common-1.s: New file. * testsuite/ld-elfcomm/common-1a.d: Likewise. * testsuite/ld-elfcomm/common-1b.d: Likewise. * testsuite/ld-elfcomm/common-1c.d: Likewise. * testsuite/ld-elfcomm/common-1d.d: Likewise. * testsuite/ld-elfcomm/common-1e.d: Likewise. * testsuite/ld-elfcomm/common-1f.d: Likewise. * testsuite/ld-elfcomm/common-2.s: Likewise. * testsuite/ld-elfcomm/common-2a.d: Likewise. * testsuite/ld-elfcomm/common-2b.d: Likewise. * testsuite/ld-elfcomm/common-2c.d: Likewise. * testsuite/ld-elfcomm/common-2d.d: Likewise. * testsuite/ld-elfcomm/common-2e.d: Likewise. * testsuite/ld-elfcomm/common-2f.d: Likewise. * testsuite/ld-elfcomm/common-3a.rd: Likewise. * testsuite/ld-elfcomm/common-3b.rd: Likewise. * testsuite/ld-i386/pr19645.d: Likewise. * testsuite/ld-i386/pr19645.s: Likewise. * testsuite/ld-x86-64/largecomm-1.s: Likewise. * testsuite/ld-x86-64/largecomm-1a.d: Likewise. * testsuite/ld-x86-64/largecomm-1b.d: Likewise. * testsuite/ld-x86-64/largecomm-1c.d: Likewise. * testsuite/ld-x86-64/largecomm-1d.d: Likewise. * testsuite/ld-x86-64/largecomm-1e.d: Likewise. * testsuite/ld-x86-64/largecomm-1f.d: Likewise. * testsuite/ld-x86-64/pr19645.d: Likewise. * testsuite/ld-x86-64/pr19645.s: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes with assembler. (assembler_generates_commons): Removed. Run -z common/-z nocommon tests. Run *.d tests. * testsuite/ld-i386/i386.exp: Run pr19645. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with assembler. Test STT_COMMON with readelf.
2016-02-22 18:18:52 +01:00
&& type != STT_GNU_IFUNC
2004-09-16 16:52:12 +02:00
&& !h->forced_local)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
sym.st_value = 0;
sym.st_size = h->size;
sym.st_other = h->other;
switch (h->root.type)
{
default:
case bfd_link_hash_new:
case bfd_link_hash_warning:
abort ();
return FALSE;
case bfd_link_hash_undefined:
case bfd_link_hash_undefweak:
input_sec = bfd_und_section_ptr;
sym.st_shndx = SHN_UNDEF;
break;
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
{
input_sec = h->root.u.def.section;
if (input_sec->output_section != NULL)
{
sym.st_shndx =
_bfd_elf_section_from_bfd_section (flinfo->output_bfd,
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
input_sec->output_section);
if (sym.st_shndx == SHN_BAD)
{
(*_bfd_error_handler)
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
(_("%B: could not find output section %A for input section %A"),
flinfo->output_bfd, input_sec->output_section, input_sec);
bfd_set_error (bfd_error_nonrepresentable_section);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
eoinfo->failed = TRUE;
return FALSE;
}
/* ELF symbols in relocatable files are section relative,
but in nonrelocatable files they are virtual
addresses. */
sym.st_value = h->root.u.def.value + input_sec->output_offset;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (flinfo->info))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
sym.st_value += input_sec->output_section->vma;
if (h->type == STT_TLS)
{
asection *tls_sec = elf_hash_table (flinfo->info)->tls_sec;
if (tls_sec != NULL)
sym.st_value -= tls_sec->vma;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
}
else
{
BFD_ASSERT (input_sec->owner == NULL
|| (input_sec->owner->flags & DYNAMIC) != 0);
sym.st_shndx = SHN_UNDEF;
input_sec = bfd_und_section_ptr;
}
}
break;
case bfd_link_hash_common:
input_sec = h->root.u.c.p->section;
sym.st_shndx = bed->common_section_index (input_sec);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
sym.st_value = 1 << h->root.u.c.p->alignment_power;
break;
case bfd_link_hash_indirect:
/* These symbols are created by symbol versioning. They point
to the decorated version of the name. For example, if the
symbol foo@@GNU_1.2 is the default, which should be used when
foo is used with no version, then we add an indirect symbol
foo which points to foo@@GNU_1.2. We ignore these symbols,
since the indirected symbol is already in the hash table. */
return TRUE;
}
Properly implement STT_COMMON The BFD configure option, --enable-elf-stt-common, can't be to used to verify STT_COMMON implementation with the normal binutils build. Instead, this patch removes it from BFD. It adds --elf-stt-common=[no|yes] to ELF assembler/objcopy and adds -z common/-z nocommon to ld. A configure option, --enable-elf-stt-common, is added to gas to specify whether ELF assembler should generate common symbols with the STT_COMMON type by default. Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF common symbols. bfd/ PR ld/19645 * bfd.c (bfd): Change flags to 20 bits. (BFD_CONVERT_ELF_COMMON): New. (BFD_USE_ELF_STT_COMMON): Likewise. (BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * configure.ac: Remove --enable-elf-stt-common. * elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. * elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for STT_COMMON. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check STT_COMMON. (elf_link_convert_common_type): New function. (elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. Set sym.st_info after sym.st_shndx. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON to object_flags. (TARGET_LITTLE_SYM): Likewise. * syms.c (BSF_KEEP_G): Renamed to ... (BSF_ELF_COMMON): This. * bfd-in2.h: Regenerated. * config.in: Likewise. * configure: Likewise. binutils/ PR ld/19645 * NEWS: Mention --elf-stt-common= for objcopy. * doc/binutils.texi: Document --elf-stt-common= for objcopy. * objcopy.c (do_elf_stt_common): New. (command_line_switch): Add OPTION_ELF_STT_COMMON. (copy_options): Add --elf-stt-common=. (copy_usage): Add --elf-stt-common=. (copy_object): Also check do_elf_stt_common for ELF targets. (copy_file): Handle do_elf_stt_common. (copy_main): Handle OPTION_ELF_STT_COMMON. * readelf.c (apply_relocations): Support STT_COMMON. * testsuite/binutils-all/common-1.s: New file. * testsuite/binutils-all/common-1a.d: Likewise. * testsuite/binutils-all/common-1b.d: Likewise. * testsuite/binutils-all/common-1c.d: Likewise. * testsuite/binutils-all/common-1d.d: Likewise. * testsuite/binutils-all/common-1e.d: Likewise. * testsuite/binutils-all/common-1f.d: Likewise. * testsuite/binutils-all/common-2.s: Likewise. * testsuite/binutils-all/common-2a.d: Likewise. * testsuite/binutils-all/common-2b.d: Likewise. * testsuite/binutils-all/common-2c.d: Likewise. * testsuite/binutils-all/common-2d.d: Likewise. * testsuite/binutils-all/common-2e.d: Likewise. * testsuite/binutils-all/common-2f.d: Likewise. * testsuite/binutils-all/objcopy.exp (objcopy_test_elf_common_symbols): New proc. Run objcopy_test_elf_common_symbols for ELF targets gas/ PR ld/19645 * NEWS: Mention --enable-elf-stt-common and --elf-stt-common= for ELF assemblers. * as.c (flag_use_elf_stt_common): New. (show_usage): Add --elf-stt-common=. (option_values): Add OPTION_ELF_STT_COMMON. (std_longopts): Add --elf-stt-common=. (parse_args): Handle --elf-stt-common=. * as.h (flag_use_elf_stt_common): New. * config.in: Regenerated. * configure: Likewise. * configure.ac: Add --enable-elf-stt-common and define DEFAULT_GENERATE_ELF_STT_COMMON. * gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set. * doc/as.texinfo: Document --elf-stt-common=. * testsuite/gas/elf/common3.s: New file. * testsuite/gas/elf/common3a.d: Likewise. * testsuite/gas/elf/common3b.d: Likewise. * testsuite/gas/elf/common4.s: Likewise. * testsuite/gas/elf/common4a.d: Likewise. * testsuite/gas/elf/common4b.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a and common4b. * testsuite/gas/i386/dw2-compress-3.d: Renamed to ... * testsuite/gas/i386/dw2-compress-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/dw2-compressed-3.d: Renamed to ... * testsuite/gas/i386/dw2-compressed-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/i386.exp: Run dw2-compress-3a, dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead of dw2-compress-3 and dw2-compressed-3. include/ PR ld/19645 * bfdlink.h (bfd_link_elf_stt_common): New enum. (bfd_link_info): Add elf_stt_common. ld/ PR ld/19645 * NEWS: Mention -z common/-z nocommon for ELF targets. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z common and -z nocommon. * ld.texinfo: Document -z common/-z nocommon. * lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon. * testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and --elf-stt-common=yes with assembler. * testsuite/ld-elfcomm/common-1.s: New file. * testsuite/ld-elfcomm/common-1a.d: Likewise. * testsuite/ld-elfcomm/common-1b.d: Likewise. * testsuite/ld-elfcomm/common-1c.d: Likewise. * testsuite/ld-elfcomm/common-1d.d: Likewise. * testsuite/ld-elfcomm/common-1e.d: Likewise. * testsuite/ld-elfcomm/common-1f.d: Likewise. * testsuite/ld-elfcomm/common-2.s: Likewise. * testsuite/ld-elfcomm/common-2a.d: Likewise. * testsuite/ld-elfcomm/common-2b.d: Likewise. * testsuite/ld-elfcomm/common-2c.d: Likewise. * testsuite/ld-elfcomm/common-2d.d: Likewise. * testsuite/ld-elfcomm/common-2e.d: Likewise. * testsuite/ld-elfcomm/common-2f.d: Likewise. * testsuite/ld-elfcomm/common-3a.rd: Likewise. * testsuite/ld-elfcomm/common-3b.rd: Likewise. * testsuite/ld-i386/pr19645.d: Likewise. * testsuite/ld-i386/pr19645.s: Likewise. * testsuite/ld-x86-64/largecomm-1.s: Likewise. * testsuite/ld-x86-64/largecomm-1a.d: Likewise. * testsuite/ld-x86-64/largecomm-1b.d: Likewise. * testsuite/ld-x86-64/largecomm-1c.d: Likewise. * testsuite/ld-x86-64/largecomm-1d.d: Likewise. * testsuite/ld-x86-64/largecomm-1e.d: Likewise. * testsuite/ld-x86-64/largecomm-1f.d: Likewise. * testsuite/ld-x86-64/pr19645.d: Likewise. * testsuite/ld-x86-64/pr19645.s: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes with assembler. (assembler_generates_commons): Removed. Run -z common/-z nocommon tests. Run *.d tests. * testsuite/ld-i386/i386.exp: Run pr19645. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with assembler. Test STT_COMMON with readelf.
2016-02-22 18:18:52 +01:00
if (type == STT_COMMON || type == STT_OBJECT)
switch (h->root.type)
{
case bfd_link_hash_common:
type = elf_link_convert_common_type (flinfo->info, type);
break;
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
if (bed->common_definition (&sym))
type = elf_link_convert_common_type (flinfo->info, type);
else
type = STT_OBJECT;
break;
case bfd_link_hash_undefined:
case bfd_link_hash_undefweak:
break;
default:
abort ();
}
if (local_bind)
{
sym.st_info = ELF_ST_INFO (STB_LOCAL, type);
/* Turn off visibility on local symbol. */
sym.st_other &= ~ELF_ST_VISIBILITY (-1);
}
/* Set STB_GNU_UNIQUE only if symbol is defined in regular object. */
else if (h->unique_global && h->def_regular)
sym.st_info = ELF_ST_INFO (STB_GNU_UNIQUE, type);
else if (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_defweak)
sym.st_info = ELF_ST_INFO (STB_WEAK, type);
else
sym.st_info = ELF_ST_INFO (STB_GLOBAL, type);
sym.st_target_internal = h->target_internal;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Give the processor backend a chance to tweak the symbol value,
and also to finish up anything that needs to be done for this
symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for
forced local syms when non-shared is due to a historical quirk.
STT_GNU_IFUNC symbol must go through PLT. */
if ((h->type == STT_GNU_IFUNC
&& h->def_regular
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& !bfd_link_relocatable (flinfo->info))
|| ((h->dynindx != -1
|| h->forced_local)
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& ((bfd_link_pic (flinfo->info)
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak))
|| !h->forced_local)
&& elf_hash_table (flinfo->info)->dynamic_sections_created))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
if (! ((*bed->elf_backend_finish_dynamic_symbol)
(flinfo->output_bfd, flinfo->info, h, &sym)))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
eoinfo->failed = TRUE;
return FALSE;
}
}
/* If we are marking the symbol as undefined, and there are no
non-weak references to this symbol from a regular object, then
mark the symbol as weak undefined; if there are non-weak
references, mark the symbol as strong. We can't do this earlier,
because it might not be marked as undefined until the
finish_dynamic_symbol routine gets through with it. */
if (sym.st_shndx == SHN_UNDEF
2004-09-16 16:52:12 +02:00
&& h->ref_regular
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
&& (ELF_ST_BIND (sym.st_info) == STB_GLOBAL
|| ELF_ST_BIND (sym.st_info) == STB_WEAK))
{
int bindtype;
Properly implement STT_COMMON The BFD configure option, --enable-elf-stt-common, can't be to used to verify STT_COMMON implementation with the normal binutils build. Instead, this patch removes it from BFD. It adds --elf-stt-common=[no|yes] to ELF assembler/objcopy and adds -z common/-z nocommon to ld. A configure option, --enable-elf-stt-common, is added to gas to specify whether ELF assembler should generate common symbols with the STT_COMMON type by default. Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF common symbols. bfd/ PR ld/19645 * bfd.c (bfd): Change flags to 20 bits. (BFD_CONVERT_ELF_COMMON): New. (BFD_USE_ELF_STT_COMMON): Likewise. (BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * configure.ac: Remove --enable-elf-stt-common. * elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. * elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for STT_COMMON. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check STT_COMMON. (elf_link_convert_common_type): New function. (elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for common symbol depending on BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON. Set sym.st_info after sym.st_shndx. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON to object_flags. (TARGET_LITTLE_SYM): Likewise. * syms.c (BSF_KEEP_G): Renamed to ... (BSF_ELF_COMMON): This. * bfd-in2.h: Regenerated. * config.in: Likewise. * configure: Likewise. binutils/ PR ld/19645 * NEWS: Mention --elf-stt-common= for objcopy. * doc/binutils.texi: Document --elf-stt-common= for objcopy. * objcopy.c (do_elf_stt_common): New. (command_line_switch): Add OPTION_ELF_STT_COMMON. (copy_options): Add --elf-stt-common=. (copy_usage): Add --elf-stt-common=. (copy_object): Also check do_elf_stt_common for ELF targets. (copy_file): Handle do_elf_stt_common. (copy_main): Handle OPTION_ELF_STT_COMMON. * readelf.c (apply_relocations): Support STT_COMMON. * testsuite/binutils-all/common-1.s: New file. * testsuite/binutils-all/common-1a.d: Likewise. * testsuite/binutils-all/common-1b.d: Likewise. * testsuite/binutils-all/common-1c.d: Likewise. * testsuite/binutils-all/common-1d.d: Likewise. * testsuite/binutils-all/common-1e.d: Likewise. * testsuite/binutils-all/common-1f.d: Likewise. * testsuite/binutils-all/common-2.s: Likewise. * testsuite/binutils-all/common-2a.d: Likewise. * testsuite/binutils-all/common-2b.d: Likewise. * testsuite/binutils-all/common-2c.d: Likewise. * testsuite/binutils-all/common-2d.d: Likewise. * testsuite/binutils-all/common-2e.d: Likewise. * testsuite/binutils-all/common-2f.d: Likewise. * testsuite/binutils-all/objcopy.exp (objcopy_test_elf_common_symbols): New proc. Run objcopy_test_elf_common_symbols for ELF targets gas/ PR ld/19645 * NEWS: Mention --enable-elf-stt-common and --elf-stt-common= for ELF assemblers. * as.c (flag_use_elf_stt_common): New. (show_usage): Add --elf-stt-common=. (option_values): Add OPTION_ELF_STT_COMMON. (std_longopts): Add --elf-stt-common=. (parse_args): Handle --elf-stt-common=. * as.h (flag_use_elf_stt_common): New. * config.in: Regenerated. * configure: Likewise. * configure.ac: Add --enable-elf-stt-common and define DEFAULT_GENERATE_ELF_STT_COMMON. * gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set. * doc/as.texinfo: Document --elf-stt-common=. * testsuite/gas/elf/common3.s: New file. * testsuite/gas/elf/common3a.d: Likewise. * testsuite/gas/elf/common3b.d: Likewise. * testsuite/gas/elf/common4.s: Likewise. * testsuite/gas/elf/common4a.d: Likewise. * testsuite/gas/elf/common4b.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a and common4b. * testsuite/gas/i386/dw2-compress-3.d: Renamed to ... * testsuite/gas/i386/dw2-compress-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/dw2-compressed-3.d: Renamed to ... * testsuite/gas/i386/dw2-compressed-3a.d: This. Pass --elf-stt-common=no to as. * testsuite/gas/i386/i386.exp: Run dw2-compress-3a, dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead of dw2-compress-3 and dw2-compressed-3. include/ PR ld/19645 * bfdlink.h (bfd_link_elf_stt_common): New enum. (bfd_link_info): Add elf_stt_common. ld/ PR ld/19645 * NEWS: Mention -z common/-z nocommon for ELF targets. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z common and -z nocommon. * ld.texinfo: Document -z common/-z nocommon. * lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon. * testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and --elf-stt-common=yes with assembler. * testsuite/ld-elfcomm/common-1.s: New file. * testsuite/ld-elfcomm/common-1a.d: Likewise. * testsuite/ld-elfcomm/common-1b.d: Likewise. * testsuite/ld-elfcomm/common-1c.d: Likewise. * testsuite/ld-elfcomm/common-1d.d: Likewise. * testsuite/ld-elfcomm/common-1e.d: Likewise. * testsuite/ld-elfcomm/common-1f.d: Likewise. * testsuite/ld-elfcomm/common-2.s: Likewise. * testsuite/ld-elfcomm/common-2a.d: Likewise. * testsuite/ld-elfcomm/common-2b.d: Likewise. * testsuite/ld-elfcomm/common-2c.d: Likewise. * testsuite/ld-elfcomm/common-2d.d: Likewise. * testsuite/ld-elfcomm/common-2e.d: Likewise. * testsuite/ld-elfcomm/common-2f.d: Likewise. * testsuite/ld-elfcomm/common-3a.rd: Likewise. * testsuite/ld-elfcomm/common-3b.rd: Likewise. * testsuite/ld-i386/pr19645.d: Likewise. * testsuite/ld-i386/pr19645.s: Likewise. * testsuite/ld-x86-64/largecomm-1.s: Likewise. * testsuite/ld-x86-64/largecomm-1a.d: Likewise. * testsuite/ld-x86-64/largecomm-1b.d: Likewise. * testsuite/ld-x86-64/largecomm-1c.d: Likewise. * testsuite/ld-x86-64/largecomm-1d.d: Likewise. * testsuite/ld-x86-64/largecomm-1e.d: Likewise. * testsuite/ld-x86-64/largecomm-1f.d: Likewise. * testsuite/ld-x86-64/pr19645.d: Likewise. * testsuite/ld-x86-64/pr19645.s: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes with assembler. (assembler_generates_commons): Removed. Run -z common/-z nocommon tests. Run *.d tests. * testsuite/ld-i386/i386.exp: Run pr19645. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with assembler. Test STT_COMMON with readelf.
2016-02-22 18:18:52 +01:00
type = ELF_ST_TYPE (sym.st_info);
/* Turn an undefined IFUNC symbol into a normal FUNC symbol. */
if (type == STT_GNU_IFUNC)
type = STT_FUNC;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
2004-09-16 16:52:12 +02:00
if (h->ref_regular_nonweak)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bindtype = STB_GLOBAL;
else
bindtype = STB_WEAK;
sym.st_info = ELF_ST_INFO (bindtype, type);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
/* If this is a symbol defined in a dynamic library, don't use the
symbol size from the dynamic library. Relinking an executable
against a new library may introduce gratuitous changes in the
executable's symbols if we keep the size. */
if (sym.st_shndx == SHN_UNDEF
&& !h->def_regular
&& h->def_dynamic)
sym.st_size = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* If a non-weak symbol with non-default visibility is not defined
locally, it is a fatal error. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (flinfo->info)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
&& ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT
&& ELF_ST_BIND (sym.st_info) != STB_WEAK
&& h->root.type == bfd_link_hash_undefined
2004-09-16 16:52:12 +02:00
&& !h->def_regular)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
const char *msg;
if (ELF_ST_VISIBILITY (sym.st_other) == STV_PROTECTED)
msg = _("%B: protected symbol `%s' isn't defined");
else if (ELF_ST_VISIBILITY (sym.st_other) == STV_INTERNAL)
msg = _("%B: internal symbol `%s' isn't defined");
else
msg = _("%B: hidden symbol `%s' isn't defined");
(*_bfd_error_handler) (msg, flinfo->output_bfd, h->root.root.string);
bfd_set_error (bfd_error_bad_value);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
eoinfo->failed = TRUE;
return FALSE;
}
/* If this symbol should be put in the .dynsym section, then put it
there now. We already know the symbol index. We also fill in
the entry in the .hash section. */
if (elf_hash_table (flinfo->info)->dynsym != NULL
&& h->dynindx != -1
&& elf_hash_table (flinfo->info)->dynamic_sections_created)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd_byte *esym;
/* Since there is no version information in the dynamic string,
if there is no version info in symbol version section, we will
have a run-time problem if not linking executable, referenced
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
by shared library, not locally defined, or not bound locally.
*/
if (h->verinfo.verdef == NULL
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
&& !local_bind
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& (!bfd_link_executable (flinfo->info)
|| h->ref_dynamic
|| !h->def_regular))
{
char *p = strrchr (h->root.root.string, ELF_VER_CHR);
if (p && p [1] != '\0')
{
(*_bfd_error_handler)
(_("%B: No symbol version section for versioned symbol `%s'"),
flinfo->output_bfd, h->root.root.string);
eoinfo->failed = TRUE;
return FALSE;
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
sym.st_name = h->dynstr_index;
esym = (elf_hash_table (flinfo->info)->dynsym->contents
+ h->dynindx * bed->s->sizeof_sym);
if (!check_dynsym (flinfo->output_bfd, &sym))
{
eoinfo->failed = TRUE;
return FALSE;
}
bed->s->swap_symbol_out (flinfo->output_bfd, &sym, esym, 0);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (flinfo->hash_sec != NULL)
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
{
size_t hash_entry_size;
bfd_byte *bucketpos;
bfd_vma chain;
size_t bucketcount;
size_t bucket;
bucketcount = elf_hash_table (flinfo->info)->bucketcount;
bucket = h->u.elf_hash_value % bucketcount;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
hash_entry_size
= elf_section_data (flinfo->hash_sec)->this_hdr.sh_entsize;
bucketpos = ((bfd_byte *) flinfo->hash_sec->contents
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
+ (bucket + 2) * hash_entry_size);
chain = bfd_get (8 * hash_entry_size, flinfo->output_bfd, bucketpos);
bfd_put (8 * hash_entry_size, flinfo->output_bfd, h->dynindx,
bucketpos);
bfd_put (8 * hash_entry_size, flinfo->output_bfd, chain,
((bfd_byte *) flinfo->hash_sec->contents
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
+ (bucketcount + 2 + h->dynindx) * hash_entry_size));
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (flinfo->symver_sec != NULL && flinfo->symver_sec->contents != NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
Elf_Internal_Versym iversym;
Elf_External_Versym *eversym;
2004-09-16 16:52:12 +02:00
if (!h->def_regular)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
if (h->verinfo.verdef == NULL
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)
& (DYN_AS_NEEDED | DYN_DT_NEEDED | DYN_NO_NEEDED)))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
iversym.vs_vers = 0;
else
iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1;
}
else
{
if (h->verinfo.vertree == NULL)
iversym.vs_vers = 1;
else
iversym.vs_vers = h->verinfo.vertree->vernum + 1;
if (flinfo->info->create_default_symver)
iversym.vs_vers++;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
/* Turn on VERSYM_HIDDEN only if the hidden versioned symbol is
Properly merge hidden versioned symbol The hidden versioned symbol can only be merged with the versioned symbol with the same symbol version. _bfd_elf_merge_symbol should check the symbol version before merging the new hidden versioned symbol with the existing symbol. _bfd_elf_link_hash_copy_indirect can't copy any references to the hidden versioned symbol. We need to bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. bfd/ PR ld/18720 * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate if the new symbol matches the existing one. The new hidden versioned symbol matches the existing symbol if they have the same symbol version. Update the existing symbol only if they match. (_bfd_elf_add_default_symbol): Update call to _bfd_elf_merge_symbol. (_bfd_elf_link_assign_sym_version): Don't set the hidden field here. (elf_link_add_object_symbols): Override a definition only if the new symbol matches the existing one. (_bfd_elf_link_hash_copy_indirect): Don't copy any references to the hidden versioned symbol. (elf_link_output_extsym): Bind a symbol locally when linking executable if it is locally defined, hidden versioned, not referenced by shared library and not exported. Turn on VERSYM_HIDDEN only if the hidden vesioned symbol is defined locally. ld/testsuite/ PR ld/18720 * ld-elf/indirect.exp: Run tests for PR ld/18720. * ld-elf/pr18720.out: New file. * ld-elf/pr18720a.c: Likewise. * ld-elf/pr18720b.c: Likewise. * ld-elf/pr18720c.c: Likewise.
2015-08-07 14:04:21 +02:00
defined locally. */
if (h->versioned == versioned_hidden && h->def_regular)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
iversym.vs_vers |= VERSYM_HIDDEN;
eversym = (Elf_External_Versym *) flinfo->symver_sec->contents;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
eversym += h->dynindx;
_bfd_elf_swap_versym_out (flinfo->output_bfd, &iversym, eversym);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
/* If the symbol is undefined, and we didn't output it to .dynsym,
strip it from .symtab too. Obviously we can't do this for
relocatable output or when needed for --emit-relocs. */
else if (input_sec == bfd_und_section_ptr
&& h->indx != -2
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& !bfd_link_relocatable (flinfo->info))
return TRUE;
/* Also strip others that we couldn't earlier due to dynamic symbol
processing. */
if (strip)
return TRUE;
if ((input_sec->flags & SEC_EXCLUDE) != 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
Properly place the NULL STT_FILE symbol revistited I was having a little closer look at what is going on here and noticed that HJ unconditionally emits a NULL STT_FILE symbol before emitting forced local symbols. That means we really don't need a second pass over forced local symbols. The only reason for two passes is when some forced local symbol can be emitted before the NULL STT_FILE. So I set about removing the second pass, updating the testsuite all over again. It's also unnecessary to emit the NULL STT_FILE when no previous file symbol has been emitted. bfd/ PR ld/17975 * elflink.c (struct elf_outext_info): Remove need_second_pass and second_pass. (elf_link_output_extsym): Delete code handling second forced local pass. Move code emitting NULL STT_FILE symbol later, so that it can be omitted if forced local is stripped. Don't emit the NULL STT_FILE if no file symbols have been output. (bfd_elf_final_link): Remove second forced local pass. * elf32-ppc.c (add_stub_sym): Set linker_def on linker syms. (ppc_elf_size_dynamic_sections): Likewise. * elf64-ppc.c (ppc_build_one_stub): Likewise. (build_global_entry_stubs): Likewise. (ppc64_elf_build_stubs): Likewise. ld/testsuite/ PR ld/17975 * ld-aarch64/gc-tls-relocs.d, * ld-alpha/tlspic.rd, * ld-cris/libdso-2.d, * ld-i386/tlsdesc-nacl.rd, * ld-i386/tlsdesc.rd, * ld-i386/tlsnopic-nacl.rd, * ld-i386/tlsnopic.rd, * ld-i386/tlspic-nacl.rd, * ld-i386/tlspic.rd, * ld-ia64/tlspic.rd, * ld-powerpc/tlsexe.r, * ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.r, * ld-powerpc/tlstocso.r, * ld-s390/tlspic.rd, * ld-s390/tlspic_64.rd, * ld-sparc/tlssunnopic32.rd, * ld-sparc/tlssunnopic64.rd, * ld-sparc/tlssunpic32.rd, * ld-sparc/tlssunpic64.rd, * ld-tic6x/shlib-1.rd, * ld-tic6x/shlib-1b.rd, * ld-tic6x/shlib-1r.rd, * ld-tic6x/shlib-1rb.rd, * ld-tic6x/shlib-noindex.rd, * ld-x86-64/tlsdesc-nacl.rd, * ld-x86-64/tlsdesc.rd, * ld-x86-64/tlspic-nacl.rd, * ld-x86-64/tlspic.rd: Update.
2015-02-16 23:44:59 +01:00
/* Output a FILE symbol so that following locals are not associated
with the wrong input file. We need one for forced local symbols
if we've seen more than one FILE symbol or when we have exactly
one FILE symbol but global symbols are present in a file other
than the one with the FILE symbol. We also need one if linker
defined symbols are present. In practice these conditions are
always met, so just emit the FILE symbol unconditionally. */
if (eoinfo->localsyms
&& !eoinfo->file_sym_done
&& eoinfo->flinfo->filesym_count != 0)
{
Elf_Internal_Sym fsym;
memset (&fsym, 0, sizeof (fsym));
fsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
fsym.st_shndx = SHN_ABS;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
if (!elf_link_output_symstrtab (eoinfo->flinfo, NULL, &fsym,
bfd_und_section_ptr, NULL))
Properly place the NULL STT_FILE symbol revistited I was having a little closer look at what is going on here and noticed that HJ unconditionally emits a NULL STT_FILE symbol before emitting forced local symbols. That means we really don't need a second pass over forced local symbols. The only reason for two passes is when some forced local symbol can be emitted before the NULL STT_FILE. So I set about removing the second pass, updating the testsuite all over again. It's also unnecessary to emit the NULL STT_FILE when no previous file symbol has been emitted. bfd/ PR ld/17975 * elflink.c (struct elf_outext_info): Remove need_second_pass and second_pass. (elf_link_output_extsym): Delete code handling second forced local pass. Move code emitting NULL STT_FILE symbol later, so that it can be omitted if forced local is stripped. Don't emit the NULL STT_FILE if no file symbols have been output. (bfd_elf_final_link): Remove second forced local pass. * elf32-ppc.c (add_stub_sym): Set linker_def on linker syms. (ppc_elf_size_dynamic_sections): Likewise. * elf64-ppc.c (ppc_build_one_stub): Likewise. (build_global_entry_stubs): Likewise. (ppc64_elf_build_stubs): Likewise. ld/testsuite/ PR ld/17975 * ld-aarch64/gc-tls-relocs.d, * ld-alpha/tlspic.rd, * ld-cris/libdso-2.d, * ld-i386/tlsdesc-nacl.rd, * ld-i386/tlsdesc.rd, * ld-i386/tlsnopic-nacl.rd, * ld-i386/tlsnopic.rd, * ld-i386/tlspic-nacl.rd, * ld-i386/tlspic.rd, * ld-ia64/tlspic.rd, * ld-powerpc/tlsexe.r, * ld-powerpc/tlsexetoc.r, * ld-powerpc/tlsso.r, * ld-powerpc/tlstocso.r, * ld-s390/tlspic.rd, * ld-s390/tlspic_64.rd, * ld-sparc/tlssunnopic32.rd, * ld-sparc/tlssunnopic64.rd, * ld-sparc/tlssunpic32.rd, * ld-sparc/tlssunpic64.rd, * ld-tic6x/shlib-1.rd, * ld-tic6x/shlib-1b.rd, * ld-tic6x/shlib-1r.rd, * ld-tic6x/shlib-1rb.rd, * ld-tic6x/shlib-noindex.rd, * ld-x86-64/tlsdesc-nacl.rd, * ld-x86-64/tlsdesc.rd, * ld-x86-64/tlspic-nacl.rd, * ld-x86-64/tlspic.rd: Update.
2015-02-16 23:44:59 +01:00
return FALSE;
eoinfo->file_sym_done = TRUE;
}
indx = bfd_get_symcount (flinfo->output_bfd);
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
ret = elf_link_output_symstrtab (flinfo, h->root.root.string, &sym,
input_sec, h);
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
if (ret == 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
eoinfo->failed = TRUE;
return FALSE;
}
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
else if (ret == 1)
h->indx = indx;
else if (h->indx == -2)
abort();
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
/* Return TRUE if special handling is done for relocs in SEC against
symbols defined in discarded sections. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
static bfd_boolean
elf_section_ignore_discarded_relocs (asection *sec)
{
const struct elf_backend_data *bed;
switch (sec->sec_info_type)
{
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
case SEC_INFO_TYPE_STABS:
case SEC_INFO_TYPE_EH_FRAME:
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
case SEC_INFO_TYPE_EH_FRAME_ENTRY:
return TRUE;
default:
break;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bed = get_elf_backend_data (sec->owner);
if (bed->elf_backend_ignore_discarded_relocs != NULL
&& (*bed->elf_backend_ignore_discarded_relocs) (sec))
return TRUE;
return FALSE;
}
/* Return a mask saying how ld should treat relocations in SEC against
symbols defined in discarded sections. If this function returns
COMPLAIN set, ld will issue a warning message. If this function
returns PRETEND set, and the discarded section was link-once and the
same size as the kept link-once section, ld will pretend that the
symbol was actually defined in the kept section. Otherwise ld will
zero the reloc (at least that is the intent, but some cooperation by
the target dependent code is needed, particularly for REL targets). */
unsigned int
_bfd_elf_default_action_discarded (asection *sec)
{
if (sec->flags & SEC_DEBUGGING)
return PRETEND;
if (strcmp (".eh_frame", sec->name) == 0)
return 0;
if (strcmp (".gcc_except_table", sec->name) == 0)
return 0;
return COMPLAIN | PRETEND;
}
/* Find a match between a section and a member of a section group. */
static asection *
2006-10-31 00:25:51 +01:00
match_group_member (asection *sec, asection *group,
struct bfd_link_info *info)
{
asection *first = elf_next_in_group (group);
asection *s = first;
while (s != NULL)
{
2006-10-31 00:25:51 +01:00
if (bfd_elf_match_symbols_in_sections (s, sec, info))
return s;
s = elf_next_in_group (s);
if (s == first)
break;
}
return NULL;
}
/* Check if the kept section of a discarded section SEC can be used
to replace it. Return the replacement if it is OK. Otherwise return
NULL. */
asection *
2006-10-31 00:25:51 +01:00
_bfd_elf_check_kept_section (asection *sec, struct bfd_link_info *info)
{
asection *kept;
kept = sec->kept_section;
if (kept != NULL)
{
if ((kept->flags & SEC_GROUP) != 0)
2006-10-31 00:25:51 +01:00
kept = match_group_member (sec, kept, info);
if (kept != NULL
&& ((sec->rawsize != 0 ? sec->rawsize : sec->size)
!= (kept->rawsize != 0 ? kept->rawsize : kept->size)))
kept = NULL;
sec->kept_section = kept;
}
return kept;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Link an input file into the linker output file. This function
handles all the sections and relocations of the input file at once.
This is so that we only have to read the local symbols once, and
don't have to keep them in memory. */
static bfd_boolean
elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
int (*relocate_section)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
bfd *output_bfd;
Elf_Internal_Shdr *symtab_hdr;
size_t locsymcount;
size_t extsymoff;
Elf_Internal_Sym *isymbuf;
Elf_Internal_Sym *isym;
Elf_Internal_Sym *isymend;
long *pindex;
asection **ppsection;
asection *o;
const struct elf_backend_data *bed;
struct elf_link_hash_entry **sym_hashes;
bfd_size_type address_size;
bfd_vma r_type_mask;
int r_sym_shift;
bfd_boolean have_file_sym = FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
output_bfd = flinfo->output_bfd;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bed = get_elf_backend_data (output_bfd);
relocate_section = bed->elf_backend_relocate_section;
/* If this is a dynamic object, we don't want to do anything here:
we don't want the local symbols, and we don't want the section
contents. */
if ((input_bfd->flags & DYNAMIC) != 0)
return TRUE;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
if (elf_bad_symtab (input_bfd))
{
locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
extsymoff = 0;
}
else
{
locsymcount = symtab_hdr->sh_info;
extsymoff = symtab_hdr->sh_info;
}
/* Read the local symbols. */
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
if (isymbuf == NULL && locsymcount != 0)
{
isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0,
flinfo->internal_syms,
flinfo->external_syms,
flinfo->locsym_shndx);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (isymbuf == NULL)
return FALSE;
}
/* Find local symbol sections and adjust values of symbols in
SEC_MERGE sections. Write out those local symbols we know are
going into the output file. */
isymend = isymbuf + locsymcount;
for (isym = isymbuf, pindex = flinfo->indices, ppsection = flinfo->sections;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
isym < isymend;
isym++, pindex++, ppsection++)
{
asection *isec;
const char *name;
Elf_Internal_Sym osym;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
long indx;
int ret;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
*pindex = -1;
if (elf_bad_symtab (input_bfd))
{
if (ELF_ST_BIND (isym->st_info) != STB_LOCAL)
{
*ppsection = NULL;
continue;
}
}
if (isym->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr;
else if (isym->st_shndx == SHN_ABS)
isec = bfd_abs_section_ptr;
else if (isym->st_shndx == SHN_COMMON)
isec = bfd_com_section_ptr;
else
{
isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx);
if (isec == NULL)
{
/* Don't attempt to output symbols with st_shnx in the
reserved range other than SHN_ABS and SHN_COMMON. */
*ppsection = NULL;
continue;
}
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
else if (isec->sec_info_type == SEC_INFO_TYPE_MERGE
&& ELF_ST_TYPE (isym->st_info) != STT_SECTION)
isym->st_value =
_bfd_merged_section_offset (output_bfd, &isec,
elf_section_data (isec)->sec_info,
isym->st_value);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
*ppsection = isec;
/* Don't output the first, undefined, symbol. In fact, don't
output any undefined local symbol. */
if (isec == bfd_und_section_ptr)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
continue;
if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
{
/* We never output section symbols. Instead, we use the
section symbol of the corresponding section in the output
file. */
continue;
}
/* If we are stripping all symbols, we don't want to output this
one. */
if (flinfo->info->strip == strip_all)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
continue;
/* If we are discarding all local symbols, we don't want to
output this one. If we are generating a relocatable output
file, then some of the local symbols may be required by
relocs; we output them below as we discover that they are
needed. */
if (flinfo->info->discard == discard_all)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
continue;
/* If this symbol is defined in a section which we are
discarding, we don't need to keep it. */
if (isym->st_shndx != SHN_UNDEF
include/elf/ PR 5900 * common.h (SHN_BAD): Delete. (SHN_LORESERVE .. SHN_HIRESERVE): Move to.. * external.h: ..here. * internal.h (SHN_LORESERVE, SHN_HIRESERVE): Define. (SHN_LOPROC, SHN_HIPROC, SHN_LOOS, SHN_HIOS): Define. (SHN_ABS, SHN_COMMON, SHN_XINDEX, SHN_BAD): Define. bfd/ PR 5900 * elf-bfd.h: Include elf/internal.h after elf/external.h. * elfcode.h (elf_swap_symbol_in): Map reserved shndx range. (elf_swap_symbol_out): Adjust SHN_XINDEX test. (elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. (valid_section_index_p): Delete. (elf_object_p): Don't increment section numbers over reserved range. Simplify test for valid sh_link, sh_info and e_shstrndx fields. (elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. Don't increment section numbers over reserved range. * elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx. (bfd_section_from_shdr): Likewise. (group_signature): Range check before accessing elf_elfsections. (_bfd_elf_setup_sections): Likewise. (bfd_section_from_shdr): Likewise. (bfd_section_from_shdr): Don't increment section number over reserved sections. (assign_file_positions_for_non_load_sections): Likewise. (assign_file_positions_except_relocs): Likewise. (_bfd_elf_write_object_contents): Likewise. (assign_section_numbers): Likewise. Adjust for changed SHN_*. (prep_headers): Delete unused variable. * elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust for changed SHN_* values. (check_dynsym, elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. Don't skip over reserved section range. (elf_fixup_link_order): Check that sh_link field is valid. * elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned. * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before accesssing elf_elfsections. * elf32-avr.c (elf32_avr_size_stubs): Likewise. * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise. * elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed SHN_* defines. Test for SHN_BAD return from _bfd_elf_section_from_bfd_section binutils/ PR 5900 * readelf.c (SECTION_HEADER_INDEX, SECTION_HEADER_NUM): Delete. Remove use throughout file. (SECTION_HEADER): Likewise. (dump_relocations): Don't adjust st_shndx for reserved range. (process_file_header): Mask SHN_XINDEX to values seen in external elf structs. Simplify valid section index tests. (get_32bit_elf_symbols, get_64bit_elf_symbols): Mask SHN_XINDEX. Map reserved st_shndx to internal form. (process_section_groups): Test that group symbol st_shndx is in range, not just non-zero. Delete reserved range check. (get_symbol_index_type): Mask "type" to 16 bits when printing PRC, OS or RSV. gdb/ PR 5900 * elfread.c (elf_symtab_read): Make shndx an unsigned int. * mipsread.c: Include elf/internal.h. (read_alphacoff_dynamic_symtab): Map external reserved sym_shndx to internal range. ld/testsuite/ PR 5900 * ld-elf/sec64k.exp: Update.
2008-03-12 09:37:09 +01:00
&& isym->st_shndx < SHN_LORESERVE
&& bfd_section_removed_from_list (output_bfd,
isec->output_section))
continue;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Get the name of the symbol. */
name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link,
isym->st_name);
if (name == NULL)
return FALSE;
/* See if we are discarding symbols with this name. */
if ((flinfo->info->strip == strip_some
&& (bfd_hash_lookup (flinfo->info->keep_hash, name, FALSE, FALSE)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
== NULL))
|| (((flinfo->info->discard == discard_sec_merge
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& (isec->flags & SEC_MERGE)
&& !bfd_link_relocatable (flinfo->info))
|| flinfo->info->discard == discard_l)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
&& bfd_is_local_label_name (input_bfd, name)))
continue;
if (ELF_ST_TYPE (isym->st_info) == STT_FILE)
{
PR ld/17973 LTO file syms LTO output objects have an STT_FILE symbol using the name of the file, a temporary file. This results in executables that can't be exactly reproduced, so the file name needs to be dropped. We don't want to lose all file symbols when linking a mix of lto and non-lto objects as a file symbol can be used to figure which source file generated a given local symbol. So lto output objects need to be marked. I chose to mark lto output objects with a new bfd flag. This flag is also used to fix a bug in the link-once handling; An object being loaded after "loading_lto_outputs" is set might be one extracted from an archive to satisfy new references from lto objects, not an lto object itself. The new flag is copied from archive to elements, and the same done for no_export. This fixes a bug in that --exclude-libs doesn't work with thin archives. I'm not completely happy with this part of the patch and may revist this to avoid the hack in _bfd_look_for_bfd_in_cache. PR ld/17973 include/ * bfdlink.h (struct bfd_link_info): Delete loading_lto_outputs. bfd/ * bfd.c (struct bfd): Add lto_output. * linker.c (_bfd_handle_already_linked): Explicitly test for objects added by the lto plugin. * opncls.c (_bfd_new_bfd_contained_in): Copy lto_output and no_export flags from archive. * archive.c (open_nested_file): New function, setting lto_output and no_export, extracted from.. (find_nested_archive): ..here. Flip params. Rename from _bfd_find_nested_archive. (_bfd_get_elt_at_filepos): Correct var typo. Use open_nested_file. (_bfd_look_for_bfd_in_cache): Copy no_export. * elflink.c (elf_link_add_object_symbols): Remove now unnecessary my_archive->no_export test. (elf_link_input_bfd): Drop existing lto_output STT_FILE syms. Don't use the file name when adding lto_output STT_FILE sym. * bfd-in2.h: Regenerate. ld/ * ldlang.h (struct lang_input_statement_flags): Add lto_output. * ldlang.c (lang_process): Don't set loading_lto_outputs. * ldfile.c (ldfile_try_open_bfd): Transfer entry flags.lto_output to bfd. * plugin.c (add_input_file, add_input_library): Set flags.lto_output.
2015-02-14 09:08:32 +01:00
if (input_bfd->lto_output)
/* -flto puts a temp file name here. This means builds
are not reproducible. Discard the symbol. */
continue;
have_file_sym = TRUE;
flinfo->filesym_count += 1;
}
if (!have_file_sym)
{
/* In the absence of debug info, bfd_find_nearest_line uses
FILE symbols to determine the source file for local
function symbols. Provide a FILE symbol here if input
files lack such, so that their symbols won't be
associated with a previous input file. It's not the
source file, but the best we can do. */
have_file_sym = TRUE;
flinfo->filesym_count += 1;
memset (&osym, 0, sizeof (osym));
osym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
osym.st_shndx = SHN_ABS;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
if (!elf_link_output_symstrtab (flinfo,
(input_bfd->lto_output ? NULL
: input_bfd->filename),
&osym, bfd_abs_section_ptr,
NULL))
return FALSE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
osym = *isym;
/* Adjust the section index for the output file. */
osym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
isec->output_section);
if (osym.st_shndx == SHN_BAD)
return FALSE;
/* ELF symbols in relocatable files are section relative, but
in executable files they are virtual addresses. Note that
this code assumes that all ELF sections have an associated
BFD section with a reasonable value for output_offset; below
we assume that they also have a reasonable value for
output_section. Any special sections must be set up to meet
these requirements. */
osym.st_value += isec->output_offset;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (flinfo->info))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
osym.st_value += isec->output_section->vma;
if (ELF_ST_TYPE (osym.st_info) == STT_TLS)
{
/* STT_TLS symbols are relative to PT_TLS segment base. */
BFD_ASSERT (elf_hash_table (flinfo->info)->tls_sec != NULL);
osym.st_value -= elf_hash_table (flinfo->info)->tls_sec->vma;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
indx = bfd_get_symcount (output_bfd);
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
ret = elf_link_output_symstrtab (flinfo, name, &osym, isec, NULL);
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
if (ret == 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
else if (ret == 1)
*pindex = indx;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
if (bed->s->arch_size == 32)
{
r_type_mask = 0xff;
r_sym_shift = 8;
address_size = 4;
}
else
{
r_type_mask = 0xffffffff;
r_sym_shift = 32;
address_size = 8;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Relocate the contents of each section. */
sym_hashes = elf_sym_hashes (input_bfd);
for (o = input_bfd->sections; o != NULL; o = o->next)
{
bfd_byte *contents;
if (! o->linker_mark)
{
/* This section was omitted from the link. */
continue;
}
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_relocatable (flinfo->info)
&& (o->flags & (SEC_LINKER_CREATED | SEC_GROUP)) == SEC_GROUP)
{
/* Deal with the group signature symbol. */
struct bfd_elf_section_data *sec_data = elf_section_data (o);
unsigned long symndx = sec_data->this_hdr.sh_info;
asection *osec = o->output_section;
if (symndx >= locsymcount
|| (elf_bad_symtab (input_bfd)
&& flinfo->sections[symndx] == NULL))
{
struct elf_link_hash_entry *h = sym_hashes[symndx - extsymoff];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
/* Arrange for symbol to be output. */
h->indx = -2;
elf_section_data (osec)->this_hdr.sh_info = -2;
}
else if (ELF_ST_TYPE (isymbuf[symndx].st_info) == STT_SECTION)
{
/* We'll use the output section target_index. */
asection *sec = flinfo->sections[symndx]->output_section;
elf_section_data (osec)->this_hdr.sh_info = sec->target_index;
}
else
{
if (flinfo->indices[symndx] == -1)
{
/* Otherwise output the local symbol now. */
Elf_Internal_Sym sym = isymbuf[symndx];
asection *sec = flinfo->sections[symndx]->output_section;
const char *name;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
long indx;
int ret;
name = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
sym.st_name);
if (name == NULL)
return FALSE;
sym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
sec);
if (sym.st_shndx == SHN_BAD)
return FALSE;
sym.st_value += o->output_offset;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
indx = bfd_get_symcount (output_bfd);
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
ret = elf_link_output_symstrtab (flinfo, name, &sym, o,
NULL);
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
if (ret == 0)
return FALSE;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
else if (ret == 1)
flinfo->indices[symndx] = indx;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
else
abort ();
}
elf_section_data (osec)->this_hdr.sh_info
= flinfo->indices[symndx];
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if ((o->flags & SEC_HAS_CONTENTS) == 0
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
|| (o->size == 0 && (o->flags & SEC_RELOC) == 0))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
continue;
if ((o->flags & SEC_LINKER_CREATED) != 0)
{
/* Section was created by _bfd_elf_link_create_dynamic_sections
or somesuch. */
continue;
}
/* Get the contents of the section. They have been cached by a
relaxation routine. Note that o is a section in an input
file, so the contents field will not have been set by any of
the routines which work on output files. */
if (elf_section_data (o)->this_hdr.contents != NULL)
{
contents = elf_section_data (o)->this_hdr.contents;
if (bed->caches_rawsize
&& o->rawsize != 0
&& o->rawsize < o->size)
{
memcpy (flinfo->contents, contents, o->rawsize);
contents = flinfo->contents;
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
else
{
contents = flinfo->contents;
Add compressed debug section support to binutils and ld. bfd/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> Cary Coutant <ccoutant@google.com> * archive.c (bfd_openr_next_archived_file): Copy BFD_COMPRESS and BFD_DECOMPRESS. * bfd.c (BFD_COMPRESS): New. (BFD_DECOMPRESS): Likewise. (BFD_FLAGS_SAVED): Likewise. (bfd_preserve_save): Replace BFD_IN_MEMORY with BFD_FLAGS_SAVED. * compress.c (bfd_uncompress_section_contents): Removed. (get_uncompressed_size): New. (decompress_contents): Likewise. (bfd_compress_section_contents): Likewise. (bfd_get_full_section_contents): Likewise. (bfd_is_section_compressed): Likewise. (bfd_init_section_decompress_status): Likewise. (bfd_init_section_compress_status): Likewise. * dwarf2.c (dwarf_debug_sections): New. (dwarf_debug_section_enum): Likewise. (read_section): Remove section_name and compressed_section_name. Add dwarf_debug_section_enum. Try compressed debug section. (read_indirect_string): Updated. (read_abbrevs): Likewise. (decode_line_info): Likewise. (read_debug_ranges): Likewise. (find_line): Updated. * ecoff.c (bfd_debug_section): Add compress_status and compressed_size. * elf.c (_bfd_elf_make_section_from_shdr): Call bfd_is_section_compressed to check if a DWARF debug section is compressed. Call bfd_init_section_compress_status or bfd_init_section_decompress_status if needed. * elflink.c (elf_link_input_bfd): Replace bfd_get_section_contents with bfd_get_full_section_contents. * merge.c (_bfd_add_merge_section): Likewise. * reloc.c (bfd_generic_get_relocated_section_contents): Likewise. * simple.c (bfd_simple_get_relocated_section_contents): Likewise. * elfxx-target.h (TARGET_BIG_SYM): Allow BFD_COMPRESS and BFD_DECOMPRESS. (TARGET_LITTLE_SYM): Likewise. * libbfd-in.h (dwarf_debug_section): New. (dwarf_debug_sections): Likewise. * libbfd.c (_bfd_generic_get_section_contents): Issue an error when getting contents on compressed/decompressed section. * section.c (COMPRESS_SECTION_NONE): New. (COMPRESS_SECTION_DONE): Likewise. (DECOMPRESS_SECTION_SIZED): Likewise. (BFD_FAKE_SECTION): Add compress_status and compressed_size. (bfd_malloc_and_get_section): Replace bfd_get_section_contents with bfd_get_full_section_contents. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. binutils/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * addr2line.c (process_file): Set BFD_DECOMPRESS. * objcopy.c (do_debug_sections): New. (OPTION_COMPRESS_DEBUG_SECTIONS): New. (OPTION_DECOMPRESS_DEBUG_SECTIONS): Likewise. (copy_options): Add OPTION_COMPRESS_DEBUG_SECTIONS and OPTION_DECOMPRESS_DEBUG_SECTIONS. (copy_usage): Add --compress-debug-sections and --decompress-debug-sections. (copy_file): Set BFD_COMPRESS or BFD_DECOMPRESS. (copy_section): Replace bfd_get_section_contents with bfd_get_full_section_contents. (copy_main): Handle OPTION_COMPRESS_DEBUG_SECTIONS and OPTION_DECOMPRESS_DEBUG_SECTIONS. Check do_debug_sections to rename DWARF debug sections. * objdump.c (load_specific_debug_section): Replace bfd_get_section_contents with bfd_get_full_section_contents. Remove bfd_uncompress_section_contents. (dump_section): Replace bfd_get_section_contents with bfd_get_full_section_contents. (display_file): Set BFD_DECOMPRESS if needed. * readelf.c (uncompress_section_contents): Set buffer to NULL to indiate decompression failure. (load_specific_debug_section): Always call uncompress_section_contents. * doc/binutils.texi: Document --compress-debug-sections and --decompress-debug-sections. binutils/testsuite/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * binutils-all/compress.exp: New. * binutils-all/dw2-1.S: Likewise. * binutils-all/dw2-2.S: Likewise. * binutils-all/libdw2-compressed.out: Likewise. * binutils-all/libdw2.out: Likewise. gas/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * write.c (compress_debug): Optimize section flags check. gas/testsuite/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * elf/dwarf2-1.s: Replace .zdebug_abbrev section with .debug_abbrev section. * elf/dwarf2-2.3: Likewise. * elf/dwarf2-1.d: Pass --compress-debug-sections to assembler. Updated. * elf/dwarf2-2.d: Likewise. * gas/i386/i386.exp: Remove xfail on dw2-compress-2 and x86-64-dw2-compress-2. ld/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * ldfile.c (ldfile_try_open_bfd): Set BFD_DECOMPRESS after bfd_openr returns. * emultempl/elf32.em (gld${EMULATION_NAME}_try_needed): Likewise. * scripttempl/elf.sc: Include compressed DWARF debug sections. ld/testsuite/ 2010-10-29 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/compress.exp: New. * ld-elf/compress1.s: Likewise. * ld-elf/compress1a.d: Likewise. * ld-elf/compress1b.d: Likewise. * ld-elf/compress1c.d: Likewise.
2010-10-29 14:10:39 +02:00
if (! bfd_get_full_section_contents (input_bfd, o, &contents))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
}
if ((o->flags & SEC_RELOC) != 0)
{
Elf_Internal_Rela *internal_relocs;
Elf_Internal_Rela *rel, *relend;
int action_discarded;
int ret;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Get the swapped relocs. */
internal_relocs
= _bfd_elf_link_read_relocs (input_bfd, o, flinfo->external_relocs,
flinfo->internal_relocs, FALSE);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (internal_relocs == NULL
&& o->reloc_count > 0)
return FALSE;
/* We need to reverse-copy input .ctors/.dtors sections if
they are placed in .init_array/.finit_array for output. */
if (o->size > address_size
&& ((strncmp (o->name, ".ctors", 6) == 0
&& strcmp (o->output_section->name,
".init_array") == 0)
|| (strncmp (o->name, ".dtors", 6) == 0
&& strcmp (o->output_section->name,
".fini_array") == 0))
&& (o->name[6] == 0 || o->name[6] == '.'))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
if (o->size != o->reloc_count * address_size)
{
(*_bfd_error_handler)
(_("error: %B: size of section %A is not "
"multiple of address size"),
input_bfd, o);
bfd_set_error (bfd_error_on_input);
return FALSE;
}
o->flags |= SEC_ELF_REVERSE_COPY;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
action_discarded = -1;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (!elf_section_ignore_discarded_relocs (o))
action_discarded = (*bed->action_discarded) (o);
/* Run through the relocs evaluating complex reloc symbols and
looking for relocs against symbols from discarded sections
or section symbols from removed link-once sections.
Complain about relocs against discarded sections. Zero
relocs against removed link-once sections. */
rel = internal_relocs;
relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;
for ( ; rel < relend; rel++)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
unsigned long r_symndx = rel->r_info >> r_sym_shift;
unsigned int s_type;
asection **ps, *sec;
struct elf_link_hash_entry *h = NULL;
const char *sym_name;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (r_symndx == STN_UNDEF)
continue;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (r_symndx >= locsymcount
|| (elf_bad_symtab (input_bfd)
&& flinfo->sections[r_symndx] == NULL))
{
h = sym_hashes[r_symndx - extsymoff];
/* Badly formatted input files can contain relocs that
reference non-existant symbols. Check here so that
we do not seg fault. */
if (h == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
char buffer [32];
sprintf_vma (buffer, rel->r_info);
(*_bfd_error_handler)
(_("error: %B contains a reloc (0x%s) for section %A "
"that references a non-existent global symbol"),
input_bfd, o, buffer);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
bfd/ * elf-bfd.h (struct elf_backend_data): Remove got_symbol_offset. * elfxx-target.h (elf_backend_got_symbol_offset): Delete. * elflink.c (_bfd_elf_create_got_section): Use zero in place of got_symbol_offset. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise. * elf32-frv.c (_frv_create_got_section): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Delete ppc code. (elf_backend_got_symbol_offset): Don't define. * elf64-ppc.c (elf_backend_got_symbol_offset): Don't define. * elf32-ppc.c (struct ppc_elf_link_hash_table): Add got_header_size and got_gap. (ppc_elf_create_got): Tidy. (ppc_elf_create_dynamic_sections): Don't set SEC_IN_MEMORY for .plt. (ppc_elf_check_relocs): Reduce string comparisons by using elf.hgot. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_relocate_section): Likewise. (ppc_elf_finish_dynamic_symbol): Likewise. (allocate_got): New function. (allocate_dynrelocs): Use allocate_got. (ppc_elf_size_dynamic_sections): Likewise. Delay tlsld_got allocation so that local got can refcount it. Set got_header_size. (ppc_elf_relocate_section): Use value of elf.hgot rather than hard- coded 4. (ppc_elf_finish_dynamic_sections): Likewise. (elf_backend_got_symbol_offset): Don't define. (elf_backend_got_header_size): Ditto. ld/testsuite/ * ld-powerpc/tlsexe32.d: Update for changed got layout. * ld-powerpc/tlsexe32.g: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.r: Likewise.
2005-05-07 04:55:55 +02:00
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
s_type = h->type;
/* If a plugin symbol is referenced from a non-IR file,
mark the symbol as undefined. Note that the
linker may attach linker created dynamic sections
to the plugin bfd. Symbols defined in linker
created sections are not plugin symbols. */
if (h->root.non_ir_ref
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& (h->root.u.def.section->flags
& SEC_LINKER_CREATED) == 0
&& h->root.u.def.section->owner != NULL
&& (h->root.u.def.section->owner->flags
& BFD_PLUGIN) != 0)
{
h->root.type = bfd_link_hash_undefined;
h->root.u.undef.abfd = h->root.u.def.section->owner;
}
ps = NULL;
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
ps = &h->root.u.def.section;
sym_name = h->root.root.string;
}
else
{
Elf_Internal_Sym *sym = isymbuf + r_symndx;
s_type = ELF_ST_TYPE (sym->st_info);
ps = &flinfo->sections[r_symndx];
sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr,
sym, *ps);
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if ((s_type == STT_RELC || s_type == STT_SRELC)
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& !bfd_link_relocatable (flinfo->info))
{
bfd_vma val;
bfd_vma dot = (rel->r_offset
+ o->output_offset + o->output_section->vma);
#ifdef DEBUG
printf ("Encountered a complex symbol!");
printf (" (input_bfd %s, section %s, reloc %ld\n",
2010-10-08 16:00:50 +02:00
input_bfd->filename, o->name,
(long) (rel - internal_relocs));
printf (" symbol: idx %8.8lx, name %s\n",
r_symndx, sym_name);
printf (" reloc : info %8.8lx, addr %8.8lx\n",
(unsigned long) rel->r_info,
(unsigned long) rel->r_offset);
#endif
if (!eval_symbol (&val, &sym_name, input_bfd, flinfo, dot,
isymbuf, locsymcount, s_type == STT_SRELC))
return FALSE;
/* Symbol evaluated OK. Update to absolute value. */
set_symbol_value (input_bfd, isymbuf, locsymcount,
r_symndx, val);
continue;
}
if (action_discarded != -1 && ps != NULL)
{
/* Complain if the definition comes from a
discarded section. */
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
if ((sec = *ps) != NULL && discarded_section (sec))
{
BFD_ASSERT (r_symndx != STN_UNDEF);
if (action_discarded & COMPLAIN)
(*flinfo->info->callbacks->einfo)
(_("%X`%s' referenced in section `%A' of %B: "
"defined in discarded section `%A' of %B\n"),
sym_name, o, input_bfd, sec, sec->owner);
/* Try to do the best we can to support buggy old
versions of gcc. Pretend that the symbol is
really defined in the kept linkonce section.
FIXME: This is quite broken. Modifying the
symbol here means we will be changing all later
uses of the symbol, not just in this section. */
if (action_discarded & PRETEND)
{
asection *kept;
2006-10-31 00:25:51 +01:00
kept = _bfd_elf_check_kept_section (sec,
flinfo->info);
if (kept != NULL)
{
*ps = kept;
continue;
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
}
/* Relocate the section by invoking a back end routine.
The back end routine is responsible for adjusting the
section contents as necessary, and (if using Rela relocs
and generating a relocatable output file) adjusting the
reloc addend as necessary.
The back end routine does not have to worry about setting
the reloc address or the reloc symbol index.
The back end routine is given a pointer to the swapped in
internal symbols, and can access the hash table entries
for the external symbols via elf_sym_hashes (input_bfd).
When generating relocatable output, the back end routine
must handle STB_LOCAL/STT_SECTION symbols specially. The
output symbol is going to be a section symbol
corresponding to the output section, which will require
the addend to be adjusted. */
ret = (*relocate_section) (output_bfd, flinfo->info,
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
input_bfd, o, contents,
internal_relocs,
isymbuf,
flinfo->sections);
if (!ret)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
if (ret == 2
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
|| bfd_link_relocatable (flinfo->info)
|| flinfo->info->emitrelocations)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
Elf_Internal_Rela *irela;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
Elf_Internal_Rela *irelaend, *irelamid;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_vma last_offset;
struct elf_link_hash_entry **rel_hash;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct elf_link_hash_entry **rel_hash_list, **rela_hash_list;
Elf_Internal_Shdr *input_rel_hdr, *input_rela_hdr;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
unsigned int next_erel;
bfd_boolean rela_normal;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_data *esdi, *esdo;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
esdi = elf_section_data (o);
esdo = elf_section_data (o->output_section);
rela_normal = FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Adjust the reloc addresses and symbol indices. */
irela = internal_relocs;
irelaend = irela + o->reloc_count * bed->s->int_rels_per_ext_rel;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
rel_hash = esdo->rel.hashes + esdo->rel.count;
/* We start processing the REL relocs, if any. When we reach
IRELAMID in the loop, we switch to the RELA relocs. */
irelamid = irela;
if (esdi->rel.hdr != NULL)
irelamid += (NUM_SHDR_ENTRIES (esdi->rel.hdr)
* bed->s->int_rels_per_ext_rel);
2005-05-05 Paul Brook <paul@codesourcery.com> bfd/ * config.bfd: Use bfd_elf32_i386_vxworks_vec for i?86-*-vxworks. * configure.in: Add bfd_elf32_i386_vxworks_vec. i386 targets need elf-vxworks.lo. * configure: Regenerate. * Makefile.am (BFD32_BACKENDS): Add elf-vxworks.lo. (BFD32_BACKENDS_CFILES): Add elf-vxworks.c. (elf32-i386.lo): Depend on elf-vxworks.h. (elf-vxworks.lo): New rule. * Makefile.in: Regenerate. * elf-bfd.h (elf_backend_data): Update type of elf_backend_emit_relocs. (_bfd_elf_link_output_relocs): Update prototype. * elflink.c (_bfd_elf_link_output_relocs): Always use bed->elf_backend_emit_relocs when outputting relocations. * elfxx-target.h (elf_backend_emit_relocs): Default to _bfd_elf_link_output_relocs. * targets.c (bfd_elf32_i386_vxworks_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_vxworks_vec. * elf32-i386.c: Add elf32-i386-vxworks target BFD. (elf_i386_plt0_entry): Remove padding. (elf_i386_pic_plt0_entry): Ditto. (PLTRESOLVE_RELOCS_SHLIB, PLTRESOLVE_RELOCS): Define. (PLT_NON_JUMP_SLOT_RELOCS): Define. (elf_i386_link_hash_table): Add srelplt2, hgot, hplt, is_vxworks and plt0_pad_byte fields. (elf_i386_link_hash_table_create): Zero them. (elf_i386_create_dynamic_sections): Create static relocation section. (allocate_dynrelocs): Allocate space for static PLT relocations. (elf_i386_size_dynamic_sections): Save shortcuts to PLT and GOT symbols. Give PLT symbols function type. Don't strip PLT sections if we have exported symbols from them. (elf_i386_finish_dynamic_symbol): Fill in VxWorks PLT static relocation section. Don't mark _GLOBAL_OFFSET_TABLE_ as absolute on VxWorks. (elf_i386_finish_dynamic_sections): Allow different pad bytes. Add relocation for GOT location. Fill in PLT static relocations. (elf_i386_vxworks_link_hash_table_create): New function. (elf_i386_vxworks_link_output_symbol_hook): New function. * elf-vxworks.h: New file. gas/ * config/tc-i386.h (ELF_TARGET_FORMAT): Define for TE_VXWORKS. gas/testsuite/ * gas/i386/i386.exp: Don't run divide test on vxworks. ld/ * Makefile.am: Add eelf_i386_vxworks. * Makefile.in: Regenerate. * configure.tgt: Make i?86-*-vxworks use targ_emul=elf_i386_vxworks. * emulparams/elf_i386_vxworks.sh: New file. * emulparams/vxworks.sh: New file. * scripttempl/elf.sc: Add DATA_END_SYMBOLS and ETEXT_NAME.
2005-05-05 16:37:27 +02:00
rel_hash_list = rel_hash;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
rela_hash_list = NULL;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
last_offset = o->output_offset;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (flinfo->info))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
last_offset += o->output_section->vma;
for (next_erel = 0; irela < irelaend; irela++, next_erel++)
{
unsigned long r_symndx;
asection *sec;
Elf_Internal_Sym sym;
if (next_erel == bed->s->int_rels_per_ext_rel)
{
rel_hash++;
next_erel = 0;
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (irela == irelamid)
{
rel_hash = esdo->rela.hashes + esdo->rela.count;
rela_hash_list = rel_hash;
rela_normal = bed->rela_normal;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
irela->r_offset = _bfd_elf_section_offset (output_bfd,
flinfo->info, o,
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
irela->r_offset);
if (irela->r_offset >= (bfd_vma) -2)
{
/* This is a reloc for a deleted entry or somesuch.
Turn it into an R_*_NONE reloc, at the same
offset as the last reloc. elf_eh_frame.c and
bfd_elf_discard_info rely on reloc offsets
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
being ordered. */
irela->r_offset = last_offset;
irela->r_info = 0;
irela->r_addend = 0;
continue;
}
irela->r_offset += o->output_offset;
/* Relocs in an executable have to be virtual addresses. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (flinfo->info))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
irela->r_offset += o->output_section->vma;
last_offset = irela->r_offset;
r_symndx = irela->r_info >> r_sym_shift;
if (r_symndx == STN_UNDEF)
continue;
if (r_symndx >= locsymcount
|| (elf_bad_symtab (input_bfd)
&& flinfo->sections[r_symndx] == NULL))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
struct elf_link_hash_entry *rh;
unsigned long indx;
/* This is a reloc against a global symbol. We
have not yet output all the local symbols, so
we do not know the symbol index of any global
symbol. We set the rel_hash entry for this
reloc to point to the global hash table entry
for this symbol. The symbol index is then
set at the end of bfd_elf_final_link. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
indx = r_symndx - extsymoff;
rh = elf_sym_hashes (input_bfd)[indx];
while (rh->root.type == bfd_link_hash_indirect
|| rh->root.type == bfd_link_hash_warning)
rh = (struct elf_link_hash_entry *) rh->root.u.i.link;
/* Setting the index to -2 tells
elf_link_output_extsym that this symbol is
used by a reloc. */
BFD_ASSERT (rh->indx < 0);
rh->indx = -2;
*rel_hash = rh;
continue;
}
/* This is a reloc against a local symbol. */
*rel_hash = NULL;
sym = isymbuf[r_symndx];
sec = flinfo->sections[r_symndx];
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (ELF_ST_TYPE (sym.st_info) == STT_SECTION)
{
/* I suppose the backend ought to fill in the
section of any STT_SECTION symbol against a
processor specific section. */
r_symndx = STN_UNDEF;
if (bfd_is_abs_section (sec))
;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
else
{
asection *osec = sec->output_section;
/* If we have discarded a section, the output
section will be the absolute section. In
PR 3958 bfd/ * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): No error on relocatable link. (elf_discarded_section): Move.. * bfd-in.h: ..to here. * bfd-in2.h: Regenerate. * elflink.c (elf_link_input_bfd): Don't zap relocs against symbols from discarded sections before relocate_section has done its job. * reloc.c (bfd_generic_get_relocated_section_contents): Handle relocs against symbols from discarded sections. * elf-hppa.h (elf_hppa_howto_table): Set size. Set dst_mask on SECREL32. (elf_hppa_relocate_section): Handle relocatable link after setting sec, sym, h etc. for final link. Squash error messages for relocatable link. Clear section contents for relocs against symbols in discarded sections, and zero reloc. Remove existing zero r_symndx code. * elf-m10200.c (mn10200_elf_relocate_section): Likewise. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-avr.c (elf32_avr_relocate_section): Likewise. * elf32-bfin.c (bfinfdpic_relocate_section): Likewise. (bfin_relocate_section): Likewise. * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-crx.c (elf32_crx_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-h8300.c (elf32_h8_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise. * elf32-m32c.c (m32c_elf_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-mep.c (mep_elf_relocate_section): Likewise. * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. * elf32-mt.c (mt_elf_relocate_section): Likewise. * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-score.c (_bfd_score_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-v850.c (v850_elf_relocate_section): Likewise. * elf32-vax.c (elf_vax_relocate_section): Likewise. * elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise. * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-mmix.c (mmix_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elf32-arm.c (elf32_arm_relocate_section): Always adjust section symbols for relocatable link. Don't use always-zero st_value. (elf_backend_rela_normal): Don't define. * elf32-bfin.c (bfinfdpic_relocate_section): Use RELOC_FOR_GLOBAL_SYMBOL. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Combine SEC_MERGE section symbol adjustments with same for relocatable link. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m68hc1x.c (m68hc11_get_relocation_value): Move.. (elf32_m68hc11_check_relocs): ..to here. * elf32-score.c (score_elf_final_link_relocate): Remove zero r_symndx code. * elfxx-mips.c (mips_elf_calculate_relocation): Likewise. ld/testsuite/ * ld-elf/linkonce1.d: New. * ld-elf/linkonce1a.s: New. * ld-elf/linkonce1b.s: New. * ld-elf/linkonce2.d: New. * ld-i386/pcrel16abs.d: New. * ld-i386/pcrel16abs.s: New. * ld-i386/i386.exp: Run it.
2007-03-07 09:54:35 +01:00
case of discarded SEC_MERGE sections, use
the kept section. relocate_section should
have already handled discarded linkonce
sections. */
if (bfd_is_abs_section (osec)
&& sec->kept_section != NULL
&& sec->kept_section->output_section != NULL)
{
osec = sec->kept_section->output_section;
irela->r_addend -= osec->vma;
}
if (!bfd_is_abs_section (osec))
{
r_symndx = osec->target_index;
if (r_symndx == STN_UNDEF)
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
{
irela->r_addend += osec->vma;
osec = _bfd_nearby_section (output_bfd, osec,
osec->vma);
irela->r_addend -= osec->vma;
r_symndx = osec->target_index;
bfd/ * elf-bfd.h (struct elf_link_hash_table): Reorder. Add text_index_section and data_index_section. (struct elf_backend_data): Add elf_backend_init_index_section. (_bfd_elf_init_1_index_section): Declare. (_bfd_elf_init_2_index_sections): Declare. * elfxx-target.h (elf_backend_init_index_section): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls section and text_index_section plus data_index_section. (_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections. (_bfd_elf_init_1_index_section): New function. (_bfd_elf_init_2_index_sections): New function. (bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section. (elf_link_input_bfd): When emitting relocs, use text_index_section and data_index_section for removed sections. * elf-m10300.c (elf_backend_omit_section_dynsym): Define. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-sh.c: Likewise. * elf32-xstormy16.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-mmix.c: Likewise. * elf64-sh64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section and data_index_section sym for relocs against sections with no dynamic section sym. (elf_backend_init_index_section): Define. * elf32-cris.c: Similarly. * elf32-hppa.c: Similarly. * elf32-i370.c: Similarly. * elf32-m68k.c: Similarly. * elf32-mips.c: Similarly. * elf32-ppc.c: Similarly. * elf32-s390.c: Similarly. * elf32-sparc.c: Similarly. * elf32-vax.c: Similarly. * elf64-mips.c: Similarly. * elf64-ppc.c: Similarly. * elf64-s390.c: Similarly. * elf64-sparc.c: Similarly. * elf64-x86-64.c: Similarly. * elfn32-mips.c: Similarly. * elfxx-mips.c: Similarly. * elfxx-sparc.c: Similarly. * linker.c (fix_syms): Base symbols in removed sections on previous section in preference to using absolute section. ld/ * ldlang.c (strip_excluded_output_sections): Do strip sections that define syms, but don't ignore them. * ld.texinfo (Output Section Discarding): Revise. * emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call finish_default. ld/testsuite/ Update for section sym changes.
2006-10-17 15:41:49 +02:00
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
/* Adjust the addend according to where the
section winds up in the output section. */
if (rela_normal)
irela->r_addend += sec->output_offset;
}
else
{
if (flinfo->indices[r_symndx] == -1)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
unsigned long shlink;
const char *name;
asection *osec;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
long indx;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (flinfo->info->strip == strip_all)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
/* You can't do ld -r -s. */
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
/* This symbol was skipped earlier, but
since it is needed by a reloc, we
must output it now. */
shlink = symtab_hdr->sh_link;
name = (bfd_elf_string_from_elf_section
(input_bfd, shlink, sym.st_name));
if (name == NULL)
return FALSE;
osec = sec->output_section;
sym.st_shndx =
_bfd_elf_section_from_bfd_section (output_bfd,
osec);
if (sym.st_shndx == SHN_BAD)
return FALSE;
sym.st_value += sec->output_offset;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (flinfo->info))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
sym.st_value += osec->vma;
if (ELF_ST_TYPE (sym.st_info) == STT_TLS)
{
/* STT_TLS symbols are relative to PT_TLS
segment base. */
BFD_ASSERT (elf_hash_table (flinfo->info)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
->tls_sec != NULL);
sym.st_value -= (elf_hash_table (flinfo->info)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
->tls_sec->vma);
}
}
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
indx = bfd_get_symcount (output_bfd);
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
ret = elf_link_output_symstrtab (flinfo, name,
&sym, sec,
NULL);
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
if (ret == 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
else if (ret == 1)
flinfo->indices[r_symndx] = indx;
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
else
abort ();
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
r_symndx = flinfo->indices[r_symndx];
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
irela->r_info = ((bfd_vma) r_symndx << r_sym_shift
| (irela->r_info & r_type_mask));
}
/* Swap out the relocs. */
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
input_rel_hdr = esdi->rel.hdr;
if (input_rel_hdr && input_rel_hdr->sh_size != 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (!bed->elf_backend_emit_relocs (output_bfd, o,
input_rel_hdr,
internal_relocs,
rel_hash_list))
return FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
* bed->s->int_rels_per_ext_rel);
2005-05-05 Paul Brook <paul@codesourcery.com> bfd/ * config.bfd: Use bfd_elf32_i386_vxworks_vec for i?86-*-vxworks. * configure.in: Add bfd_elf32_i386_vxworks_vec. i386 targets need elf-vxworks.lo. * configure: Regenerate. * Makefile.am (BFD32_BACKENDS): Add elf-vxworks.lo. (BFD32_BACKENDS_CFILES): Add elf-vxworks.c. (elf32-i386.lo): Depend on elf-vxworks.h. (elf-vxworks.lo): New rule. * Makefile.in: Regenerate. * elf-bfd.h (elf_backend_data): Update type of elf_backend_emit_relocs. (_bfd_elf_link_output_relocs): Update prototype. * elflink.c (_bfd_elf_link_output_relocs): Always use bed->elf_backend_emit_relocs when outputting relocations. * elfxx-target.h (elf_backend_emit_relocs): Default to _bfd_elf_link_output_relocs. * targets.c (bfd_elf32_i386_vxworks_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_vxworks_vec. * elf32-i386.c: Add elf32-i386-vxworks target BFD. (elf_i386_plt0_entry): Remove padding. (elf_i386_pic_plt0_entry): Ditto. (PLTRESOLVE_RELOCS_SHLIB, PLTRESOLVE_RELOCS): Define. (PLT_NON_JUMP_SLOT_RELOCS): Define. (elf_i386_link_hash_table): Add srelplt2, hgot, hplt, is_vxworks and plt0_pad_byte fields. (elf_i386_link_hash_table_create): Zero them. (elf_i386_create_dynamic_sections): Create static relocation section. (allocate_dynrelocs): Allocate space for static PLT relocations. (elf_i386_size_dynamic_sections): Save shortcuts to PLT and GOT symbols. Give PLT symbols function type. Don't strip PLT sections if we have exported symbols from them. (elf_i386_finish_dynamic_symbol): Fill in VxWorks PLT static relocation section. Don't mark _GLOBAL_OFFSET_TABLE_ as absolute on VxWorks. (elf_i386_finish_dynamic_sections): Allow different pad bytes. Add relocation for GOT location. Fill in PLT static relocations. (elf_i386_vxworks_link_hash_table_create): New function. (elf_i386_vxworks_link_output_symbol_hook): New function. * elf-vxworks.h: New file. gas/ * config/tc-i386.h (ELF_TARGET_FORMAT): Define for TE_VXWORKS. gas/testsuite/ * gas/i386/i386.exp: Don't run divide test on vxworks. ld/ * Makefile.am: Add eelf_i386_vxworks. * Makefile.in: Regenerate. * configure.tgt: Make i?86-*-vxworks use targ_emul=elf_i386_vxworks. * emulparams/elf_i386_vxworks.sh: New file. * emulparams/vxworks.sh: New file. * scripttempl/elf.sc: Add DATA_END_SYMBOLS and ETEXT_NAME.
2005-05-05 16:37:27 +02:00
rel_hash_list += NUM_SHDR_ENTRIES (input_rel_hdr);
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
}
input_rela_hdr = esdi->rela.hdr;
if (input_rela_hdr && input_rela_hdr->sh_size != 0)
{
2005-05-05 Paul Brook <paul@codesourcery.com> bfd/ * config.bfd: Use bfd_elf32_i386_vxworks_vec for i?86-*-vxworks. * configure.in: Add bfd_elf32_i386_vxworks_vec. i386 targets need elf-vxworks.lo. * configure: Regenerate. * Makefile.am (BFD32_BACKENDS): Add elf-vxworks.lo. (BFD32_BACKENDS_CFILES): Add elf-vxworks.c. (elf32-i386.lo): Depend on elf-vxworks.h. (elf-vxworks.lo): New rule. * Makefile.in: Regenerate. * elf-bfd.h (elf_backend_data): Update type of elf_backend_emit_relocs. (_bfd_elf_link_output_relocs): Update prototype. * elflink.c (_bfd_elf_link_output_relocs): Always use bed->elf_backend_emit_relocs when outputting relocations. * elfxx-target.h (elf_backend_emit_relocs): Default to _bfd_elf_link_output_relocs. * targets.c (bfd_elf32_i386_vxworks_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_vxworks_vec. * elf32-i386.c: Add elf32-i386-vxworks target BFD. (elf_i386_plt0_entry): Remove padding. (elf_i386_pic_plt0_entry): Ditto. (PLTRESOLVE_RELOCS_SHLIB, PLTRESOLVE_RELOCS): Define. (PLT_NON_JUMP_SLOT_RELOCS): Define. (elf_i386_link_hash_table): Add srelplt2, hgot, hplt, is_vxworks and plt0_pad_byte fields. (elf_i386_link_hash_table_create): Zero them. (elf_i386_create_dynamic_sections): Create static relocation section. (allocate_dynrelocs): Allocate space for static PLT relocations. (elf_i386_size_dynamic_sections): Save shortcuts to PLT and GOT symbols. Give PLT symbols function type. Don't strip PLT sections if we have exported symbols from them. (elf_i386_finish_dynamic_symbol): Fill in VxWorks PLT static relocation section. Don't mark _GLOBAL_OFFSET_TABLE_ as absolute on VxWorks. (elf_i386_finish_dynamic_sections): Allow different pad bytes. Add relocation for GOT location. Fill in PLT static relocations. (elf_i386_vxworks_link_hash_table_create): New function. (elf_i386_vxworks_link_output_symbol_hook): New function. * elf-vxworks.h: New file. gas/ * config/tc-i386.h (ELF_TARGET_FORMAT): Define for TE_VXWORKS. gas/testsuite/ * gas/i386/i386.exp: Don't run divide test on vxworks. ld/ * Makefile.am: Add eelf_i386_vxworks. * Makefile.in: Regenerate. * configure.tgt: Make i?86-*-vxworks use targ_emul=elf_i386_vxworks. * emulparams/elf_i386_vxworks.sh: New file. * emulparams/vxworks.sh: New file. * scripttempl/elf.sc: Add DATA_END_SYMBOLS and ETEXT_NAME.
2005-05-05 16:37:27 +02:00
if (!bed->elf_backend_emit_relocs (output_bfd, o,
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
input_rela_hdr,
2005-05-05 Paul Brook <paul@codesourcery.com> bfd/ * config.bfd: Use bfd_elf32_i386_vxworks_vec for i?86-*-vxworks. * configure.in: Add bfd_elf32_i386_vxworks_vec. i386 targets need elf-vxworks.lo. * configure: Regenerate. * Makefile.am (BFD32_BACKENDS): Add elf-vxworks.lo. (BFD32_BACKENDS_CFILES): Add elf-vxworks.c. (elf32-i386.lo): Depend on elf-vxworks.h. (elf-vxworks.lo): New rule. * Makefile.in: Regenerate. * elf-bfd.h (elf_backend_data): Update type of elf_backend_emit_relocs. (_bfd_elf_link_output_relocs): Update prototype. * elflink.c (_bfd_elf_link_output_relocs): Always use bed->elf_backend_emit_relocs when outputting relocations. * elfxx-target.h (elf_backend_emit_relocs): Default to _bfd_elf_link_output_relocs. * targets.c (bfd_elf32_i386_vxworks_vec): Declare. (_bfd_target_vector): Add bfd_elf32_i386_vxworks_vec. * elf32-i386.c: Add elf32-i386-vxworks target BFD. (elf_i386_plt0_entry): Remove padding. (elf_i386_pic_plt0_entry): Ditto. (PLTRESOLVE_RELOCS_SHLIB, PLTRESOLVE_RELOCS): Define. (PLT_NON_JUMP_SLOT_RELOCS): Define. (elf_i386_link_hash_table): Add srelplt2, hgot, hplt, is_vxworks and plt0_pad_byte fields. (elf_i386_link_hash_table_create): Zero them. (elf_i386_create_dynamic_sections): Create static relocation section. (allocate_dynrelocs): Allocate space for static PLT relocations. (elf_i386_size_dynamic_sections): Save shortcuts to PLT and GOT symbols. Give PLT symbols function type. Don't strip PLT sections if we have exported symbols from them. (elf_i386_finish_dynamic_symbol): Fill in VxWorks PLT static relocation section. Don't mark _GLOBAL_OFFSET_TABLE_ as absolute on VxWorks. (elf_i386_finish_dynamic_sections): Allow different pad bytes. Add relocation for GOT location. Fill in PLT static relocations. (elf_i386_vxworks_link_hash_table_create): New function. (elf_i386_vxworks_link_output_symbol_hook): New function. * elf-vxworks.h: New file. gas/ * config/tc-i386.h (ELF_TARGET_FORMAT): Define for TE_VXWORKS. gas/testsuite/ * gas/i386/i386.exp: Don't run divide test on vxworks. ld/ * Makefile.am: Add eelf_i386_vxworks. * Makefile.in: Regenerate. * configure.tgt: Make i?86-*-vxworks use targ_emul=elf_i386_vxworks. * emulparams/elf_i386_vxworks.sh: New file. * emulparams/vxworks.sh: New file. * scripttempl/elf.sc: Add DATA_END_SYMBOLS and ETEXT_NAME.
2005-05-05 16:37:27 +02:00
internal_relocs,
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
rela_hash_list))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
}
}
}
/* Write out the modified section contents. */
if (bed->elf_backend_write_section
&& (*bed->elf_backend_write_section) (output_bfd, flinfo->info, o,
* bfd-in2.h: Regenerate. * bfd-in.h (bfd_arm_vfp11_fix): New enum. Specify how VFP11 instruction scanning should be done. (bfd_elf32_arm_init_maps, bfd_elf32_arm_vfp11_erratum_scan) (bfd_elf32_arm_vfp11_fix_veneer_locations): Add prototypes. (bfd_elf32_arm_set_target_relocs): Add vfp11 fix type argument to prototype. * elf-bfd.h (elf_backend_write_section): Add struct bfd_link_info argument. * elf32-arm.c (VFP11_ERRATUM_VENEER_SECTION_NAME) (VFP11_ERRATUM_VENEER_ENTRY_NAME): Define macros. (elf32_vfp11_erratum_type): New enum. (elf32_vfp11_erratum_list): New struct. List of veneers or jumps to veneers. (_arm_elf_section_data): Add mapsize, erratumcount, erratumlist. (elf32_arm_link_hash_table): Add vfp11_erratum_glue_size, vfp11_fix and num_vfp11_fixes fields. (elf32_arm_link_hash_table_create): Initialise vfp11_fix, vfp11_erratum_glue_size, num_vfp11_fixes fields. (VFP11_ERRATUM_VENEER_SIZE): Define. Size of an (ARM) veneer. (bfd_elf32_arm_allocate_interworking_sections): Initialise erratum glue section. (elf32_arm_section_map_add): Add an code/data mapping symbol entry to a section's map. (record_vfp11_erratum_veneer): Create a single veneer, and its associated symbols. (bfd_elf32_arm_add_glue_sections_to_bfd): Add vfp11 erratum glue. (bfd_elf32_arm_init_maps): Initialise mapping symbol table for input BFDs. (bfd_elf32_arm_set_vfp11_fix): Set the type of erratum workaround required. (bfd_arm_vfp11_pipe): Define VFP11 instruction pipes. (bfd_arm_vfp11_regno): Recode a register number from a VFP11 insn. (bfd_arm_vfp11_write_mask): Update write mask according to coded register number. (bfd_arm_vfp11_antidependency): New function. (bfd_arm_vfp11_insn_decode): Decode a VFP11 insn. (elf32_arm_compare_mapping): Declare. (bfd_elf32_arm_vfp11_erratum_scan): Scan the sections of an input BFD for potential erratum-triggering insns. Record results. (bfd_elf32_arm_vfp11_fix_veneer_locations): Find out where veneers and branches to veneers have been placed in virtual memory after layout. (bfd_elf32_arm_set_target_relocs): Set vfp11_fix field in global hash table. (elf32_arm_output_symbol_hook): Remove. (elf32_arm_write_section): Output veneers, and branches to veneers. Use maps from input sections, not output sections, for code byte-swapping. * elf32-ppc.c (ppc_elf_write_section): Add dummy link_info argument. * elf32-score.c (_bfd_score_elf_write_section): Likewise. * elfxx-mips.c (_bfd_mips_elf_write_section): Likewise. * elfxx-mips.h (_bfd_mips_elf_write_section): Likewise.
2007-01-29 17:29:21 +01:00
contents))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
/* Section written out. */
}
else switch (o->sec_info_type)
{
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
case SEC_INFO_TYPE_STABS:
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! (_bfd_write_section_stabs
(output_bfd,
&elf_hash_table (flinfo->info)->stab_info,
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
o, &elf_section_data (o)->sec_info, contents)))
return FALSE;
break;
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
case SEC_INFO_TYPE_MERGE:
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! _bfd_write_merged_section (output_bfd, o,
elf_section_data (o)->sec_info))
return FALSE;
break;
PR ld/13991 bfd/ * bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as _bfd_generic_link_just_syms. * bfd/elflink.c (_bfd_elf_link_just_syms): Delete. * bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type. * bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section. * bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS, SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME, SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE. * bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c, * bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c, * bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c, * bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c, * bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c, * bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c, * bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c, * bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c, * bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c, * bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c, * bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c, * bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c, * bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c, * bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c, * bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c, * bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c, * bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c, * bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c, * bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c, * bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c, * bfd/reloc.c: Update all references. * bfd/bfd-in2.h: Regenerate. ld/ * ld/ldlang.c (size_input_section): Use sec_info_type rather than usrdata->flags.just_syms. * ld/ldwrite.c (build_link_order): Likewise. * ld/emultempl/hppaelf.em (build_section_lists): Likewise. * ld/emultempl/ppc64elf.em (build_toc_list): Likewise. * ld/emultempl/armelf.em (build_section_lists): Likewise. (after_allocation): Update for renamed sec_info_type value. * ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 07:12:40 +02:00
case SEC_INFO_TYPE_EH_FRAME:
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
if (! _bfd_elf_write_section_eh_frame (output_bfd, flinfo->info,
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
o, contents))
return FALSE;
}
break;
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
case SEC_INFO_TYPE_EH_FRAME_ENTRY:
{
if (! _bfd_elf_write_section_eh_frame_entry (output_bfd,
flinfo->info,
o, contents))
return FALSE;
}
break;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
default:
{
/* FIXME: octets_per_byte. */
if (! (o->flags & SEC_EXCLUDE))
{
file_ptr offset = (file_ptr) o->output_offset;
bfd_size_type todo = o->size;
if ((o->flags & SEC_ELF_REVERSE_COPY))
{
/* Reverse-copy input section to output. */
do
{
todo -= address_size;
if (! bfd_set_section_contents (output_bfd,
o->output_section,
contents + todo,
offset,
address_size))
return FALSE;
if (todo == 0)
break;
offset += address_size;
}
while (1);
}
else if (! bfd_set_section_contents (output_bfd,
o->output_section,
contents,
offset, todo))
return FALSE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
break;
}
}
return TRUE;
}
/* Generate a reloc when linking an ELF file. This is a reloc
requested by the linker, and does not come from any input file. This
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
is used to build constructor and destructor tables when linking
with -Ur. */
static bfd_boolean
elf_reloc_link_order (bfd *output_bfd,
struct bfd_link_info *info,
asection *output_section,
struct bfd_link_order *link_order)
{
reloc_howto_type *howto;
long indx;
bfd_vma offset;
bfd_vma addend;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_reloc_data *reldata;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
struct elf_link_hash_entry **rel_hash_ptr;
Elf_Internal_Shdr *rel_hdr;
const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
Elf_Internal_Rela irel[MAX_INT_RELS_PER_EXT_REL];
bfd_byte *erel;
unsigned int i;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_data *esdo = elf_section_data (output_section);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
if (howto == NULL)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
addend = link_order->u.reloc.p->addend;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (esdo->rel.hdr)
reldata = &esdo->rel;
else if (esdo->rela.hdr)
reldata = &esdo->rela;
else
{
reldata = NULL;
BFD_ASSERT (0);
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Figure out the symbol index. */
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
rel_hash_ptr = reldata->hashes + reldata->count;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (link_order->type == bfd_section_reloc_link_order)
{
indx = link_order->u.reloc.p->u.section->target_index;
BFD_ASSERT (indx != 0);
*rel_hash_ptr = NULL;
}
else
{
struct elf_link_hash_entry *h;
/* Treat a reloc against a defined symbol as though it were
actually against the section. */
h = ((struct elf_link_hash_entry *)
bfd_wrapped_link_hash_lookup (output_bfd, info,
link_order->u.reloc.p->u.name,
FALSE, FALSE, TRUE));
if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
asection *section;
section = h->root.u.def.section;
indx = section->output_section->target_index;
*rel_hash_ptr = NULL;
/* It seems that we ought to add the symbol value to the
addend here, but in practice it has already been added
because it was passed to constructor_callback. */
addend += section->output_section->vma + section->output_offset;
}
else if (h != NULL)
{
/* Setting the index to -2 tells elf_link_output_extsym that
this symbol is used by a reloc. */
h->indx = -2;
*rel_hash_ptr = h;
indx = 0;
}
else
{
if (! ((*info->callbacks->unattached_reloc)
(info, link_order->u.reloc.p->u.name, NULL, NULL, 0)))
return FALSE;
indx = 0;
}
}
/* If this is an inplace reloc, we must write the addend into the
object file. */
if (howto->partial_inplace && addend != 0)
{
bfd_size_type size;
bfd_reloc_status_type rstat;
bfd_byte *buf;
bfd_boolean ok;
const char *sym_name;
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
size = (bfd_size_type) bfd_get_reloc_size (howto);
buf = (bfd_byte *) bfd_zmalloc (size);
Fallout from recent bfd_reloc_outofrange changes Commit ec93045b and cd21f5da introduced a large number of tic4x and tic54x regressions, due to the new checks being wrong for targets with octets_per_byte != 1. To fix that I introduced a new bfd_get_section_limit_octets and performed the check on octets rather than byte adresses, reducing the number of bfd_octets_per_byte calls. bfd_octets_per_byte is rather expensive.. I then wondered why the same bfd_reloc_outofrange check added to bfd_perform_relocation wasn't also added to bfd_install_relocation. The two functions are virtually identical and ought to remain that way. However, adding the same check to bfd_install_relocation resulted in ld-elf "FAIL Link eh-group.o to eh-group" on many ELF targets, including x64_64-linux. The reason being that eh-group.o has NONE relocs at the end of a section, and most targets give NONE relocs a non-zero size. So if we are to keep the new outofrange check it appears that NONE relocs must have a zero size. * bfd-in.h (bfd_get_section_limit_octets): New define, extracted from.. (bfd_get_section_limit): ..here. * reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check. (bfd_install_relocation, _bfd_final_link_relocate): Add same check here. * elf32-sh.c (sh_elf_reloc): Correct bfd_reloc_outofrange check. * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Remove duplicated bfd_reloc_outofrange check. * bfd-in2.h: Regenerate. * cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok on zero size relocs. * ecoff.c (ecoff_reloc_link_order): Likewise. * elf32-nds32.c (nds32_relocate_contents): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. * reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs. (_bfd_clear_contents): Likewise. * elfxx-mips.c (mips_elf_obtain_contents): Likewise. (mips_elf_perform_relocation): Likewise. * aoutx.h (aout_link_reloc_link_order): Allow for NULL return from malloc on zero size alloc. * cofflink.c (_bfd_coff_reloc_link_order): Likewise. * elflink.c (elf_reloc_link_order): Likewise. * linker.c (_bfd_generic_reloc_link_order): Likewise. * pdp11.c (aout_link_reloc_link_order): Likewise. * xcofflink.c (xcoff_reloc_link_order): Likewise. * aoutx.h (howto_table_ext): Ensure NONE relocs have size 3, bitsize 0, and complain_overflow_dont. * coff-sparc.c (coff_sparc_howto_table): Likewise. * elf-hppa.h (elf_hppa_howto_table): Likewise. * elf-m10200.c (elf_mn10200_howto_table): Likewise. * elf-m10300.c (elf_mn10300_howto_table): Likewise. * elf32-arc.c (elf_arc_howto_table): Likewise. * elf32-arm.c (elf32_arm_howto_table_1): Likewise. * elf32-avr.c (elf_avr_howto_table): Likewise. * elf32-bfin.c (bfin_howto_table): Likewise. * elf32-cr16.c (cr16_elf_howto_table): Likewise. * elf32-cris.c (cris_elf_howto_table): Likewise. * elf32-crx.c (crx_elf_howto_table): Likewise. * elf32-d10v.c (elf_d10v_howto_table): Likewise. * elf32-d30v.c (elf_d30v_howto_table): Likewise. * elf32-dlx.c (dlx_elf_howto_table): Likewise. * elf32-epiphany.c (epiphany_elf_howto_table): Likewise. * elf32-fr30.c (fr30_elf_howto_table): Likewise. * elf32-frv.c (elf32_frv_howto_table): Likewise. * elf32-h8300.c (h8_elf_howto_table): Likewise. * elf32-i370.c (i370_elf_howto_raw): Likewise. * elf32-i386.c (elf_howto_table): Likewise. * elf32-i860.c (elf32_i860_howto_table): Likewise. * elf32-i960.c (elf32_i960_relocate): Likewise. * elf32-ip2k.c (ip2k_elf_howto_table): Likewise. * elf32-iq2000.c (iq2000_elf_howto_table): Likewise. * elf32-lm32.c (lm32_elf_howto_table): Likewise. * elf32-m32c.c (m32c_elf_howto_table): Likewise. * elf32-m32r.c (m32r_elf_howto_table): Likewise. * elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise. * elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise. * elf32-m68k.c (howto_table): Likewise. * elf32-mcore.c (mcore_elf_howto_raw): Likewise. * elf32-mep.c (mep_elf_howto_table): Likewise. * elf32-metag.c (elf_metag_howto_table): Likewise. * elf32-microblaze.c (microblaze_elf_howto_raw): Likewise. * elf32-mips.c (elf_mips_howto_table_rel): Likewise. * elf32-moxie.c (moxie_elf_howto_table): Likewise. * elf32-msp430.c (elf_msp430_howto_table): Likewise. * elf32-mt.c (mt_elf_howto_table): Likewise. * elf32-nds32.c (nds32_elf_howto_table): Likewise. * elf32-nios2.c (elf_nios2_howto_table_rel): Likewise. * elf32-or1k.c (or1k_elf_howto_table): Likewise. * elf32-pj.c (pj_elf_howto_table): Likewise. * elf32-ppc.c (ppc_elf_howto_raw): Likewise. * elf32-rl78.c (rl78_elf_howto_table): Likewise. * elf32-rx.c (rx_elf_howto_table): Likewise. * elf32-s390.c (elf_howto_table): Likewise. * elf32-score.c (elf32_score_howto_table): Likewise. * elf32-score7.c (elf32_score_howto_table): Likewise. * elf32-sh-relocs.h (R_SH_NONE): Likewise. * elf32-spu.c (elf_howto_table): Likewise. * elf32-tic6x.c (elf32_tic6x_howto_table): Likewise. * elf32-tilepro.c (tilepro_elf_howto_table): Likewise. * elf32-v850.c (v850_elf_howto_table): Likewise. * elf32-vax.c (howto_table): Likewise. * elf32-visium.c (visium_elf_howto_table): Likewise. * elf32-xc16x.c (xc16x_elf_howto_table): Likewise. * elf32-xgate.c (elf_xgate_howto_table): Likewise. * elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise. * elf32-xtensa.c (elf_howto_table): Likewise. * elf64-alpha.c (elf64_alpha_howto_table): Likewise. * elf64-mips.c (mips_elf64_howto_table_rel): Likewise. * elf64-mmix.c (elf_mmix_howto_table): Likewise. * elf64-ppc.c (ppc64_elf_howto_raw): Likewise. * elf64-s390.c (elf_howto_table): Likewise. * elf64-sh64.c (sh_elf64_howto_table): Likewise. * elf64-x86-64.c (x86_64_elf_howto_table): Likewise. * elfn32-mips.c (elf_mips_howto_table_rel): Likewise. * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise. (elfNN_aarch64_howto_none): Likewise. * elfxx-ia64.c (ia64_howto_table): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise. * elfxx-tilegx.c (tilegx_elf_howto_table): Likewise. * nlm32-sparc.c (nlm32_sparc_howto_table): Likewise.
2015-01-19 01:06:26 +01:00
if (buf == NULL && size != 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
switch (rstat)
{
case bfd_reloc_ok:
break;
default:
case bfd_reloc_outofrange:
abort ();
case bfd_reloc_overflow:
if (link_order->type == bfd_section_reloc_link_order)
sym_name = bfd_section_name (output_bfd,
link_order->u.reloc.p->u.section);
else
sym_name = link_order->u.reloc.p->u.name;
if (! ((*info->callbacks->reloc_overflow)
bfd/ 2004-10-21 H.J. Lu <hongjiu.lu@intel.com> PR 463 * aoutx.h (aout_link_input_section_std): Pass proper hash entry to linker reloc_overflow callback. (aout_link_input_section_ext): Likewise. (aout_link_reloc_link_order): Likewise. * coff-a29k.c (coff_a29k_relocate_section): Likewise. * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Likewise. (alpha_relocate_section): Likewise. * coff-arm.c (coff_arm_relocate_section): Likewise. * coff-h8300.c (h8300_reloc16_extra_cases): Likewise. * coff-h8500.c (extra_case): Likewise. * coff-i960.c (coff_i960_relocate_section): Likewise. * coff-mcore.c (coff_mcore_relocate_section): Likewise. * coff-mips.c (mips_relocate_section): Likewise. * coff-or32.c (coff_or32_relocate_section): Likewise. * coff-ppc.c (coff_ppc_relocate_section): Likewise. * coff-rs6000.c (xcoff_ppc_relocate_section): Likewise. * coff-sh.c (sh_relocate_section): Likewise. * coff-tic80.c (coff_tic80_relocate_section): Likewise. * coff-w65.c (w65_reloc16_extra_cases): Likewise. * coff-z8k.c (extra_case): Likewise. * coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise. * cofflink.c (_bfd_coff_reloc_link_order): Likewise. (_bfd_coff_generic_relocate_section): Likewise. * ecoff.c (ecoff_reloc_link_order): Likewise. * elf-hppa.h (elf_hppa_relocate_section): Likewise. * elf-m10200.c (mn10200_elf_relocate_section): Likewise. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-arm.h (elf32_arm_relocate_section): Likewise. * elf32-avr.c (elf32_avr_relocate_section): Likewise. * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-crx.c (elf32_crx_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-h8300.c (elf32_h8_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf32-v850.c (v850_elf_relocate_section): Likewise. * elf32-vax.c (elf_vax_relocate_section): Likewise. * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-mmix.c (mmix_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elflink.c (elf_reloc_link_order): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise. (_bfd_elf_mips_get_relocated_section_contents): Likewise. * linker.c (_bfd_generic_reloc_link_order): Likewise. * pdp11.c (pdp11_aout_link_input_section): Likewise. (aout_link_reloc_link_order): Likewise. * reloc.c (bfd_generic_get_relocated_section_contents): Likewise. * xcofflink.c (xcoff_reloc_link_order): Likewise. * simple.c (simple_dummy_reloc_overflow): Updated. include/ 2004-10-21 H.J. Lu <hongjiu.lu@intel.com> PR 463 * bfdlink.h (bfd_link_callbacks): Add a pointer to struct bfd_link_hash_entry to reloc_overflow. ld/ 2004-10-21 H.J. Lu <hongjiu.lu@intel.com> PR 463 * ldmain.c (reloc_overflow): Accept a pointer to struct bfd_link_hash_entry. Report symbol location for relocation overflow.
2004-10-21 17:28:33 +02:00
(info, NULL, sym_name, howto->name, addend, NULL,
NULL, (bfd_vma) 0)))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
free (buf);
return FALSE;
}
break;
}
ok = bfd_set_section_contents (output_bfd, output_section, buf,
link_order->offset, size);
free (buf);
if (! ok)
return FALSE;
}
/* The address of a reloc is relative to the section in a
relocatable file, and is a virtual address in an executable
file. */
offset = link_order->offset;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (! bfd_link_relocatable (info))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
offset += output_section->vma;
for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
{
irel[i].r_offset = offset;
irel[i].r_info = 0;
irel[i].r_addend = 0;
}
if (bed->s->arch_size == 32)
irel[0].r_info = ELF32_R_INFO (indx, howto->type);
else
irel[0].r_info = ELF64_R_INFO (indx, howto->type);
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
rel_hdr = reldata->hdr;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
erel = rel_hdr->contents;
if (rel_hdr->sh_type == SHT_REL)
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
erel += reldata->count * bed->s->sizeof_rel;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
(*bed->s->swap_reloc_out) (output_bfd, irel, erel);
}
else
{
irel[0].r_addend = addend;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
erel += reldata->count * bed->s->sizeof_rela;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
(*bed->s->swap_reloca_out) (output_bfd, irel, erel);
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
++reldata->count;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
/* Get the output vma of the section pointed to by the sh_link field. */
static bfd_vma
elf_get_linked_section_vma (struct bfd_link_order *p)
{
Elf_Internal_Shdr **elf_shdrp;
asection *s;
int elfsec;
s = p->u.indirect.section;
elf_shdrp = elf_elfsections (s->owner);
elfsec = _bfd_elf_section_from_bfd_section (s->owner, s);
elfsec = elf_shdrp[elfsec]->sh_link;
/* PR 290:
The Intel C compiler generates SHT_IA_64_UNWIND with
SHF_LINK_ORDER. But it doesn't set the sh_link or
sh_info fields. Hence we could get the situation
where elfsec is 0. */
if (elfsec == 0)
{
const struct elf_backend_data *bed
= get_elf_backend_data (s->owner);
if (bed->link_order_error_handler)
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
bed->link_order_error_handler
(_("%B: warning: sh_link not set for section `%A'"), s->owner, s);
return 0;
}
else
{
s = elf_shdrp[elfsec]->bfd_section;
return s->output_section->vma + s->output_offset;
}
}
/* Compare two sections based on the locations of the sections they are
linked to. Used by elf_fixup_link_order. */
static int
compare_link_order (const void * a, const void * b)
{
bfd_vma apos;
bfd_vma bpos;
apos = elf_get_linked_section_vma (*(struct bfd_link_order **)a);
bpos = elf_get_linked_section_vma (*(struct bfd_link_order **)b);
if (apos < bpos)
return -1;
return apos > bpos;
}
/* Looks for sections with SHF_LINK_ORDER set. Rearranges them into the same
order as their linked sections. Returns false if this could not be done
because an output section includes both ordered and unordered
sections. Ideally we'd do this in the linker proper. */
static bfd_boolean
elf_fixup_link_order (bfd *abfd, asection *o)
{
int seen_linkorder;
int seen_other;
int n;
struct bfd_link_order *p;
bfd *sub;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned elfsec;
struct bfd_link_order **sections;
asection *s, *other_sec, *linkorder_sec;
bfd_vma offset;
bfd/ * elf-bfd.h (struct elf_backend_data): Remove got_symbol_offset. * elfxx-target.h (elf_backend_got_symbol_offset): Delete. * elflink.c (_bfd_elf_create_got_section): Use zero in place of got_symbol_offset. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise. * elf32-frv.c (_frv_create_got_section): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Delete ppc code. (elf_backend_got_symbol_offset): Don't define. * elf64-ppc.c (elf_backend_got_symbol_offset): Don't define. * elf32-ppc.c (struct ppc_elf_link_hash_table): Add got_header_size and got_gap. (ppc_elf_create_got): Tidy. (ppc_elf_create_dynamic_sections): Don't set SEC_IN_MEMORY for .plt. (ppc_elf_check_relocs): Reduce string comparisons by using elf.hgot. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_relocate_section): Likewise. (ppc_elf_finish_dynamic_symbol): Likewise. (allocate_got): New function. (allocate_dynrelocs): Use allocate_got. (ppc_elf_size_dynamic_sections): Likewise. Delay tlsld_got allocation so that local got can refcount it. Set got_header_size. (ppc_elf_relocate_section): Use value of elf.hgot rather than hard- coded 4. (ppc_elf_finish_dynamic_sections): Likewise. (elf_backend_got_symbol_offset): Don't define. (elf_backend_got_header_size): Ditto. ld/testsuite/ * ld-powerpc/tlsexe32.d: Update for changed got layout. * ld-powerpc/tlsexe32.g: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.r: Likewise.
2005-05-07 04:55:55 +02:00
other_sec = NULL;
linkorder_sec = NULL;
seen_other = 0;
seen_linkorder = 0;
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
if (p->type == bfd_indirect_link_order)
{
s = p->u.indirect.section;
sub = s->owner;
if (bfd_get_flavour (sub) == bfd_target_elf_flavour
&& elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass
&& (elfsec = _bfd_elf_section_from_bfd_section (sub, s))
&& elfsec < elf_numsections (sub)
include/elf/ PR 5900 * common.h (SHN_BAD): Delete. (SHN_LORESERVE .. SHN_HIRESERVE): Move to.. * external.h: ..here. * internal.h (SHN_LORESERVE, SHN_HIRESERVE): Define. (SHN_LOPROC, SHN_HIPROC, SHN_LOOS, SHN_HIOS): Define. (SHN_ABS, SHN_COMMON, SHN_XINDEX, SHN_BAD): Define. bfd/ PR 5900 * elf-bfd.h: Include elf/internal.h after elf/external.h. * elfcode.h (elf_swap_symbol_in): Map reserved shndx range. (elf_swap_symbol_out): Adjust SHN_XINDEX test. (elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. (valid_section_index_p): Delete. (elf_object_p): Don't increment section numbers over reserved range. Simplify test for valid sh_link, sh_info and e_shstrndx fields. (elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values seen in external structs. Don't increment section numbers over reserved range. * elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx. (bfd_section_from_shdr): Likewise. (group_signature): Range check before accessing elf_elfsections. (_bfd_elf_setup_sections): Likewise. (bfd_section_from_shdr): Likewise. (bfd_section_from_shdr): Don't increment section number over reserved sections. (assign_file_positions_for_non_load_sections): Likewise. (assign_file_positions_except_relocs): Likewise. (_bfd_elf_write_object_contents): Likewise. (assign_section_numbers): Likewise. Adjust for changed SHN_*. (prep_headers): Delete unused variable. * elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust for changed SHN_* values. (check_dynsym, elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. Don't skip over reserved section range. (elf_fixup_link_order): Check that sh_link field is valid. * elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned. * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before accesssing elf_elfsections. * elf32-avr.c (elf32_avr_size_stubs): Likewise. * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise. * elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed SHN_* defines. Test for SHN_BAD return from _bfd_elf_section_from_bfd_section binutils/ PR 5900 * readelf.c (SECTION_HEADER_INDEX, SECTION_HEADER_NUM): Delete. Remove use throughout file. (SECTION_HEADER): Likewise. (dump_relocations): Don't adjust st_shndx for reserved range. (process_file_header): Mask SHN_XINDEX to values seen in external elf structs. Simplify valid section index tests. (get_32bit_elf_symbols, get_64bit_elf_symbols): Mask SHN_XINDEX. Map reserved st_shndx to internal form. (process_section_groups): Test that group symbol st_shndx is in range, not just non-zero. Delete reserved range check. (get_symbol_index_type): Mask "type" to 16 bits when printing PRC, OS or RSV. gdb/ PR 5900 * elfread.c (elf_symtab_read): Make shndx an unsigned int. * mipsread.c: Include elf/internal.h. (read_alphacoff_dynamic_symtab): Map external reserved sym_shndx to internal range. ld/testsuite/ PR 5900 * ld-elf/sec64k.exp: Update.
2008-03-12 09:37:09 +01:00
&& elf_elfsections (sub)[elfsec]->sh_flags & SHF_LINK_ORDER
&& elf_elfsections (sub)[elfsec]->sh_link < elf_numsections (sub))
{
seen_linkorder++;
linkorder_sec = s;
}
else
{
seen_other++;
other_sec = s;
}
}
else
seen_other++;
if (seen_other && seen_linkorder)
{
if (other_sec && linkorder_sec)
(*_bfd_error_handler) (_("%A has both ordered [`%A' in %B] and unordered [`%A' in %B] sections"),
o, linkorder_sec,
linkorder_sec->owner, other_sec,
other_sec->owner);
else
(*_bfd_error_handler) (_("%A has both ordered and unordered sections"),
o);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
}
if (!seen_linkorder)
return TRUE;
sections = (struct bfd_link_order **)
bfd_malloc (seen_linkorder * sizeof (struct bfd_link_order *));
if (sections == NULL)
return FALSE;
seen_linkorder = 0;
bfd/ * elf-bfd.h (struct elf_backend_data): Remove got_symbol_offset. * elfxx-target.h (elf_backend_got_symbol_offset): Delete. * elflink.c (_bfd_elf_create_got_section): Use zero in place of got_symbol_offset. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise. * elf32-frv.c (_frv_create_got_section): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Delete ppc code. (elf_backend_got_symbol_offset): Don't define. * elf64-ppc.c (elf_backend_got_symbol_offset): Don't define. * elf32-ppc.c (struct ppc_elf_link_hash_table): Add got_header_size and got_gap. (ppc_elf_create_got): Tidy. (ppc_elf_create_dynamic_sections): Don't set SEC_IN_MEMORY for .plt. (ppc_elf_check_relocs): Reduce string comparisons by using elf.hgot. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_relocate_section): Likewise. (ppc_elf_finish_dynamic_symbol): Likewise. (allocate_got): New function. (allocate_dynrelocs): Use allocate_got. (ppc_elf_size_dynamic_sections): Likewise. Delay tlsld_got allocation so that local got can refcount it. Set got_header_size. (ppc_elf_relocate_section): Use value of elf.hgot rather than hard- coded 4. (ppc_elf_finish_dynamic_sections): Likewise. (elf_backend_got_symbol_offset): Don't define. (elf_backend_got_header_size): Ditto. ld/testsuite/ * ld-powerpc/tlsexe32.d: Update for changed got layout. * ld-powerpc/tlsexe32.g: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.r: Likewise.
2005-05-07 04:55:55 +02:00
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
sections[seen_linkorder++] = p;
}
/* Sort the input sections in the order of their linked section. */
qsort (sections, seen_linkorder, sizeof (struct bfd_link_order *),
compare_link_order);
/* Change the offsets of the sections. */
offset = 0;
for (n = 0; n < seen_linkorder; n++)
{
s = sections[n]->u.indirect.section;
offset &= ~(bfd_vma) 0 << s->alignment_power;
s->output_offset = offset;
sections[n]->offset = offset;
/* FIXME: octets_per_byte. */
offset += sections[n]->size;
}
free (sections);
return TRUE;
}
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
static void
elf_final_link_free (bfd *obfd, struct elf_final_link_info *flinfo)
{
asection *o;
if (flinfo->symstrtab != NULL)
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
_bfd_elf_strtab_free (flinfo->symstrtab);
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
if (flinfo->contents != NULL)
free (flinfo->contents);
if (flinfo->external_relocs != NULL)
free (flinfo->external_relocs);
if (flinfo->internal_relocs != NULL)
free (flinfo->internal_relocs);
if (flinfo->external_syms != NULL)
free (flinfo->external_syms);
if (flinfo->locsym_shndx != NULL)
free (flinfo->locsym_shndx);
if (flinfo->internal_syms != NULL)
free (flinfo->internal_syms);
if (flinfo->indices != NULL)
free (flinfo->indices);
if (flinfo->sections != NULL)
free (flinfo->sections);
if (flinfo->symshndxbuf != NULL)
free (flinfo->symshndxbuf);
for (o = obfd->sections; o != NULL; o = o->next)
{
struct bfd_elf_section_data *esdo = elf_section_data (o);
if ((o->flags & SEC_RELOC) != 0 && esdo->rel.hashes != NULL)
free (esdo->rel.hashes);
if ((o->flags & SEC_RELOC) != 0 && esdo->rela.hashes != NULL)
free (esdo->rela.hashes);
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Do the final step of an ELF link. */
bfd_boolean
bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
bfd_boolean dynamic;
bfd_boolean emit_relocs;
bfd *dynobj;
struct elf_final_link_info flinfo;
asection *o;
struct bfd_link_order *p;
bfd *sub;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_size_type max_contents_size;
bfd_size_type max_external_reloc_size;
bfd_size_type max_internal_reloc_count;
bfd_size_type max_sym_count;
bfd_size_type max_sym_shndx_count;
Elf_Internal_Sym elfsym;
unsigned int i;
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Shdr *symtab_shndx_hdr;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
struct elf_outext_info eoinfo;
bfd_boolean merged;
size_t relativecount = 0;
asection *reldyn = 0;
bfd_size_type amt;
bfd: * elf-attrs.c: New. * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. (BFD32_BACKENDS_CFILES): Add elf-attrs.c. (elf-attrs.lo): Generate dependencies. * Makefile.in: Regenerate. * configure.in (elf): Add elf-attrs.lo. * configure: Regenerate. * elf-bfd.h (struct elf_backend_data): Add entries for object attributes. (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): New. (struct elf_obj_tdata): Add entries for object attributes. (elf_known_obj_attributes, elf_other_obj_attributes, elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): New. (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. (bfd_section_from_shdr): Handle attributes sections. * elflink.c (bfd_elf_final_link): Handle attributes sections. * elfxx-target.h (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. (elfNN_bed): Update. * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, aeabi_attribute_list): Remove. (struct elf32_arm_obj_tdata): Remove object attributes fields. (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): Update for new object attributes interfaces. (uleb128_size, is_default_attr, eabi_attr_size, elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, elf32_arm_add_eabi_attr_int, attr_strdup, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved to generic code in elf-attrs.c. (elf32_arm_obj_attrs_arg_type): New. (elf32_arm_fake_sections): Do not handle .ARM.attributes. (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. (bfd_elf32_bfd_final_link): Remove. (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object attributes. * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_copy_private_data): Likewise. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils: * readelf.c (display_gnu_attribute): New. (process_arm_specific): Rearrange as process_attributes. (process_arm_specific): Replace by wrapper of process_attributes. gas: * as.c (create_obj_attrs_section): New. (main): Call create_obj_attrs_section for ELF. * read.c (s_gnu_attribute, skip_whitespace, skip_past_char, skip_past_comma, s_vendor_attribute): New. (potable): Add gnu_attribute for ELF. * read.h (s_vendor_attribute): Declare. * config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper round s_vendor_attribute. (aeabi_set_public_attributes): Update for new attributes interfaces. (arm_md_end): Remove attributes contents setting now done generically. include/elf: * arm.h (elf32_arm_add_eabi_attr_int, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents, elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): Remove. * common.h (SHT_GNU_ATTRIBUTES): Define. ld: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes. (ATTRS_SECTIONS): Define. * scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc, scripttempl/elf_chaos.sc, scripttempl/elfi370.sc, scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
2007-06-29 18:29:17 +02:00
asection *attr_section = NULL;
bfd_vma attr_size = 0;
const char *std_attrs_section;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! is_elf_hash_table (info->hash))
return FALSE;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_pic (info))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
abfd->flags |= DYNAMIC;
dynamic = elf_hash_table (info)->dynamic_sections_created;
dynobj = elf_hash_table (info)->dynobj;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
emit_relocs = (bfd_link_relocatable (info)
|| info->emitrelocations);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
flinfo.info = info;
flinfo.output_bfd = abfd;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
flinfo.symstrtab = _bfd_elf_strtab_init ();
if (flinfo.symstrtab == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
if (! dynamic)
{
flinfo.hash_sec = NULL;
flinfo.symver_sec = NULL;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
else
{
2012-06-29 16:46:03 +02:00
flinfo.hash_sec = bfd_get_linker_section (dynobj, ".hash");
/* Note that dynsym_sec can be NULL (on VMS). */
2012-06-29 16:46:03 +02:00
flinfo.symver_sec = bfd_get_linker_section (dynobj, ".gnu.version");
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Note that it is OK if symver_sec is NULL. */
}
flinfo.contents = NULL;
flinfo.external_relocs = NULL;
flinfo.internal_relocs = NULL;
flinfo.external_syms = NULL;
flinfo.locsym_shndx = NULL;
flinfo.internal_syms = NULL;
flinfo.indices = NULL;
flinfo.sections = NULL;
flinfo.symshndxbuf = NULL;
flinfo.filesym_count = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd: * elf-attrs.c: New. * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. (BFD32_BACKENDS_CFILES): Add elf-attrs.c. (elf-attrs.lo): Generate dependencies. * Makefile.in: Regenerate. * configure.in (elf): Add elf-attrs.lo. * configure: Regenerate. * elf-bfd.h (struct elf_backend_data): Add entries for object attributes. (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): New. (struct elf_obj_tdata): Add entries for object attributes. (elf_known_obj_attributes, elf_other_obj_attributes, elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): New. (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. (bfd_section_from_shdr): Handle attributes sections. * elflink.c (bfd_elf_final_link): Handle attributes sections. * elfxx-target.h (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. (elfNN_bed): Update. * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, aeabi_attribute_list): Remove. (struct elf32_arm_obj_tdata): Remove object attributes fields. (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): Update for new object attributes interfaces. (uleb128_size, is_default_attr, eabi_attr_size, elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, elf32_arm_add_eabi_attr_int, attr_strdup, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved to generic code in elf-attrs.c. (elf32_arm_obj_attrs_arg_type): New. (elf32_arm_fake_sections): Do not handle .ARM.attributes. (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. (bfd_elf32_bfd_final_link): Remove. (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object attributes. * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_copy_private_data): Likewise. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils: * readelf.c (display_gnu_attribute): New. (process_arm_specific): Rearrange as process_attributes. (process_arm_specific): Replace by wrapper of process_attributes. gas: * as.c (create_obj_attrs_section): New. (main): Call create_obj_attrs_section for ELF. * read.c (s_gnu_attribute, skip_whitespace, skip_past_char, skip_past_comma, s_vendor_attribute): New. (potable): Add gnu_attribute for ELF. * read.h (s_vendor_attribute): Declare. * config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper round s_vendor_attribute. (aeabi_set_public_attributes): Update for new attributes interfaces. (arm_md_end): Remove attributes contents setting now done generically. include/elf: * arm.h (elf32_arm_add_eabi_attr_int, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents, elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): Remove. * common.h (SHT_GNU_ATTRIBUTES): Define. ld: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes. (ATTRS_SECTIONS): Define. * scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc, scripttempl/elf_chaos.sc, scripttempl/elfi370.sc, scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
2007-06-29 18:29:17 +02:00
/* The object attributes have been merged. Remove the input
sections from the link, and set the contents of the output
secton. */
std_attrs_section = get_elf_backend_data (abfd)->obj_attrs_section;
for (o = abfd->sections; o != NULL; o = o->next)
{
if ((std_attrs_section && strcmp (o->name, std_attrs_section) == 0)
|| strcmp (o->name, ".gnu.attributes") == 0)
{
for (p = o->map_head.link_order; p != NULL; p = p->next)
{
asection *input_section;
if (p->type != bfd_indirect_link_order)
continue;
input_section = p->u.indirect.section;
/* Hack: reset the SEC_HAS_CONTENTS flag so that
elf_link_input_bfd ignores this section. */
input_section->flags &= ~SEC_HAS_CONTENTS;
}
2007-09-30 15:43:23 +02:00
bfd: * elf-attrs.c: New. * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. (BFD32_BACKENDS_CFILES): Add elf-attrs.c. (elf-attrs.lo): Generate dependencies. * Makefile.in: Regenerate. * configure.in (elf): Add elf-attrs.lo. * configure: Regenerate. * elf-bfd.h (struct elf_backend_data): Add entries for object attributes. (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): New. (struct elf_obj_tdata): Add entries for object attributes. (elf_known_obj_attributes, elf_other_obj_attributes, elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): New. (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. (bfd_section_from_shdr): Handle attributes sections. * elflink.c (bfd_elf_final_link): Handle attributes sections. * elfxx-target.h (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. (elfNN_bed): Update. * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, aeabi_attribute_list): Remove. (struct elf32_arm_obj_tdata): Remove object attributes fields. (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): Update for new object attributes interfaces. (uleb128_size, is_default_attr, eabi_attr_size, elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, elf32_arm_add_eabi_attr_int, attr_strdup, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved to generic code in elf-attrs.c. (elf32_arm_obj_attrs_arg_type): New. (elf32_arm_fake_sections): Do not handle .ARM.attributes. (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. (bfd_elf32_bfd_final_link): Remove. (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object attributes. * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_copy_private_data): Likewise. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils: * readelf.c (display_gnu_attribute): New. (process_arm_specific): Rearrange as process_attributes. (process_arm_specific): Replace by wrapper of process_attributes. gas: * as.c (create_obj_attrs_section): New. (main): Call create_obj_attrs_section for ELF. * read.c (s_gnu_attribute, skip_whitespace, skip_past_char, skip_past_comma, s_vendor_attribute): New. (potable): Add gnu_attribute for ELF. * read.h (s_vendor_attribute): Declare. * config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper round s_vendor_attribute. (aeabi_set_public_attributes): Update for new attributes interfaces. (arm_md_end): Remove attributes contents setting now done generically. include/elf: * arm.h (elf32_arm_add_eabi_attr_int, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents, elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): Remove. * common.h (SHT_GNU_ATTRIBUTES): Define. ld: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes. (ATTRS_SECTIONS): Define. * scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc, scripttempl/elf_chaos.sc, scripttempl/elfi370.sc, scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
2007-06-29 18:29:17 +02:00
attr_size = bfd_elf_obj_attr_size (abfd);
if (attr_size)
{
bfd_set_section_size (abfd, o, attr_size);
attr_section = o;
/* Skip this section later on. */
o->map_head.link_order = NULL;
}
else
o->flags |= SEC_EXCLUDE;
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Count up the number of relocations we will output for each output
section, so that we know the sizes of the reloc sections. We
also figure out some maximum sizes. */
max_contents_size = 0;
max_external_reloc_size = 0;
max_internal_reloc_count = 0;
max_sym_count = 0;
max_sym_shndx_count = 0;
merged = FALSE;
for (o = abfd->sections; o != NULL; o = o->next)
{
struct bfd_elf_section_data *esdo = elf_section_data (o);
o->reloc_count = 0;
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
for (p = o->map_head.link_order; p != NULL; p = p->next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
unsigned int reloc_count = 0;
unsigned int additional_reloc_count = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
struct bfd_elf_section_data *esdi = NULL;
if (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order)
reloc_count = 1;
else if (p->type == bfd_indirect_link_order)
{
asection *sec;
sec = p->u.indirect.section;
esdi = elf_section_data (sec);
/* Mark all sections which are to be included in the
link. This will normally be every section. We need
to do this so that we can identify any sections which
the linker has decided to not include. */
sec->linker_mark = TRUE;
if (sec->flags & SEC_MERGE)
merged = TRUE;
if (esdo->this_hdr.sh_type == SHT_REL
|| esdo->this_hdr.sh_type == SHT_RELA)
/* Some backends use reloc_count in relocation sections
to count particular types of relocs. Of course,
reloc sections themselves can't have relocations. */
reloc_count = 0;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
else if (emit_relocs)
{
reloc_count = sec->reloc_count;
if (bed->elf_backend_count_additional_relocs)
{
int c;
c = (*bed->elf_backend_count_additional_relocs) (sec);
additional_reloc_count += c;
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
else if (bed->elf_backend_count_relocs)
reloc_count = (*bed->elf_backend_count_relocs) (info, sec);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
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 (sec->rawsize > max_contents_size)
max_contents_size = sec->rawsize;
if (sec->size > max_contents_size)
max_contents_size = sec->size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* We are interested in just local symbols, not all
symbols. */
if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
&& (sec->owner->flags & DYNAMIC) == 0)
{
size_t sym_count;
if (elf_bad_symtab (sec->owner))
sym_count = (elf_tdata (sec->owner)->symtab_hdr.sh_size
/ bed->s->sizeof_sym);
else
sym_count = elf_tdata (sec->owner)->symtab_hdr.sh_info;
if (sym_count > max_sym_count)
max_sym_count = sym_count;
if (sym_count > max_sym_shndx_count
2015-09-23 18:23:58 +02:00
&& elf_symtab_shndx_list (sec->owner) != NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
max_sym_shndx_count = sym_count;
if ((sec->flags & SEC_RELOC) != 0)
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
size_t ext_size = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (esdi->rel.hdr != NULL)
ext_size = esdi->rel.hdr->sh_size;
if (esdi->rela.hdr != NULL)
ext_size += esdi->rela.hdr->sh_size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (ext_size > max_external_reloc_size)
max_external_reloc_size = ext_size;
if (sec->reloc_count > max_internal_reloc_count)
max_internal_reloc_count = sec->reloc_count;
}
}
}
if (reloc_count == 0)
continue;
reloc_count += additional_reloc_count;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
o->reloc_count += reloc_count;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (p->type == bfd_indirect_link_order && emit_relocs)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (esdi->rel.hdr)
{
esdo->rel.count += NUM_SHDR_ENTRIES (esdi->rel.hdr);
esdo->rel.count += additional_reloc_count;
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (esdi->rela.hdr)
{
esdo->rela.count += NUM_SHDR_ENTRIES (esdi->rela.hdr);
esdo->rela.count += additional_reloc_count;
}
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
}
else
{
if (o->use_rela_p)
esdo->rela.count += reloc_count;
else
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
esdo->rel.count += reloc_count;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
if (o->reloc_count > 0)
o->flags |= SEC_RELOC;
else
{
/* Explicitly clear the SEC_RELOC flag. The linker tends to
set it (this is probably a bug) and if it is set
assign_section_numbers will create a reloc section. */
o->flags &=~ SEC_RELOC;
}
/* If the SEC_ALLOC flag is not set, force the section VMA to
zero. This is done in elf_fake_sections as well, but forcing
the VMA to 0 here will ensure that relocs against these
sections are handled correctly. */
if ((o->flags & SEC_ALLOC) == 0
&& ! o->user_set_vma)
o->vma = 0;
}
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (! bfd_link_relocatable (info) && merged)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_link_sec_merge_syms, abfd);
/* Figure out the file positions for everything but the symbol table
and the relocs. We set symcount to force assign_section_numbers
to create a symbol table. */
bfd_get_symcount (abfd) = info->strip != strip_all || emit_relocs;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
BFD_ASSERT (! abfd->output_has_begun);
if (! _bfd_elf_compute_section_file_positions (abfd, info))
goto error_return;
/* Set sizes, and assign file positions for reloc sections. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (o = abfd->sections; o != NULL; o = o->next)
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_data *esdo = elf_section_data (o);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if ((o->flags & SEC_RELOC) != 0)
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (esdo->rel.hdr
&& !(_bfd_elf_link_size_reloc_section (abfd, &esdo->rel)))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
if (esdo->rela.hdr
&& !(_bfd_elf_link_size_reloc_section (abfd, &esdo->rela)))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
/* Now, reset REL_COUNT and REL_COUNT2 so that we can use them
to count upwards while actually outputting the relocations. */
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
esdo->rel.count = 0;
esdo->rela.count = 0;
Add --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi] This patch adds --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi] to ld for ELF targets to support generating compressed DWARF debug sections. We always generate .zdebug_* section since section names have been finalized and they can't be changed easily when compression is being performed. bfd/ * bfd-in.h (compressed_debug_section_type): New. * compress.c (bfd_compress_section_contents): Add an argument for linker write compression and always generate .zdebug_* section when linking. (bfd_init_section_compress_status): Pass FALSE to bfd_compress_section_contents. (bfd_compress_section): New function. * elf.c (elf_fake_sections): For linking, set SEC_ELF_COMPRESS on DWARF debug sections if COMPRESS_DEBUG is set and rename section if COMPRESS_DEBUG_GABI_ZLIB isn't set. (assign_file_positions_for_non_load_sections): Set sh_offset to -1 if SEC_ELF_COMPRESS is set. (assign_file_positions_except_relocs): Likwise. (_bfd_elf_assign_file_positions_for_relocs): Renamed to ... (_bfd_elf_assign_file_positions_for_non_load): This. Change return time to bfd_boolean. Compress the section if SEC_ELF_COMPRESS is set. (_bfd_elf_write_object_contents): Updated. (_bfd_elf_set_section_contents): Write section contents to the buffer if SEC_ELF_COMPRESS is set. * merge.c: Include "elf-bfd.h". (sec_merge_emit): Add arguments for contents and offset. Write to contents with offset if contents isn't NULL. (_bfd_write_merged_section): Write section contents to the buffer if SEC_ELF_COMPRESS is set. Pass contents and output_offset to sec_merge_emit. * elflink.c (bfd_elf_final_link): Allocate the buffer for output section contents if SEC_ELF_COMPRESS is set. * section.c (SEC_ELF_COMPRESS): New. * bfd-in2.h: Regenerated. gas/ * as.h (compressed_debug_section_type): Removed. include/ * bfdlink.h (bfd_link_info): Add compress_debug. ld/ * ld.texinfo: Document --compress-debug-sections=. * ldmain.c (main): Set BFD_COMPRESS on output_bfd if COMPRESS_DEBUG is set. Set BFD_COMPRESS_GABI on output_bfd for COMPRESS_DEBUG_GABI_ZLIB. * lexsup.c (elf_static_list_options): Add --compress-debug-sections=. * emultempl/elf32.em (OPTION_COMPRESS_DEBUG): New. (xtra_long): Add "compress-debug-sections". (gld${EMULATION_NAME}_handle_option): Handle OPTION_COMPRESS_DEBUG. ld/testsuite/ * ld-elf/compress.exp (build_tests): Add tests for --compress-debug-sections=. (run_tests): Likewise. Add additonal tests for --compress-debug-sections=. * ld-elf/gabiend.rt: New file. * ld-elf/gabinormal.rt: Likewise. * ld-elf/gnubegin.rS: Likewise. * ld-elf/gnunormal.rS: Likewise. * ld-elf/zlibbegin.rS: Likewise. * ld-elf/zlibnormal.rS: Likewise.
2015-04-15 07:01:25 +02:00
if (esdo->this_hdr.sh_offset == (file_ptr) -1)
{
/* Cache the section contents so that they can be compressed
later. Use bfd_malloc since it will be freed by
bfd_compress_section_contents. */
unsigned char *contents = esdo->this_hdr.contents;
if ((o->flags & SEC_ELF_COMPRESS) == 0 || contents != NULL)
abort ();
contents
= (unsigned char *) bfd_malloc (esdo->this_hdr.sh_size);
if (contents == NULL)
goto error_return;
esdo->this_hdr.contents = contents;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
/* We have now assigned file positions for all the sections except
Move ELF section headers to end of object file Currently, section ordering differs a little for non-loaded reloc sections output by ld -emit-relocs or ld -r and that after passing such objects through objcopy. Not that it really matters, but it would be better for a simple objcopy to produce an unchanged output object file. Also, section headers are put somewhere in the middle of the non-loaded sections, again slightly differently for ld and objcopy. This patch fixes these discrepancies and puts section headers last, which is where gold puts them, and is where bfd_from_remote_memory wrongly assumed they will be found. bfd/ * elf.c (assign_file_positions_except_relocs): Move section header placement to.. (_bfd_elf_assign_file_positions_for_relocs): ..here. Make static. * elf-bfd.h (_bfd_elf_assign_file_positions_for_relocs): Delete. * elflink.c (bfd_elf_final_link): Don't call above function. gas/testsuite/ * gas/arm/got_prel.d: Adjust for changed section header placement. * gas/i386/ilp32/x86-64-size-1.d: Likewise. * gas/i386/ilp32/x86-64-size-3.d: Likewise. * gas/i386/ilp32/x86-64-size-5.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/size-1.d: Likewise. * gas/i386/size-3.d: Likewise. * gas/i386/x86-64-size-1.d: Likewise. * gas/i386/x86-64-size-3.d: Likewise. * gas/i386/x86-64-size-5.d: Likewise. * gas/i386/x86-64-unwind.d: Likewise. * gas/ia64/alias-ilp32.d: Likewise. * gas/ia64/alias.d: Likewise. * gas/ia64/group-1.d: Likewise. * gas/ia64/group-2.d: Likewise. * gas/ia64/secname-ilp32.d: Likewise. * gas/ia64/secname.d: Likewise. * gas/ia64/unwind-ilp32.d: Likewise. * gas/ia64/unwind.d: Likewise. * gas/mmix/bspec-1.d: Likewise. * gas/mmix/bspec-2.d: Likewise. * gas/mmix/byte-1.d: Likewise. * gas/mmix/loc-1.d: Likewise. * gas/mmix/loc-2.d: Likewise. * gas/mmix/loc-3.d: Likewise. * gas/mmix/loc-4.d: Likewise. * gas/mmix/loc-5.d: Likewise. * gas/tic6x/scomm-directive-4.d: Likewise. ld/testsuite/ * ld-aarch64/emit-relocs-local-addend.d: Adjust for changed section header placement. * ld-aarch64/local-addend-r.d: Likewise. * ld-mmix/bspec1.d: Likewise. * ld-mmix/bspec2.d: Likewise. * ld-mmix/local1.d: Likewise. * ld-mmix/local3.d: Likewise. * ld-mmix/local5.d: Likewise. * ld-mmix/local7.d: Likewise. * ld-mmix/undef-3.d: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-tic6x/common.d: Likewise. * ld-tic6x/shlib-1.rd: Likewise. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1.rd: Likewise. * ld-tic6x/shlib-app-1b.rd: Likewise. * ld-tic6x/shlib-app-1r.rd: Likewise. * ld-tic6x/shlib-app-1rb.rd: Likewise. * ld-tic6x/shlib-noindex.rd: Likewise. * ld-tic6x/static-app-1.rd: Likewise. * ld-tic6x/static-app-1b.rd: Likewise. * ld-tic6x/static-app-1r.rd: Likewise. * ld-tic6x/static-app-1rb.rd: Likewise. * ld-x86-64/ilp32-4.d: Likewise. * ld-x86-64/split-by-file-nacl.rd: Likewise. * ld-x86-64/split-by-file.rd: Likewise.
2014-09-10 06:56:25 +02:00
.symtab, .strtab, and non-loaded reloc sections. We start the
.symtab section at the current file position, and write directly
to it. We build the .strtab section in memory. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_get_symcount (abfd) = 0;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
/* sh_name is set in prep_headers. */
symtab_hdr->sh_type = SHT_SYMTAB;
/* sh_flags, sh_addr and sh_size all start off zero. */
symtab_hdr->sh_entsize = bed->s->sizeof_sym;
/* sh_link is set in assign_section_numbers. */
/* sh_info is set below. */
/* sh_offset is set just below. */
symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
if (max_sym_count < 20)
max_sym_count = 20;
elf_hash_table (info)->strtabsize = max_sym_count;
amt = max_sym_count * sizeof (struct elf_sym_strtab);
elf_hash_table (info)->strtab
= (struct elf_sym_strtab *) bfd_malloc (amt);
if (elf_hash_table (info)->strtab == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
/* The real buffer will be allocated in elf_link_swap_symbols_out. */
flinfo.symshndxbuf
= (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF)
? (Elf_External_Sym_Shndx *) -1 : NULL);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (info->strip != strip_all || emit_relocs)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
file_ptr off = elf_next_file_pos (abfd);
_bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE);
/* Note that at this point elf_next_file_pos (abfd) is
incorrect. We do not yet know the size of the .symtab section.
We correct next_file_pos below, after we do know the size. */
/* Start writing out the symbol table. The first symbol is always a
dummy symbol. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
elfsym.st_value = 0;
elfsym.st_size = 0;
elfsym.st_info = 0;
elfsym.st_other = 0;
elfsym.st_shndx = SHN_UNDEF;
include/elf/ * internal.h (elf_internal_sym): Add st_target_internal. * arm.h (arm_st_branch_type): New enum. (ARM_SYM_BRANCH_TYPE): New macro. bfd/ * elf-bfd.h (elf_link_hash_entry): Add target_internal. * elf.c (swap_out_syms): Set st_target_internal for each Elf_Internal_Sym. * elfcode.h (elf_swap_symbol_in): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise. * elf32-sh-symbian.c (sh_symbian_relocate_section): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elflink.c (elf_link_output_extsym): Likewise. (bfd_elf_final_link): Likewise. (elf_link_add_object_symbols): Copy st_target_internal to the hash table if we see a definition. (_bfd_elf_copy_link_hash_symbol_type): Copy target_internal. * elf32-arm.c (elf32_arm_stub_hash_entry): Replace st_type with a branch_type field. (a8_erratum_fix, a8_erratum_reloc): Likewise. (arm_type_of_stub): Replace actual_st_type with an actual_branch_type parameter. (arm_build_one_stub): Use branch types rather than st_types to determine the type of branch. (cortex_a8_erratum_scan): Likewise. (elf32_arm_size_stubs): Likewise. (bfd_elf32_arm_process_before_allocation): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_finish_dynamic_sections): Likewise. (elf32_arm_final_link_relocate): Replace sym_flags parameter with a branch_type parameter. (elf32_arm_relocate_section): Update call accordingly. (elf32_arm_adjust_dynamic_symbol): Don't check STT_ARM_TFUNC. (elf32_arm_output_map_sym): Initialize st_target_internal. (elf32_arm_output_stub_sym): Likewise. (elf32_arm_symbol_processing): Delete. (elf32_arm_swap_symbol_in): Convert STT_ARM_TFUNCs into STT_FUNCs. Use st_target_internal to record the branch type. (elf32_arm_swap_symbol_out): Use st_target_internal to test for Thumb functions. (elf32_arm_is_function_type): Delete. (elf_backend_symbol_processing): Likewise. (elf_backend_is_function_type): Likewise. gas/ * config/tc-arm.c (arm_adjust_symtab): Set the branch type for Thumb symbols. ld/ * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Check eh->target_internal. opcodes/ * arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC. Use branch types instead. (print_insn): Likewise.
2011-03-14 16:55:04 +01:00
elfsym.st_target_internal = 0;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
if (elf_link_output_symstrtab (&flinfo, NULL, &elfsym,
bfd_und_section_ptr, NULL) != 1)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
/* Output a symbol for each section. We output these even if we are
discarding local symbols, since they are used for relocs. These
symbols have no names. We store the index of each one in the
index field of the section, so that we can find it again when
outputting relocs. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
elfsym.st_size = 0;
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
elfsym.st_other = 0;
elfsym.st_value = 0;
include/elf/ * internal.h (elf_internal_sym): Add st_target_internal. * arm.h (arm_st_branch_type): New enum. (ARM_SYM_BRANCH_TYPE): New macro. bfd/ * elf-bfd.h (elf_link_hash_entry): Add target_internal. * elf.c (swap_out_syms): Set st_target_internal for each Elf_Internal_Sym. * elfcode.h (elf_swap_symbol_in): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise. * elf32-sh-symbian.c (sh_symbian_relocate_section): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elflink.c (elf_link_output_extsym): Likewise. (bfd_elf_final_link): Likewise. (elf_link_add_object_symbols): Copy st_target_internal to the hash table if we see a definition. (_bfd_elf_copy_link_hash_symbol_type): Copy target_internal. * elf32-arm.c (elf32_arm_stub_hash_entry): Replace st_type with a branch_type field. (a8_erratum_fix, a8_erratum_reloc): Likewise. (arm_type_of_stub): Replace actual_st_type with an actual_branch_type parameter. (arm_build_one_stub): Use branch types rather than st_types to determine the type of branch. (cortex_a8_erratum_scan): Likewise. (elf32_arm_size_stubs): Likewise. (bfd_elf32_arm_process_before_allocation): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_finish_dynamic_sections): Likewise. (elf32_arm_final_link_relocate): Replace sym_flags parameter with a branch_type parameter. (elf32_arm_relocate_section): Update call accordingly. (elf32_arm_adjust_dynamic_symbol): Don't check STT_ARM_TFUNC. (elf32_arm_output_map_sym): Initialize st_target_internal. (elf32_arm_output_stub_sym): Likewise. (elf32_arm_symbol_processing): Delete. (elf32_arm_swap_symbol_in): Convert STT_ARM_TFUNCs into STT_FUNCs. Use st_target_internal to record the branch type. (elf32_arm_swap_symbol_out): Use st_target_internal to test for Thumb functions. (elf32_arm_is_function_type): Delete. (elf_backend_symbol_processing): Likewise. (elf_backend_is_function_type): Likewise. gas/ * config/tc-arm.c (arm_adjust_symtab): Set the branch type for Thumb symbols. ld/ * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Check eh->target_internal. opcodes/ * arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC. Use branch types instead. (print_insn): Likewise.
2011-03-14 16:55:04 +01:00
elfsym.st_target_internal = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (i = 1; i < elf_numsections (abfd); i++)
{
o = bfd_section_from_elf_index (abfd, i);
if (o != NULL)
{
o->target_index = bfd_get_symcount (abfd);
elfsym.st_shndx = i;
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (!bfd_link_relocatable (info))
elfsym.st_value = o->vma;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
if (elf_link_output_symstrtab (&flinfo, NULL, &elfsym, o,
NULL) != 1)
goto error_return;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
/* Allocate some memory to hold information read in from the input
files. */
if (max_contents_size != 0)
{
flinfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
if (flinfo.contents == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
if (max_external_reloc_size != 0)
{
flinfo.external_relocs = bfd_malloc (max_external_reloc_size);
if (flinfo.external_relocs == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
if (max_internal_reloc_count != 0)
{
amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
amt *= sizeof (Elf_Internal_Rela);
flinfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt);
if (flinfo.internal_relocs == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
if (max_sym_count != 0)
{
amt = max_sym_count * bed->s->sizeof_sym;
flinfo.external_syms = (bfd_byte *) bfd_malloc (amt);
if (flinfo.external_syms == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
amt = max_sym_count * sizeof (Elf_Internal_Sym);
flinfo.internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt);
if (flinfo.internal_syms == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
amt = max_sym_count * sizeof (long);
flinfo.indices = (long int *) bfd_malloc (amt);
if (flinfo.indices == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
amt = max_sym_count * sizeof (asection *);
flinfo.sections = (asection **) bfd_malloc (amt);
if (flinfo.sections == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
if (max_sym_shndx_count != 0)
{
amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
flinfo.locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
if (flinfo.locsym_shndx == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
if (elf_hash_table (info)->tls_sec)
{
bfd_vma base, end = 0;
asection *sec;
for (sec = elf_hash_table (info)->tls_sec;
sec && (sec->flags & SEC_THREAD_LOCAL);
sec = sec->next)
{
bfd_size_type size = sec->size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (size == 0
&& (sec->flags & SEC_HAS_CONTENTS) == 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
struct bfd_link_order *ord = sec->map_tail.link_order;
if (ord != NULL)
size = ord->offset + ord->size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
end = sec->vma + size;
}
base = elf_hash_table (info)->tls_sec->vma;
/* Only align end of TLS section if static TLS doesn't have special
alignment requirements. */
if (bed->static_tls_alignment == 1)
end = align_power (end,
elf_hash_table (info)->tls_sec->alignment_power);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
elf_hash_table (info)->tls_size = end - base;
}
/* Reorder SHF_LINK_ORDER sections. */
for (o = abfd->sections; o != NULL; o = o->next)
{
if (!elf_fixup_link_order (abfd, o))
return FALSE;
}
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
if (!_bfd_elf_fixup_eh_frame_hdr (info))
return FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Since ELF permits relocations to be against local symbols, we
must have the local symbols available when we do the relocations.
Since we would rather only read the local symbols once, and we
would rather not keep them in memory, we handle all the
relocations for a single input file at the same time.
Unfortunately, there is no way to know the total number of local
symbols until we have seen all of them, and the local symbol
indices precede the global symbol indices. This means that when
we are generating relocatable output, and we see a reloc against
a global symbol, we can not know the symbol index until we have
finished examining all the local symbols to see which ones we are
going to output. To deal with this, we keep the relocations in
memory, and don't output them until the end of the link. This is
an unfortunate waste of memory, but I don't see a good way around
it. Fortunately, it only happens when performing a relocatable
link, which is not the common case. FIXME: If keep_memory is set
we could write the relocs out and then read them again; I don't
know how bad the memory loss will be. */
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
sub->output_has_begun = FALSE;
for (o = abfd->sections; o != NULL; o = o->next)
{
bfd/ * section.c (struct bfd_section): Replace link_order_head and link_order_tail with map_head and map_tail union. (STD_SECTION): Update. (_bfd_strip_section_from_output): Delete. * aoutx.h: Update throughout for above changes. * coff-ppc.c: Likewise. * cofflink.c: Likewise. * ecoff.c: Likewise. * elf-eh-frame.c: Likewise. * elf-m10300.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-cris.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i386.c: Likewise. * elf32-m32r.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-vax.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-sh64.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfxx-ia64.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * linker.c: Likewise. * merge.c: Likewise. * pdp11.c: Likewise. * xcofflink.c: Likewise. * elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split out from bfd_elf_size_dynamic_sections. * bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare. * bfd-in2.h: Regenerate. ld/ * ldemul.c: Include bfdlink.h. (ldemul_before_allocation): Assume before_allocation is non-zero. (before_allocation_default): Call strip_excluded_output_sections. * ldlang.c (stripped_excluded_sections): New variable. (lang_add_section): Build input section list for each output section, attached via map_head and map_tail pointers. (strip_excluded_output_sections): Make global. Traverse the input section lists to find which output sections can go. Clear link_order pointers and set stripped_excluded_sections. (lang_process): Call strip_excluded_output_sections. * ldlang.h (strip_excluded_output_sections): Declare. * ldwrite.c: Update throuhout for link_order_head -> map_head change. * emultempl/aix.em (before_allocation): Call strip_excluded_output_sections. * emultempl/armcoff.em (before_allocation): Likewise. * emultempl/beos.em (before_allocation): Likewise. * emultempl/linux.em (before_allocation): Likewise. * emultempl/pe.em (before_allocation): Likewise. * emultempl/sunos.em (before_allocation): Likewise. * emultempl/elf32.em (before_allocation): Likewise. Call bfd_elf_size_dynsym_hash_dynstr too. * emultempl/lnk960.em (lnk960_before_allocation): Delete. (ld_lnk960): Use before_allocation_default.
2005-05-04 13:00:28 +02:00
for (p = o->map_head.link_order; p != NULL; p = p->next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour ((sub = p->u.indirect.section->owner))
== bfd_target_elf_flavour)
&& elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass)
{
if (! sub->output_has_begun)
{
if (! elf_link_input_bfd (&flinfo, sub))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
sub->output_has_begun = TRUE;
}
}
else if (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order)
{
if (! elf_reloc_link_order (abfd, info, o, p))
goto error_return;
}
else
{
if (! _bfd_default_link_order (abfd, info, o, p))
Add x86-64 ILP32 support. bfd/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * archures.c (bfd_mach_x64_32): New. (bfd_mach_x64_32_intel_syntax): Likewise. * bfd-in2.h: Regenerated. * config.bfd (targ64_selvecs): Add bfd_elf32_x86_64_vec for i[3-7]86-*-linux-*. (targ_selvecs): Add bfd_elf32_x86_64_vec for x86_64-*-linux-*. * configure.in: Support bfd_elf32_x86_64_vec. * configure: Regenerated. * cpu-i386.c (bfd_x64_32_arch_intel_syntax): New. (bfd_x64_32_arch): Likewise. * elf-bfd.h (elf_append_rela): New prototype. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * elf64-x86-64.c (ABI_64_P): New. (elf_x86_64_info_to_howto): Replace ELF64_R_TYPE with ELF32_R_TYPE. Replace ELF64_ST_TYPE with ELF_ST_TYPE. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_reloc_type_class): Likewise. (ELF_DYNAMIC_INTERPRETER): Renamed to ... (ELF64_DYNAMIC_INTERPRETER): This. (ELF32_DYNAMIC_INTERPRETER): New. (elf_x86_64_link_hash_table): Add r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_get_local_sym_hash): Replace ELF64_R_SYM with htab->r_sym. Replace ELF64_R_INFO with htab->r_info. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_local_dynamic_symbol): Likewise. (elf_x86_64_link_hash_table_create): Initialize r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_check_relocs): Check ABI_64_P when requesting for PIC. (elf_x86_64_relocate_section): Likewise. (elf64_x86_64_adjust_dynamic_symbol): Replace sizeof (Elf64_External_Rela) with bed->s->sizeof_rela. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_append_rela): Removed. (elf32_x86_64_elf_object_p): New. Add bfd_elf32_x86_64_vec. * elf64-x86-64.c (elf64_x86_64_xxx): Renamed to ... (elf_x86_64_xxx): This. * elflink.c (bfd_elf_final_link): Check ELF file class on error. (elf_append_rela): New. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * targets.c (bfd_elf32_x86_64_vec): New. (_bfd_target_vector): Add bfd_elf32_x86_64_vec. gas/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (x86_elf_abi): New. (i386_mach): Return bfd_mach_x64_32 for ILP32. (OPTION_N32): Likewise. (md_longopts): Add "n32" for ELF. (md_parse_option): Handle OPTION_N32. (md_show_usage): Add --n32. (i386_target_format): Update and check x86_elf_abi. * config/tc-i386.h (ELF_TARGET_FORMAT32): New. * doc/as.texinfo: Document --n32. * doc/c-i386.texi: Likewise. gas/testsuite/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/ilp32/lns/ilp32.exp: New. * gas/i386/ilp32/lns/lns-common-1.d: Likewise. * gas/i386/ilp32/lns/lns-duplicate.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-1.d: New. * gas/i386/ilp32/cfi/cfi-common-2.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-3.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-4.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-5.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-6.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-7.d: Likewise. * gas/i386/ilp32/cfi/cfi-x86_64.d: Likewise. * gas/i386/ilp32/cfi/ilp32.exp: Likewise. * gas/i386/ilp32/elf/ehopt0.d: Likewise. * gas/i386/ilp32/elf/equ-reloc.d: Likewise. * gas/i386/ilp32/elf/file.d: Likewise. * gas/i386/ilp32/elf/group0a.d: Likewise. * gas/i386/ilp32/elf/group0b.d: Likewise. * gas/i386/ilp32/elf/group1a.d: Likewise. * gas/i386/ilp32/elf/group1b.d: Likewise. * gas/i386/ilp32/elf/ifunc-1.d: Likewise. * gas/i386/ilp32/elf/ilp32.exp: Likewise. * gas/i386/ilp32/elf/redef.d: Likewise. * gas/i386/ilp32/elf/section0.d: Likewise. * gas/i386/ilp32/elf/section1.d: Likewise. * gas/i386/ilp32/elf/section3.d: Likewise. * gas/i386/ilp32/elf/section4.d: Likewise. * gas/i386/ilp32/elf/section6.d: Likewise. * gas/i386/ilp32/elf/section7.d: Likewise. * gas/i386/ilp32/elf/struct.d: Likewise. * gas/i386/ilp32/elf/symtab.d: Likewise. * gas/i386/ilp32/elf/symver.d: Likewise. * gas/i386/ilp32/ilp32.exp: New. * gas/i386/ilp32/immed64.d: Likewise. * gas/i386/ilp32/mixed-mode-reloc64.d: Likewise. * gas/i386/ilp32/reloc64.d: Likewise. * gas/i386/ilp32/rex.d: Likewise. * gas/i386/ilp32/rexw.d: Likewise. * gas/i386/ilp32/svme64.d: Likewise. * gas/i386/ilp32/x86-64-addr32.d: Likewise. * gas/i386/ilp32/x86-64-addr32-intel.d: Likewise. * gas/i386/ilp32/x86-64-aes.d: Likewise. * gas/i386/ilp32/x86-64-aes-intel.d: Likewise. * gas/i386/ilp32/x86-64-amdfam10.d: Likewise. * gas/i386/ilp32/x86-64-arch-1.d: Likewise. * gas/i386/ilp32/x86-64-arch-2.d: Likewise. * gas/i386/ilp32/x86-64-avx.d: Likewise. * gas/i386/ilp32/x86-64-avx-intel.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap-intel.d: Likewise. * gas/i386/ilp32/x86-64-branch.d: Likewise. * gas/i386/ilp32/x86-64-cbw.d: Likewise. * gas/i386/ilp32/x86-64-cbw-intel.d: Likewise. * gas/i386/ilp32/x86-64-clmul.d: Likewise. * gas/i386/ilp32/x86-64-clmul-intel.d: Likewise. * gas/i386/ilp32/x86-64-crc32.d: Likewise. * gas/i386/ilp32/x86-64-crc32-intel.d: Likewise. * gas/i386/ilp32/x86-64-crx.d: Likewise. * gas/i386/ilp32/x86-64-crx-suffix.d: Likewise. * gas/i386/ilp32/x86-64.d: Likewise. * gas/i386/ilp32/x86-64-disp.d: Likewise. * gas/i386/ilp32/x86-64-disp-intel.d: Likewise. * gas/i386/ilp32/x86-64-drx.d: Likewise. * gas/i386/ilp32/x86-64-drx-suffix.d: Likewise. * gas/i386/ilp32/x86-64-ept.d: Likewise. * gas/i386/ilp32/x86-64-ept-intel.d: Likewise. * gas/i386/ilp32/x86-64-fma4.d: Likewise. * gas/i386/ilp32/x86-64-fma.d: Likewise. * gas/i386/ilp32/x86-64-fma-intel.d: Likewise. * gas/i386/ilp32/x86-64-gidt.d: Likewise. * gas/i386/ilp32/x86-64-ifunc.d: Likewise. * gas/i386/ilp32/x86-64-intel64.d: Likewise. * gas/i386/ilp32/x86-64-io.d: Likewise. * gas/i386/ilp32/x86-64-io-intel.d: Likewise. * gas/i386/ilp32/x86-64-io-suffix.d: Likewise. * gas/i386/ilp32/x86-64-localpic.d: Likewise. * gas/i386/ilp32/x86-64-mem.d: Likewise. * gas/i386/ilp32/x86-64-mem-intel.d: Likewise. * gas/i386/ilp32/x86-64-movbe.d: Likewise. * gas/i386/ilp32/x86-64-movbe-intel.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-1.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise. * gas/i386/ilp32/x86-64-nops-2.d: Likewise. * gas/i386/ilp32/x86-64-nops-3.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-4.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-5.d: Likewise. * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops.d: Likewise. * gas/i386/ilp32/x86-64-opcode.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/ilp32/x86-64-opts.d: Likewise. * gas/i386/ilp32/x86-64-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-pcrel.d: Likewise. * gas/i386/ilp32/x86-64-reg.d: Likewise. * gas/i386/ilp32/x86-64-reg-intel.d: Likewise. * gas/i386/ilp32/x86-64-rep.d: Likewise. * gas/i386/ilp32/x86-64-rep-suffix.d: Likewise. * gas/i386/ilp32/x86-64-rip.d: Likewise. * gas/i386/ilp32/x86-64-rip-intel.d: Likewise. * gas/i386/ilp32/x86-64-sib.d: Likewise. * gas/i386/ilp32/x86-64-sib-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd.d: Likewise. * gas/i386/ilp32/x86-64-simd-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd-suffix.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse3.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse-check.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-none.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-warn.d: Likewise. * gas/i386/ilp32/x86-64-sse-noavx.d: Likewise. * gas/i386/ilp32/x86-64-ssse3.d: Likewise. * gas/i386/ilp32/x86-64-stack.d: Likewise. * gas/i386/ilp32/x86-64-stack-intel.d: Likewise. * gas/i386/ilp32/x86-64-stack-suffix.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/ilp32/x86-64-vmx.d: Likewise. * gas/i386/ilp32/x86-64-xsave.d: Likewise. * gas/i386/ilp32/x86-64-xsave-intel.d: Likewise. ld/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * emulparams/elf32_x86_64.sh: New. * configure.tgt (targ64_extra_emuls): Add elf32_x86_64 for i[3-7]86-*-linux-*. (targ_extra_libpath): Likewise. (targ_extra_emuls): Add elf32_x86_64 for x86_64-*-linux-*. (targ_extra_libpath): Likewise. * Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf32_x86_64.c. (eelf32_x86_64.c): New. * Makefile.in: Regenerated. opcodes/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (print_insn): Support bfd_mach_x64_32 and bfd_mach_x64_32_intel_syntax.
2010-12-31 01:33:36 +01:00
{
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour (sub)
== bfd_target_elf_flavour)
&& (elf_elfheader (sub)->e_ident[EI_CLASS]
!= bed->s->elfclass))
{
const char *iclass, *oclass;
switch (bed->s->elfclass)
Add x86-64 ILP32 support. bfd/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * archures.c (bfd_mach_x64_32): New. (bfd_mach_x64_32_intel_syntax): Likewise. * bfd-in2.h: Regenerated. * config.bfd (targ64_selvecs): Add bfd_elf32_x86_64_vec for i[3-7]86-*-linux-*. (targ_selvecs): Add bfd_elf32_x86_64_vec for x86_64-*-linux-*. * configure.in: Support bfd_elf32_x86_64_vec. * configure: Regenerated. * cpu-i386.c (bfd_x64_32_arch_intel_syntax): New. (bfd_x64_32_arch): Likewise. * elf-bfd.h (elf_append_rela): New prototype. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * elf64-x86-64.c (ABI_64_P): New. (elf_x86_64_info_to_howto): Replace ELF64_R_TYPE with ELF32_R_TYPE. Replace ELF64_ST_TYPE with ELF_ST_TYPE. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_reloc_type_class): Likewise. (ELF_DYNAMIC_INTERPRETER): Renamed to ... (ELF64_DYNAMIC_INTERPRETER): This. (ELF32_DYNAMIC_INTERPRETER): New. (elf_x86_64_link_hash_table): Add r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_get_local_sym_hash): Replace ELF64_R_SYM with htab->r_sym. Replace ELF64_R_INFO with htab->r_info. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_local_dynamic_symbol): Likewise. (elf_x86_64_link_hash_table_create): Initialize r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_check_relocs): Check ABI_64_P when requesting for PIC. (elf_x86_64_relocate_section): Likewise. (elf64_x86_64_adjust_dynamic_symbol): Replace sizeof (Elf64_External_Rela) with bed->s->sizeof_rela. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_append_rela): Removed. (elf32_x86_64_elf_object_p): New. Add bfd_elf32_x86_64_vec. * elf64-x86-64.c (elf64_x86_64_xxx): Renamed to ... (elf_x86_64_xxx): This. * elflink.c (bfd_elf_final_link): Check ELF file class on error. (elf_append_rela): New. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * targets.c (bfd_elf32_x86_64_vec): New. (_bfd_target_vector): Add bfd_elf32_x86_64_vec. gas/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (x86_elf_abi): New. (i386_mach): Return bfd_mach_x64_32 for ILP32. (OPTION_N32): Likewise. (md_longopts): Add "n32" for ELF. (md_parse_option): Handle OPTION_N32. (md_show_usage): Add --n32. (i386_target_format): Update and check x86_elf_abi. * config/tc-i386.h (ELF_TARGET_FORMAT32): New. * doc/as.texinfo: Document --n32. * doc/c-i386.texi: Likewise. gas/testsuite/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/ilp32/lns/ilp32.exp: New. * gas/i386/ilp32/lns/lns-common-1.d: Likewise. * gas/i386/ilp32/lns/lns-duplicate.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-1.d: New. * gas/i386/ilp32/cfi/cfi-common-2.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-3.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-4.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-5.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-6.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-7.d: Likewise. * gas/i386/ilp32/cfi/cfi-x86_64.d: Likewise. * gas/i386/ilp32/cfi/ilp32.exp: Likewise. * gas/i386/ilp32/elf/ehopt0.d: Likewise. * gas/i386/ilp32/elf/equ-reloc.d: Likewise. * gas/i386/ilp32/elf/file.d: Likewise. * gas/i386/ilp32/elf/group0a.d: Likewise. * gas/i386/ilp32/elf/group0b.d: Likewise. * gas/i386/ilp32/elf/group1a.d: Likewise. * gas/i386/ilp32/elf/group1b.d: Likewise. * gas/i386/ilp32/elf/ifunc-1.d: Likewise. * gas/i386/ilp32/elf/ilp32.exp: Likewise. * gas/i386/ilp32/elf/redef.d: Likewise. * gas/i386/ilp32/elf/section0.d: Likewise. * gas/i386/ilp32/elf/section1.d: Likewise. * gas/i386/ilp32/elf/section3.d: Likewise. * gas/i386/ilp32/elf/section4.d: Likewise. * gas/i386/ilp32/elf/section6.d: Likewise. * gas/i386/ilp32/elf/section7.d: Likewise. * gas/i386/ilp32/elf/struct.d: Likewise. * gas/i386/ilp32/elf/symtab.d: Likewise. * gas/i386/ilp32/elf/symver.d: Likewise. * gas/i386/ilp32/ilp32.exp: New. * gas/i386/ilp32/immed64.d: Likewise. * gas/i386/ilp32/mixed-mode-reloc64.d: Likewise. * gas/i386/ilp32/reloc64.d: Likewise. * gas/i386/ilp32/rex.d: Likewise. * gas/i386/ilp32/rexw.d: Likewise. * gas/i386/ilp32/svme64.d: Likewise. * gas/i386/ilp32/x86-64-addr32.d: Likewise. * gas/i386/ilp32/x86-64-addr32-intel.d: Likewise. * gas/i386/ilp32/x86-64-aes.d: Likewise. * gas/i386/ilp32/x86-64-aes-intel.d: Likewise. * gas/i386/ilp32/x86-64-amdfam10.d: Likewise. * gas/i386/ilp32/x86-64-arch-1.d: Likewise. * gas/i386/ilp32/x86-64-arch-2.d: Likewise. * gas/i386/ilp32/x86-64-avx.d: Likewise. * gas/i386/ilp32/x86-64-avx-intel.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap-intel.d: Likewise. * gas/i386/ilp32/x86-64-branch.d: Likewise. * gas/i386/ilp32/x86-64-cbw.d: Likewise. * gas/i386/ilp32/x86-64-cbw-intel.d: Likewise. * gas/i386/ilp32/x86-64-clmul.d: Likewise. * gas/i386/ilp32/x86-64-clmul-intel.d: Likewise. * gas/i386/ilp32/x86-64-crc32.d: Likewise. * gas/i386/ilp32/x86-64-crc32-intel.d: Likewise. * gas/i386/ilp32/x86-64-crx.d: Likewise. * gas/i386/ilp32/x86-64-crx-suffix.d: Likewise. * gas/i386/ilp32/x86-64.d: Likewise. * gas/i386/ilp32/x86-64-disp.d: Likewise. * gas/i386/ilp32/x86-64-disp-intel.d: Likewise. * gas/i386/ilp32/x86-64-drx.d: Likewise. * gas/i386/ilp32/x86-64-drx-suffix.d: Likewise. * gas/i386/ilp32/x86-64-ept.d: Likewise. * gas/i386/ilp32/x86-64-ept-intel.d: Likewise. * gas/i386/ilp32/x86-64-fma4.d: Likewise. * gas/i386/ilp32/x86-64-fma.d: Likewise. * gas/i386/ilp32/x86-64-fma-intel.d: Likewise. * gas/i386/ilp32/x86-64-gidt.d: Likewise. * gas/i386/ilp32/x86-64-ifunc.d: Likewise. * gas/i386/ilp32/x86-64-intel64.d: Likewise. * gas/i386/ilp32/x86-64-io.d: Likewise. * gas/i386/ilp32/x86-64-io-intel.d: Likewise. * gas/i386/ilp32/x86-64-io-suffix.d: Likewise. * gas/i386/ilp32/x86-64-localpic.d: Likewise. * gas/i386/ilp32/x86-64-mem.d: Likewise. * gas/i386/ilp32/x86-64-mem-intel.d: Likewise. * gas/i386/ilp32/x86-64-movbe.d: Likewise. * gas/i386/ilp32/x86-64-movbe-intel.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-1.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise. * gas/i386/ilp32/x86-64-nops-2.d: Likewise. * gas/i386/ilp32/x86-64-nops-3.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-4.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-5.d: Likewise. * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops.d: Likewise. * gas/i386/ilp32/x86-64-opcode.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/ilp32/x86-64-opts.d: Likewise. * gas/i386/ilp32/x86-64-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-pcrel.d: Likewise. * gas/i386/ilp32/x86-64-reg.d: Likewise. * gas/i386/ilp32/x86-64-reg-intel.d: Likewise. * gas/i386/ilp32/x86-64-rep.d: Likewise. * gas/i386/ilp32/x86-64-rep-suffix.d: Likewise. * gas/i386/ilp32/x86-64-rip.d: Likewise. * gas/i386/ilp32/x86-64-rip-intel.d: Likewise. * gas/i386/ilp32/x86-64-sib.d: Likewise. * gas/i386/ilp32/x86-64-sib-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd.d: Likewise. * gas/i386/ilp32/x86-64-simd-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd-suffix.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse3.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse-check.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-none.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-warn.d: Likewise. * gas/i386/ilp32/x86-64-sse-noavx.d: Likewise. * gas/i386/ilp32/x86-64-ssse3.d: Likewise. * gas/i386/ilp32/x86-64-stack.d: Likewise. * gas/i386/ilp32/x86-64-stack-intel.d: Likewise. * gas/i386/ilp32/x86-64-stack-suffix.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/ilp32/x86-64-vmx.d: Likewise. * gas/i386/ilp32/x86-64-xsave.d: Likewise. * gas/i386/ilp32/x86-64-xsave-intel.d: Likewise. ld/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * emulparams/elf32_x86_64.sh: New. * configure.tgt (targ64_extra_emuls): Add elf32_x86_64 for i[3-7]86-*-linux-*. (targ_extra_libpath): Likewise. (targ_extra_emuls): Add elf32_x86_64 for x86_64-*-linux-*. (targ_extra_libpath): Likewise. * Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf32_x86_64.c. (eelf32_x86_64.c): New. * Makefile.in: Regenerated. opcodes/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (print_insn): Support bfd_mach_x64_32 and bfd_mach_x64_32_intel_syntax.
2010-12-31 01:33:36 +01:00
{
case ELFCLASS64: oclass = "ELFCLASS64"; break;
case ELFCLASS32: oclass = "ELFCLASS32"; break;
case ELFCLASSNONE: oclass = "ELFCLASSNONE"; break;
default: abort ();
Add x86-64 ILP32 support. bfd/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * archures.c (bfd_mach_x64_32): New. (bfd_mach_x64_32_intel_syntax): Likewise. * bfd-in2.h: Regenerated. * config.bfd (targ64_selvecs): Add bfd_elf32_x86_64_vec for i[3-7]86-*-linux-*. (targ_selvecs): Add bfd_elf32_x86_64_vec for x86_64-*-linux-*. * configure.in: Support bfd_elf32_x86_64_vec. * configure: Regenerated. * cpu-i386.c (bfd_x64_32_arch_intel_syntax): New. (bfd_x64_32_arch): Likewise. * elf-bfd.h (elf_append_rela): New prototype. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * elf64-x86-64.c (ABI_64_P): New. (elf_x86_64_info_to_howto): Replace ELF64_R_TYPE with ELF32_R_TYPE. Replace ELF64_ST_TYPE with ELF_ST_TYPE. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_reloc_type_class): Likewise. (ELF_DYNAMIC_INTERPRETER): Renamed to ... (ELF64_DYNAMIC_INTERPRETER): This. (ELF32_DYNAMIC_INTERPRETER): New. (elf_x86_64_link_hash_table): Add r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_get_local_sym_hash): Replace ELF64_R_SYM with htab->r_sym. Replace ELF64_R_INFO with htab->r_info. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_local_dynamic_symbol): Likewise. (elf_x86_64_link_hash_table_create): Initialize r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_check_relocs): Check ABI_64_P when requesting for PIC. (elf_x86_64_relocate_section): Likewise. (elf64_x86_64_adjust_dynamic_symbol): Replace sizeof (Elf64_External_Rela) with bed->s->sizeof_rela. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_append_rela): Removed. (elf32_x86_64_elf_object_p): New. Add bfd_elf32_x86_64_vec. * elf64-x86-64.c (elf64_x86_64_xxx): Renamed to ... (elf_x86_64_xxx): This. * elflink.c (bfd_elf_final_link): Check ELF file class on error. (elf_append_rela): New. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * targets.c (bfd_elf32_x86_64_vec): New. (_bfd_target_vector): Add bfd_elf32_x86_64_vec. gas/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (x86_elf_abi): New. (i386_mach): Return bfd_mach_x64_32 for ILP32. (OPTION_N32): Likewise. (md_longopts): Add "n32" for ELF. (md_parse_option): Handle OPTION_N32. (md_show_usage): Add --n32. (i386_target_format): Update and check x86_elf_abi. * config/tc-i386.h (ELF_TARGET_FORMAT32): New. * doc/as.texinfo: Document --n32. * doc/c-i386.texi: Likewise. gas/testsuite/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/ilp32/lns/ilp32.exp: New. * gas/i386/ilp32/lns/lns-common-1.d: Likewise. * gas/i386/ilp32/lns/lns-duplicate.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-1.d: New. * gas/i386/ilp32/cfi/cfi-common-2.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-3.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-4.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-5.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-6.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-7.d: Likewise. * gas/i386/ilp32/cfi/cfi-x86_64.d: Likewise. * gas/i386/ilp32/cfi/ilp32.exp: Likewise. * gas/i386/ilp32/elf/ehopt0.d: Likewise. * gas/i386/ilp32/elf/equ-reloc.d: Likewise. * gas/i386/ilp32/elf/file.d: Likewise. * gas/i386/ilp32/elf/group0a.d: Likewise. * gas/i386/ilp32/elf/group0b.d: Likewise. * gas/i386/ilp32/elf/group1a.d: Likewise. * gas/i386/ilp32/elf/group1b.d: Likewise. * gas/i386/ilp32/elf/ifunc-1.d: Likewise. * gas/i386/ilp32/elf/ilp32.exp: Likewise. * gas/i386/ilp32/elf/redef.d: Likewise. * gas/i386/ilp32/elf/section0.d: Likewise. * gas/i386/ilp32/elf/section1.d: Likewise. * gas/i386/ilp32/elf/section3.d: Likewise. * gas/i386/ilp32/elf/section4.d: Likewise. * gas/i386/ilp32/elf/section6.d: Likewise. * gas/i386/ilp32/elf/section7.d: Likewise. * gas/i386/ilp32/elf/struct.d: Likewise. * gas/i386/ilp32/elf/symtab.d: Likewise. * gas/i386/ilp32/elf/symver.d: Likewise. * gas/i386/ilp32/ilp32.exp: New. * gas/i386/ilp32/immed64.d: Likewise. * gas/i386/ilp32/mixed-mode-reloc64.d: Likewise. * gas/i386/ilp32/reloc64.d: Likewise. * gas/i386/ilp32/rex.d: Likewise. * gas/i386/ilp32/rexw.d: Likewise. * gas/i386/ilp32/svme64.d: Likewise. * gas/i386/ilp32/x86-64-addr32.d: Likewise. * gas/i386/ilp32/x86-64-addr32-intel.d: Likewise. * gas/i386/ilp32/x86-64-aes.d: Likewise. * gas/i386/ilp32/x86-64-aes-intel.d: Likewise. * gas/i386/ilp32/x86-64-amdfam10.d: Likewise. * gas/i386/ilp32/x86-64-arch-1.d: Likewise. * gas/i386/ilp32/x86-64-arch-2.d: Likewise. * gas/i386/ilp32/x86-64-avx.d: Likewise. * gas/i386/ilp32/x86-64-avx-intel.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap-intel.d: Likewise. * gas/i386/ilp32/x86-64-branch.d: Likewise. * gas/i386/ilp32/x86-64-cbw.d: Likewise. * gas/i386/ilp32/x86-64-cbw-intel.d: Likewise. * gas/i386/ilp32/x86-64-clmul.d: Likewise. * gas/i386/ilp32/x86-64-clmul-intel.d: Likewise. * gas/i386/ilp32/x86-64-crc32.d: Likewise. * gas/i386/ilp32/x86-64-crc32-intel.d: Likewise. * gas/i386/ilp32/x86-64-crx.d: Likewise. * gas/i386/ilp32/x86-64-crx-suffix.d: Likewise. * gas/i386/ilp32/x86-64.d: Likewise. * gas/i386/ilp32/x86-64-disp.d: Likewise. * gas/i386/ilp32/x86-64-disp-intel.d: Likewise. * gas/i386/ilp32/x86-64-drx.d: Likewise. * gas/i386/ilp32/x86-64-drx-suffix.d: Likewise. * gas/i386/ilp32/x86-64-ept.d: Likewise. * gas/i386/ilp32/x86-64-ept-intel.d: Likewise. * gas/i386/ilp32/x86-64-fma4.d: Likewise. * gas/i386/ilp32/x86-64-fma.d: Likewise. * gas/i386/ilp32/x86-64-fma-intel.d: Likewise. * gas/i386/ilp32/x86-64-gidt.d: Likewise. * gas/i386/ilp32/x86-64-ifunc.d: Likewise. * gas/i386/ilp32/x86-64-intel64.d: Likewise. * gas/i386/ilp32/x86-64-io.d: Likewise. * gas/i386/ilp32/x86-64-io-intel.d: Likewise. * gas/i386/ilp32/x86-64-io-suffix.d: Likewise. * gas/i386/ilp32/x86-64-localpic.d: Likewise. * gas/i386/ilp32/x86-64-mem.d: Likewise. * gas/i386/ilp32/x86-64-mem-intel.d: Likewise. * gas/i386/ilp32/x86-64-movbe.d: Likewise. * gas/i386/ilp32/x86-64-movbe-intel.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-1.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise. * gas/i386/ilp32/x86-64-nops-2.d: Likewise. * gas/i386/ilp32/x86-64-nops-3.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-4.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-5.d: Likewise. * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops.d: Likewise. * gas/i386/ilp32/x86-64-opcode.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/ilp32/x86-64-opts.d: Likewise. * gas/i386/ilp32/x86-64-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-pcrel.d: Likewise. * gas/i386/ilp32/x86-64-reg.d: Likewise. * gas/i386/ilp32/x86-64-reg-intel.d: Likewise. * gas/i386/ilp32/x86-64-rep.d: Likewise. * gas/i386/ilp32/x86-64-rep-suffix.d: Likewise. * gas/i386/ilp32/x86-64-rip.d: Likewise. * gas/i386/ilp32/x86-64-rip-intel.d: Likewise. * gas/i386/ilp32/x86-64-sib.d: Likewise. * gas/i386/ilp32/x86-64-sib-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd.d: Likewise. * gas/i386/ilp32/x86-64-simd-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd-suffix.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse3.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse-check.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-none.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-warn.d: Likewise. * gas/i386/ilp32/x86-64-sse-noavx.d: Likewise. * gas/i386/ilp32/x86-64-ssse3.d: Likewise. * gas/i386/ilp32/x86-64-stack.d: Likewise. * gas/i386/ilp32/x86-64-stack-intel.d: Likewise. * gas/i386/ilp32/x86-64-stack-suffix.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/ilp32/x86-64-vmx.d: Likewise. * gas/i386/ilp32/x86-64-xsave.d: Likewise. * gas/i386/ilp32/x86-64-xsave-intel.d: Likewise. ld/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * emulparams/elf32_x86_64.sh: New. * configure.tgt (targ64_extra_emuls): Add elf32_x86_64 for i[3-7]86-*-linux-*. (targ_extra_libpath): Likewise. (targ_extra_emuls): Add elf32_x86_64 for x86_64-*-linux-*. (targ_extra_libpath): Likewise. * Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf32_x86_64.c. (eelf32_x86_64.c): New. * Makefile.in: Regenerated. opcodes/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (print_insn): Support bfd_mach_x64_32 and bfd_mach_x64_32_intel_syntax.
2010-12-31 01:33:36 +01:00
}
switch (elf_elfheader (sub)->e_ident[EI_CLASS])
Add x86-64 ILP32 support. bfd/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * archures.c (bfd_mach_x64_32): New. (bfd_mach_x64_32_intel_syntax): Likewise. * bfd-in2.h: Regenerated. * config.bfd (targ64_selvecs): Add bfd_elf32_x86_64_vec for i[3-7]86-*-linux-*. (targ_selvecs): Add bfd_elf32_x86_64_vec for x86_64-*-linux-*. * configure.in: Support bfd_elf32_x86_64_vec. * configure: Regenerated. * cpu-i386.c (bfd_x64_32_arch_intel_syntax): New. (bfd_x64_32_arch): Likewise. * elf-bfd.h (elf_append_rela): New prototype. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * elf64-x86-64.c (ABI_64_P): New. (elf_x86_64_info_to_howto): Replace ELF64_R_TYPE with ELF32_R_TYPE. Replace ELF64_ST_TYPE with ELF_ST_TYPE. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_reloc_type_class): Likewise. (ELF_DYNAMIC_INTERPRETER): Renamed to ... (ELF64_DYNAMIC_INTERPRETER): This. (ELF32_DYNAMIC_INTERPRETER): New. (elf_x86_64_link_hash_table): Add r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_get_local_sym_hash): Replace ELF64_R_SYM with htab->r_sym. Replace ELF64_R_INFO with htab->r_info. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_local_dynamic_symbol): Likewise. (elf_x86_64_link_hash_table_create): Initialize r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_check_relocs): Check ABI_64_P when requesting for PIC. (elf_x86_64_relocate_section): Likewise. (elf64_x86_64_adjust_dynamic_symbol): Replace sizeof (Elf64_External_Rela) with bed->s->sizeof_rela. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_append_rela): Removed. (elf32_x86_64_elf_object_p): New. Add bfd_elf32_x86_64_vec. * elf64-x86-64.c (elf64_x86_64_xxx): Renamed to ... (elf_x86_64_xxx): This. * elflink.c (bfd_elf_final_link): Check ELF file class on error. (elf_append_rela): New. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * targets.c (bfd_elf32_x86_64_vec): New. (_bfd_target_vector): Add bfd_elf32_x86_64_vec. gas/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (x86_elf_abi): New. (i386_mach): Return bfd_mach_x64_32 for ILP32. (OPTION_N32): Likewise. (md_longopts): Add "n32" for ELF. (md_parse_option): Handle OPTION_N32. (md_show_usage): Add --n32. (i386_target_format): Update and check x86_elf_abi. * config/tc-i386.h (ELF_TARGET_FORMAT32): New. * doc/as.texinfo: Document --n32. * doc/c-i386.texi: Likewise. gas/testsuite/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/ilp32/lns/ilp32.exp: New. * gas/i386/ilp32/lns/lns-common-1.d: Likewise. * gas/i386/ilp32/lns/lns-duplicate.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-1.d: New. * gas/i386/ilp32/cfi/cfi-common-2.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-3.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-4.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-5.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-6.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-7.d: Likewise. * gas/i386/ilp32/cfi/cfi-x86_64.d: Likewise. * gas/i386/ilp32/cfi/ilp32.exp: Likewise. * gas/i386/ilp32/elf/ehopt0.d: Likewise. * gas/i386/ilp32/elf/equ-reloc.d: Likewise. * gas/i386/ilp32/elf/file.d: Likewise. * gas/i386/ilp32/elf/group0a.d: Likewise. * gas/i386/ilp32/elf/group0b.d: Likewise. * gas/i386/ilp32/elf/group1a.d: Likewise. * gas/i386/ilp32/elf/group1b.d: Likewise. * gas/i386/ilp32/elf/ifunc-1.d: Likewise. * gas/i386/ilp32/elf/ilp32.exp: Likewise. * gas/i386/ilp32/elf/redef.d: Likewise. * gas/i386/ilp32/elf/section0.d: Likewise. * gas/i386/ilp32/elf/section1.d: Likewise. * gas/i386/ilp32/elf/section3.d: Likewise. * gas/i386/ilp32/elf/section4.d: Likewise. * gas/i386/ilp32/elf/section6.d: Likewise. * gas/i386/ilp32/elf/section7.d: Likewise. * gas/i386/ilp32/elf/struct.d: Likewise. * gas/i386/ilp32/elf/symtab.d: Likewise. * gas/i386/ilp32/elf/symver.d: Likewise. * gas/i386/ilp32/ilp32.exp: New. * gas/i386/ilp32/immed64.d: Likewise. * gas/i386/ilp32/mixed-mode-reloc64.d: Likewise. * gas/i386/ilp32/reloc64.d: Likewise. * gas/i386/ilp32/rex.d: Likewise. * gas/i386/ilp32/rexw.d: Likewise. * gas/i386/ilp32/svme64.d: Likewise. * gas/i386/ilp32/x86-64-addr32.d: Likewise. * gas/i386/ilp32/x86-64-addr32-intel.d: Likewise. * gas/i386/ilp32/x86-64-aes.d: Likewise. * gas/i386/ilp32/x86-64-aes-intel.d: Likewise. * gas/i386/ilp32/x86-64-amdfam10.d: Likewise. * gas/i386/ilp32/x86-64-arch-1.d: Likewise. * gas/i386/ilp32/x86-64-arch-2.d: Likewise. * gas/i386/ilp32/x86-64-avx.d: Likewise. * gas/i386/ilp32/x86-64-avx-intel.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap-intel.d: Likewise. * gas/i386/ilp32/x86-64-branch.d: Likewise. * gas/i386/ilp32/x86-64-cbw.d: Likewise. * gas/i386/ilp32/x86-64-cbw-intel.d: Likewise. * gas/i386/ilp32/x86-64-clmul.d: Likewise. * gas/i386/ilp32/x86-64-clmul-intel.d: Likewise. * gas/i386/ilp32/x86-64-crc32.d: Likewise. * gas/i386/ilp32/x86-64-crc32-intel.d: Likewise. * gas/i386/ilp32/x86-64-crx.d: Likewise. * gas/i386/ilp32/x86-64-crx-suffix.d: Likewise. * gas/i386/ilp32/x86-64.d: Likewise. * gas/i386/ilp32/x86-64-disp.d: Likewise. * gas/i386/ilp32/x86-64-disp-intel.d: Likewise. * gas/i386/ilp32/x86-64-drx.d: Likewise. * gas/i386/ilp32/x86-64-drx-suffix.d: Likewise. * gas/i386/ilp32/x86-64-ept.d: Likewise. * gas/i386/ilp32/x86-64-ept-intel.d: Likewise. * gas/i386/ilp32/x86-64-fma4.d: Likewise. * gas/i386/ilp32/x86-64-fma.d: Likewise. * gas/i386/ilp32/x86-64-fma-intel.d: Likewise. * gas/i386/ilp32/x86-64-gidt.d: Likewise. * gas/i386/ilp32/x86-64-ifunc.d: Likewise. * gas/i386/ilp32/x86-64-intel64.d: Likewise. * gas/i386/ilp32/x86-64-io.d: Likewise. * gas/i386/ilp32/x86-64-io-intel.d: Likewise. * gas/i386/ilp32/x86-64-io-suffix.d: Likewise. * gas/i386/ilp32/x86-64-localpic.d: Likewise. * gas/i386/ilp32/x86-64-mem.d: Likewise. * gas/i386/ilp32/x86-64-mem-intel.d: Likewise. * gas/i386/ilp32/x86-64-movbe.d: Likewise. * gas/i386/ilp32/x86-64-movbe-intel.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-1.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise. * gas/i386/ilp32/x86-64-nops-2.d: Likewise. * gas/i386/ilp32/x86-64-nops-3.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-4.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-5.d: Likewise. * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops.d: Likewise. * gas/i386/ilp32/x86-64-opcode.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/ilp32/x86-64-opts.d: Likewise. * gas/i386/ilp32/x86-64-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-pcrel.d: Likewise. * gas/i386/ilp32/x86-64-reg.d: Likewise. * gas/i386/ilp32/x86-64-reg-intel.d: Likewise. * gas/i386/ilp32/x86-64-rep.d: Likewise. * gas/i386/ilp32/x86-64-rep-suffix.d: Likewise. * gas/i386/ilp32/x86-64-rip.d: Likewise. * gas/i386/ilp32/x86-64-rip-intel.d: Likewise. * gas/i386/ilp32/x86-64-sib.d: Likewise. * gas/i386/ilp32/x86-64-sib-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd.d: Likewise. * gas/i386/ilp32/x86-64-simd-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd-suffix.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse3.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse-check.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-none.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-warn.d: Likewise. * gas/i386/ilp32/x86-64-sse-noavx.d: Likewise. * gas/i386/ilp32/x86-64-ssse3.d: Likewise. * gas/i386/ilp32/x86-64-stack.d: Likewise. * gas/i386/ilp32/x86-64-stack-intel.d: Likewise. * gas/i386/ilp32/x86-64-stack-suffix.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/ilp32/x86-64-vmx.d: Likewise. * gas/i386/ilp32/x86-64-xsave.d: Likewise. * gas/i386/ilp32/x86-64-xsave-intel.d: Likewise. ld/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * emulparams/elf32_x86_64.sh: New. * configure.tgt (targ64_extra_emuls): Add elf32_x86_64 for i[3-7]86-*-linux-*. (targ_extra_libpath): Likewise. (targ_extra_emuls): Add elf32_x86_64 for x86_64-*-linux-*. (targ_extra_libpath): Likewise. * Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf32_x86_64.c. (eelf32_x86_64.c): New. * Makefile.in: Regenerated. opcodes/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (print_insn): Support bfd_mach_x64_32 and bfd_mach_x64_32_intel_syntax.
2010-12-31 01:33:36 +01:00
{
case ELFCLASS64: iclass = "ELFCLASS64"; break;
case ELFCLASS32: iclass = "ELFCLASS32"; break;
case ELFCLASSNONE: iclass = "ELFCLASSNONE"; break;
default: abort ();
Add x86-64 ILP32 support. bfd/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * archures.c (bfd_mach_x64_32): New. (bfd_mach_x64_32_intel_syntax): Likewise. * bfd-in2.h: Regenerated. * config.bfd (targ64_selvecs): Add bfd_elf32_x86_64_vec for i[3-7]86-*-linux-*. (targ_selvecs): Add bfd_elf32_x86_64_vec for x86_64-*-linux-*. * configure.in: Support bfd_elf32_x86_64_vec. * configure: Regenerated. * cpu-i386.c (bfd_x64_32_arch_intel_syntax): New. (bfd_x64_32_arch): Likewise. * elf-bfd.h (elf_append_rela): New prototype. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * elf64-x86-64.c (ABI_64_P): New. (elf_x86_64_info_to_howto): Replace ELF64_R_TYPE with ELF32_R_TYPE. Replace ELF64_ST_TYPE with ELF_ST_TYPE. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_reloc_type_class): Likewise. (ELF_DYNAMIC_INTERPRETER): Renamed to ... (ELF64_DYNAMIC_INTERPRETER): This. (ELF32_DYNAMIC_INTERPRETER): New. (elf_x86_64_link_hash_table): Add r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_get_local_sym_hash): Replace ELF64_R_SYM with htab->r_sym. Replace ELF64_R_INFO with htab->r_info. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_local_dynamic_symbol): Likewise. (elf_x86_64_link_hash_table_create): Initialize r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_check_relocs): Check ABI_64_P when requesting for PIC. (elf_x86_64_relocate_section): Likewise. (elf64_x86_64_adjust_dynamic_symbol): Replace sizeof (Elf64_External_Rela) with bed->s->sizeof_rela. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_append_rela): Removed. (elf32_x86_64_elf_object_p): New. Add bfd_elf32_x86_64_vec. * elf64-x86-64.c (elf64_x86_64_xxx): Renamed to ... (elf_x86_64_xxx): This. * elflink.c (bfd_elf_final_link): Check ELF file class on error. (elf_append_rela): New. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * targets.c (bfd_elf32_x86_64_vec): New. (_bfd_target_vector): Add bfd_elf32_x86_64_vec. gas/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (x86_elf_abi): New. (i386_mach): Return bfd_mach_x64_32 for ILP32. (OPTION_N32): Likewise. (md_longopts): Add "n32" for ELF. (md_parse_option): Handle OPTION_N32. (md_show_usage): Add --n32. (i386_target_format): Update and check x86_elf_abi. * config/tc-i386.h (ELF_TARGET_FORMAT32): New. * doc/as.texinfo: Document --n32. * doc/c-i386.texi: Likewise. gas/testsuite/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/ilp32/lns/ilp32.exp: New. * gas/i386/ilp32/lns/lns-common-1.d: Likewise. * gas/i386/ilp32/lns/lns-duplicate.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-1.d: New. * gas/i386/ilp32/cfi/cfi-common-2.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-3.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-4.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-5.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-6.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-7.d: Likewise. * gas/i386/ilp32/cfi/cfi-x86_64.d: Likewise. * gas/i386/ilp32/cfi/ilp32.exp: Likewise. * gas/i386/ilp32/elf/ehopt0.d: Likewise. * gas/i386/ilp32/elf/equ-reloc.d: Likewise. * gas/i386/ilp32/elf/file.d: Likewise. * gas/i386/ilp32/elf/group0a.d: Likewise. * gas/i386/ilp32/elf/group0b.d: Likewise. * gas/i386/ilp32/elf/group1a.d: Likewise. * gas/i386/ilp32/elf/group1b.d: Likewise. * gas/i386/ilp32/elf/ifunc-1.d: Likewise. * gas/i386/ilp32/elf/ilp32.exp: Likewise. * gas/i386/ilp32/elf/redef.d: Likewise. * gas/i386/ilp32/elf/section0.d: Likewise. * gas/i386/ilp32/elf/section1.d: Likewise. * gas/i386/ilp32/elf/section3.d: Likewise. * gas/i386/ilp32/elf/section4.d: Likewise. * gas/i386/ilp32/elf/section6.d: Likewise. * gas/i386/ilp32/elf/section7.d: Likewise. * gas/i386/ilp32/elf/struct.d: Likewise. * gas/i386/ilp32/elf/symtab.d: Likewise. * gas/i386/ilp32/elf/symver.d: Likewise. * gas/i386/ilp32/ilp32.exp: New. * gas/i386/ilp32/immed64.d: Likewise. * gas/i386/ilp32/mixed-mode-reloc64.d: Likewise. * gas/i386/ilp32/reloc64.d: Likewise. * gas/i386/ilp32/rex.d: Likewise. * gas/i386/ilp32/rexw.d: Likewise. * gas/i386/ilp32/svme64.d: Likewise. * gas/i386/ilp32/x86-64-addr32.d: Likewise. * gas/i386/ilp32/x86-64-addr32-intel.d: Likewise. * gas/i386/ilp32/x86-64-aes.d: Likewise. * gas/i386/ilp32/x86-64-aes-intel.d: Likewise. * gas/i386/ilp32/x86-64-amdfam10.d: Likewise. * gas/i386/ilp32/x86-64-arch-1.d: Likewise. * gas/i386/ilp32/x86-64-arch-2.d: Likewise. * gas/i386/ilp32/x86-64-avx.d: Likewise. * gas/i386/ilp32/x86-64-avx-intel.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap-intel.d: Likewise. * gas/i386/ilp32/x86-64-branch.d: Likewise. * gas/i386/ilp32/x86-64-cbw.d: Likewise. * gas/i386/ilp32/x86-64-cbw-intel.d: Likewise. * gas/i386/ilp32/x86-64-clmul.d: Likewise. * gas/i386/ilp32/x86-64-clmul-intel.d: Likewise. * gas/i386/ilp32/x86-64-crc32.d: Likewise. * gas/i386/ilp32/x86-64-crc32-intel.d: Likewise. * gas/i386/ilp32/x86-64-crx.d: Likewise. * gas/i386/ilp32/x86-64-crx-suffix.d: Likewise. * gas/i386/ilp32/x86-64.d: Likewise. * gas/i386/ilp32/x86-64-disp.d: Likewise. * gas/i386/ilp32/x86-64-disp-intel.d: Likewise. * gas/i386/ilp32/x86-64-drx.d: Likewise. * gas/i386/ilp32/x86-64-drx-suffix.d: Likewise. * gas/i386/ilp32/x86-64-ept.d: Likewise. * gas/i386/ilp32/x86-64-ept-intel.d: Likewise. * gas/i386/ilp32/x86-64-fma4.d: Likewise. * gas/i386/ilp32/x86-64-fma.d: Likewise. * gas/i386/ilp32/x86-64-fma-intel.d: Likewise. * gas/i386/ilp32/x86-64-gidt.d: Likewise. * gas/i386/ilp32/x86-64-ifunc.d: Likewise. * gas/i386/ilp32/x86-64-intel64.d: Likewise. * gas/i386/ilp32/x86-64-io.d: Likewise. * gas/i386/ilp32/x86-64-io-intel.d: Likewise. * gas/i386/ilp32/x86-64-io-suffix.d: Likewise. * gas/i386/ilp32/x86-64-localpic.d: Likewise. * gas/i386/ilp32/x86-64-mem.d: Likewise. * gas/i386/ilp32/x86-64-mem-intel.d: Likewise. * gas/i386/ilp32/x86-64-movbe.d: Likewise. * gas/i386/ilp32/x86-64-movbe-intel.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-1.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise. * gas/i386/ilp32/x86-64-nops-2.d: Likewise. * gas/i386/ilp32/x86-64-nops-3.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-4.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-5.d: Likewise. * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops.d: Likewise. * gas/i386/ilp32/x86-64-opcode.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/ilp32/x86-64-opts.d: Likewise. * gas/i386/ilp32/x86-64-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-pcrel.d: Likewise. * gas/i386/ilp32/x86-64-reg.d: Likewise. * gas/i386/ilp32/x86-64-reg-intel.d: Likewise. * gas/i386/ilp32/x86-64-rep.d: Likewise. * gas/i386/ilp32/x86-64-rep-suffix.d: Likewise. * gas/i386/ilp32/x86-64-rip.d: Likewise. * gas/i386/ilp32/x86-64-rip-intel.d: Likewise. * gas/i386/ilp32/x86-64-sib.d: Likewise. * gas/i386/ilp32/x86-64-sib-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd.d: Likewise. * gas/i386/ilp32/x86-64-simd-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd-suffix.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse3.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse-check.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-none.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-warn.d: Likewise. * gas/i386/ilp32/x86-64-sse-noavx.d: Likewise. * gas/i386/ilp32/x86-64-ssse3.d: Likewise. * gas/i386/ilp32/x86-64-stack.d: Likewise. * gas/i386/ilp32/x86-64-stack-intel.d: Likewise. * gas/i386/ilp32/x86-64-stack-suffix.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/ilp32/x86-64-vmx.d: Likewise. * gas/i386/ilp32/x86-64-xsave.d: Likewise. * gas/i386/ilp32/x86-64-xsave-intel.d: Likewise. ld/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * emulparams/elf32_x86_64.sh: New. * configure.tgt (targ64_extra_emuls): Add elf32_x86_64 for i[3-7]86-*-linux-*. (targ_extra_libpath): Likewise. (targ_extra_emuls): Add elf32_x86_64 for x86_64-*-linux-*. (targ_extra_libpath): Likewise. * Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf32_x86_64.c. (eelf32_x86_64.c): New. * Makefile.in: Regenerated. opcodes/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (print_insn): Support bfd_mach_x64_32 and bfd_mach_x64_32_intel_syntax.
2010-12-31 01:33:36 +01:00
}
bfd_set_error (bfd_error_wrong_format);
(*_bfd_error_handler)
(_("%B: file class %s incompatible with %s"),
sub, iclass, oclass);
}
goto error_return;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
}
2006-10-31 00:25:51 +01:00
/* Free symbol buffer if needed. */
if (!info->reduce_memory_overheads)
{
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
if (bfd_get_flavour (sub) == bfd_target_elf_flavour
&& elf_tdata (sub)->symbuf)
2006-10-31 00:25:51 +01:00
{
free (elf_tdata (sub)->symbuf);
elf_tdata (sub)->symbuf = NULL;
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Output any global symbols that got converted to local in a
version script or due to symbol visibility. We do this in a
separate step since ELF requires all local symbols to appear
prior to any global symbols. FIXME: We should only do this if
some global symbols were, in fact, converted to become local.
FIXME: Will this work correctly with the Irix 5 linker? */
eoinfo.failed = FALSE;
eoinfo.flinfo = &flinfo;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
eoinfo.localsyms = TRUE;
ld/ELF: refine fake STT_FILE symbol emission There's no real need to emit these always: They're needed only if we indeed want to emit a localized symbol. Hence defer emission until we at least did the basic early checks that would lead to no such symbol getting emitted. This in particular avoids emitting such a symbol in the majority of (if not all) "ld -r" cases. I hope my set of cross build tests caught all the test cases needing adjustment - please forgive if I missed a few. bfd/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * elflink.c (struct elf_outext_info): Add field file_sym_done. (bfd_elf_final_link): Initialize new field. Move fake STT_FILE symbol emission from here ... (elf_link_output_extsym): ... to here. gas/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * gas/microblaze/relax_size.elf: Drop expectation of no longer present STT_FILE symbol. * gas/microblaze/relax_size2.elf: Likewise. ld/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * ld-cris/tls-e-tpoffcomm1.d: Drop expectation of no longer present STT_FILE symbol. * ld-mmix/bpo-18.d: Likewise. * ld-mmix/bpo-22.d: Likewise. * ld-mmix/greg-6.d: Likewise. * ld-mmix/greg-7.d: Likewise. * ld-mmix/loc4.d: Likewise. * ld-mmix/local1.d: Likewise. * ld-mmix/local3.d: Likewise. * ld-mmix/local5.d: Likewise. * ld-mmix/local7.d: Likewise. * ld-mmix/loct-1.d: Likewise. * ld-sh/sh64/abi32.xd: Likewise. * ld-sh/sh64/abi64.xd: Likewise. * ld-sh/sh64/cmpct1.xd: Likewise. * ld-sh/sh64/crange1.rd: Likewise. * ld-sh/sh64/crange2.rd: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crange3.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-sh/sh64/mix1.xd: Likewise. * ld-sh/sh64/mix2.xd: Likewise. * ld-sh/sh64/shdl32.xd: Likewise. * ld-sh/sh64/shdl64.xd: Likewise.
2013-10-29 17:52:24 +01:00
eoinfo.file_sym_done = FALSE;
* linker.c (bfd_link_hash_traverse): Follow warning symbol link. (_bfd_generic_link_write_global_symbol, fix_syms): Don't handle warning symbols here. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.c (allocate_dynrelocs_for_symbol, elf32_arm_readonly_dynrelocs): Likewise. * elf32-bfin.c (bfin_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): Likewise. * elf32-hppa.c (allocate_plt_static, allocate_dynrelocs, clobber_millicode_symbols, readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-i386.c (elf_i386_allocate_dynrelocs, elf_i386_readonly_dynrelocs): Likewise. * elf32-lm32.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m32c.c (m32c_relax_plt_check, m32c_relax_plt_realloc): Likewise. * elf32-m32r.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-microblaze.c (allocate_dynrelocs): Likewise. * elf32-ppc.c (allocate_dynrelocs, maybe_set_textrel): Likewise. * elf32-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-score.c (score_elf_sort_hash_table_f): Likewise. * elf32-score7.c (score_elf_sort_hash_table_f): Likewise. * elf32-sh.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-tic6x.c (elf32_tic6x_allocate_dynrelocs, elf32_tic6x_readonly_dynrelocs): Likewise. * elf32-vax.c (elf_vax_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check, xstormy16_relax_plt_realloc): Likewise. * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_1): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions, allocate_global_data_opd, elf64_hppa_mark_milli_and_exported_functions, elf_hppa_unmark_useless_dynamic_symbols, elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref, func_desc_adjust, adjust_opd_syms, adjust_toc_syms, allocate_dynrelocs, readonly_dynrelocs, merge_global_got, reallocate_got, undo_symbol_twiddle): Likewise. * elf64-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs, elf_x86_64_readonly_dynrelocs): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms, elf_link_renumber_local_hash_table_dynsyms, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms, elf_adjust_dynstr_offsets, elf_collect_hash_codes, elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, elf_gc_sweep_symbol, elf_gc_propagate_vtable_entries_used, elf_gc_smash_unused_vtentry_relocs, bfd_elf_gc_mark_dynamic_ref_symbol, elf_gc_allocate_got_offsets): Likewise. * elfnn-ia64.c (elfNN_ia64_global_dyn_info_free, elfNN_ia64_global_dyn_sym_thunk): Likewise. * elfxx-mips.c (mips_elf_check_symbols, mips_elf_output_extsym, mips_elf_sort_hash_table_f, allocate_dynrelocs): Likewise. * elfxx-sparc.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_post_gc_symbol): Likewise. * elflink.c (elf_link_output_extsym): Make it a bfd_hash_traverse function. Update all callers. * aoutx.h (aout_link_write_other_symbol): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * ecoff.c (ecoff_link_write_external): Likewise. * xcofflink.c (xcoff_write_global_symbol): Likewise. * vms-alpha.c (alpha_vms_link_output_symbol): Likewise. Handle warning symbols. * ecoff.c (ecoff_link_hash_traverse): Delete. * coff-ppc.c (ppc_bfd_coff_final_link): Use bfd_hash_traverse for _bfd_coff_write_global_sym. * libcoff-in.h (_bfd_coff_write_global_sym): Update prototype. * libcoff.h: Regenerate.
2011-06-13 02:59:15 +02:00
bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (eoinfo.failed)
return FALSE;
/* If backend needs to output some local symbols not present in the hash
table, do it now. */
if (bed->elf_backend_output_arch_local_syms
&& (info->strip != strip_all || emit_relocs))
{
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
typedef int (*out_sym_func)
(void *, const char *, Elf_Internal_Sym *, asection *,
struct elf_link_hash_entry *);
if (! ((*bed->elf_backend_output_arch_local_syms)
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
(abfd, info, &flinfo,
(out_sym_func) elf_link_output_symstrtab)))
return FALSE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* That wrote out all the local symbols. Finish up the symbol table
with the global symbols. Even if we want to strip everything we
can, we still need to deal with those global symbols that got
converted to local in a version script. */
/* The sh_info field records the index of the first non local symbol. */
symtab_hdr->sh_info = bfd_get_symcount (abfd);
if (dynamic
&& elf_hash_table (info)->dynsym != NULL
&& (elf_hash_table (info)->dynsym->output_section
!= bfd_abs_section_ptr))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
Elf_Internal_Sym sym;
bfd_byte *dynsym = elf_hash_table (info)->dynsym->contents;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
long last_local = 0;
/* Write out the section symbols for the output sections. */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_pic (info)
|| elf_hash_table (info)->is_relocatable_executable)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
asection *s;
sym.st_size = 0;
sym.st_name = 0;
sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
sym.st_other = 0;
include/elf/ * internal.h (elf_internal_sym): Add st_target_internal. * arm.h (arm_st_branch_type): New enum. (ARM_SYM_BRANCH_TYPE): New macro. bfd/ * elf-bfd.h (elf_link_hash_entry): Add target_internal. * elf.c (swap_out_syms): Set st_target_internal for each Elf_Internal_Sym. * elfcode.h (elf_swap_symbol_in): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise. * elf32-sh-symbian.c (sh_symbian_relocate_section): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elflink.c (elf_link_output_extsym): Likewise. (bfd_elf_final_link): Likewise. (elf_link_add_object_symbols): Copy st_target_internal to the hash table if we see a definition. (_bfd_elf_copy_link_hash_symbol_type): Copy target_internal. * elf32-arm.c (elf32_arm_stub_hash_entry): Replace st_type with a branch_type field. (a8_erratum_fix, a8_erratum_reloc): Likewise. (arm_type_of_stub): Replace actual_st_type with an actual_branch_type parameter. (arm_build_one_stub): Use branch types rather than st_types to determine the type of branch. (cortex_a8_erratum_scan): Likewise. (elf32_arm_size_stubs): Likewise. (bfd_elf32_arm_process_before_allocation): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_finish_dynamic_sections): Likewise. (elf32_arm_final_link_relocate): Replace sym_flags parameter with a branch_type parameter. (elf32_arm_relocate_section): Update call accordingly. (elf32_arm_adjust_dynamic_symbol): Don't check STT_ARM_TFUNC. (elf32_arm_output_map_sym): Initialize st_target_internal. (elf32_arm_output_stub_sym): Likewise. (elf32_arm_symbol_processing): Delete. (elf32_arm_swap_symbol_in): Convert STT_ARM_TFUNCs into STT_FUNCs. Use st_target_internal to record the branch type. (elf32_arm_swap_symbol_out): Use st_target_internal to test for Thumb functions. (elf32_arm_is_function_type): Delete. (elf_backend_symbol_processing): Likewise. (elf_backend_is_function_type): Likewise. gas/ * config/tc-arm.c (arm_adjust_symtab): Set the branch type for Thumb symbols. ld/ * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Check eh->target_internal. opcodes/ * arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC. Use branch types instead. (print_insn): Likewise.
2011-03-14 16:55:04 +01:00
sym.st_target_internal = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (s = abfd->sections; s != NULL; s = s->next)
{
int indx;
bfd_byte *dest;
long dynindx;
dynindx = elf_section_data (s)->dynindx;
bfd/ * elflink.c (elf_bfd_final_link): Don't output STT_SECTION symbol into .dynsym if elf_section_data (sec)->dynindx <= 0. Adjust counting of last_local. (_bfd_elf_link_renumber_dynsyms): Don't assign dynindx to sections other than SHT_PROGBITS/SHT_NOBITS and neither for .got/.got.plt/.plt created by the linker nor !SHF_ALLOC. * elf32-i386.c (elf_i386_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. Set sh_entsize for .got section in addition to .got.plt. (elf_i386_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. (elf64_x86_64_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. Set sh_entsize for .got section in addition to .got.plt. * elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_RELRO. (bfd_section_from_phdr): Likewise. (map_sections_to_segments): Likewise. (assign_file_positions_for_segments): Likewise. (get_program_header_size): Likewise. * elflink.c (bfd_elf_size_dynamic_sections): Set elf_tdata (output_bfd)->relro from info->relro. * elf-bfd.h (struct elf_obj_tdata): Add relro field. include/ * bfdlink.h (struct bfd_link_info): Add relro, relro_start and relro_end fields. * elf/common.h (PT_GNU_EH_FRAME, PT_GNU_STACK): Add comments. (PT_GNU_RELRO): Define. binutils/ * readelf.c (get_segment_type): Handle PT_GNU_RELRO. ld/ * genscripts.sh: Generate -z combreloc -z now -z relro scripts for binaries, -shared and -pie. * emulparams/elf_i386.sh (SEPARATE_GOTPLT): Set. * emulparams/elf_x86_64.sh (SEPARATE_GOTPLT): Set. * emulparams/elf32ppc.sh (OTHER_READWRITE_SECTIONS): Rename to... (OTHER_RELRO_SECTIONS): ... this. * ldlex.l (DATA_SEGMENT_RELRO_END): Add. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z relro and -z norelro. (gld${EMULATION_NAME}_list_options): Add it to usage. (gld${EMULATION_NAME}_get_script): Return -z combreloc -z now -z relro scripts when appropriate. * scripttempl/elf.sc: Unset SEPARATE_GOTPLT if RELRO_NOW is set. Create separate .got.plt section if SEPARATE_GOTPLT. Move sections which are only written during relocation handling to the beginning of RW segment. If NO_SMALL_DATA, move .got before .data. Add DATA_SEGMENT_RELRO_END directive. Include OTHER_RELRO_SECTIONS. * ldgram.y (DATA_SEGMENT_RELRO_END): Add. * ldexp.c (exp_print_token): Handle DATA_SEGMENT_RELRO_END. (fold_unary): Likewise. (fold_binary): Handle -z relro. * ldexp.h (struct exp_data_seg): Add exp_dataseg_relro_seen and exp_dataseg_relro_adjust phases. Add relro_end field. * ldmain.c (main): Initialize link_info.relro to FALSE. * ldlang.c (lang_size_sections): Handle -z relro. ld/testsuite/ * ld-i386/tlspic.rd: Adjust for section reordering changes and removal of unneeded STT_SECTION symbols from .dynsym. * ld-i386/tlspic.dd: Likewise. * ld-i386/tlspic.sd: Likewise. * ld-i386/tlsbin.rd: Likewise. * ld-i386/tlsbinpic.s: Likewise. * ld-i386/tlsbin.dd: Likewise. * ld-i386/tlsbin.sd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlsnopic1.s: Likewise. * ld-i386/combreloc.d: Likewise. * ld-i386/tlsnopic.dd: Likewise. * ld-i386/tlsnopic.sd: Likewise. * ld-x86-64/tlspic.rd: Likewise. * ld-x86-64/tlspic.dd: Likewise. * ld-x86-64/tlsbin.dd: Likewise. * ld-x86-64/tlspic.sd: Likewise. * ld-x86-64/tlsbin.sd: Likewise. * ld-x86-64/tlspic.td: Likewise. * ld-x86-64/tlsbin.td: Likewise. * ld-x86-64/tlsbin.rd: Likewise. * ld-s390/tlspic1.s: Likewise. * ld-s390/tlsbinpic.s: Likewise. * ld-s390/tlspic.rd: Likewise. * ld-s390/tlsbin.rd: Likewise. * ld-s390/tlspic.dd: Likewise. * ld-s390/tlsbin.dd: Likewise. * ld-s390/tlsbin.sd: Likewise. * ld-s390/tlsbin.td: Likewise. * ld-s390/tlspic.sd: Likewise. * ld-s390/tlspic.td: Likewise. * ld-s390/tlspic1_64.s: Likewise. * ld-s390/tlsbinpic_64.s: Likewise. * ld-s390/tlspic_64.rd: Likewise. * ld-s390/tlsbin_64.rd: Likewise. * ld-s390/tlspic_64.dd: Likewise. * ld-s390/tlsbin_64.dd: Likewise. * ld-s390/tlspic_64.sd: Likewise. * ld-s390/tlspic_64.td: Likewise. * ld-s390/tlsbin_64.td: Likewise. * ld-s390/tlsbin_64.sd: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.t: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlstocso.r: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-ia64/tlspic.rd: Likewise. * ld-ia64/tlspic.dd: Likewise. * ld-ia64/tlspic.sd: Likewise. * ld-ia64/tlspic.td: Likewise. * ld-ia64/tlsbin.rd: Likewise. * ld-ia64/tlsbin.sd: Likewise. * ld-ia64/tlsbin.td: Likewise. * ld-elfvsb/elfvsb.exp: XFAIL non-PIC load offset tests on s390x. * ld-shared/shared.exp: Likewise.
2004-05-11 19:08:38 +02:00
if (dynindx <= 0)
continue;
indx = elf_section_data (s)->this_idx;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
BFD_ASSERT (indx > 0);
sym.st_shndx = indx;
if (! check_dynsym (abfd, &sym))
return FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
sym.st_value = s->vma;
dest = dynsym + dynindx * bed->s->sizeof_sym;
bfd/ * elflink.c (elf_bfd_final_link): Don't output STT_SECTION symbol into .dynsym if elf_section_data (sec)->dynindx <= 0. Adjust counting of last_local. (_bfd_elf_link_renumber_dynsyms): Don't assign dynindx to sections other than SHT_PROGBITS/SHT_NOBITS and neither for .got/.got.plt/.plt created by the linker nor !SHF_ALLOC. * elf32-i386.c (elf_i386_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. Set sh_entsize for .got section in addition to .got.plt. (elf_i386_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Point DT_PLTGOT to the start of the .got.plt section instead of the .got output section. (elf64_x86_64_relocate_section): Don't assume _GLOBAL_OFFSET_TABLE_ is at sgot->output_section->vma. Set sh_entsize for .got section in addition to .got.plt. * elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_RELRO. (bfd_section_from_phdr): Likewise. (map_sections_to_segments): Likewise. (assign_file_positions_for_segments): Likewise. (get_program_header_size): Likewise. * elflink.c (bfd_elf_size_dynamic_sections): Set elf_tdata (output_bfd)->relro from info->relro. * elf-bfd.h (struct elf_obj_tdata): Add relro field. include/ * bfdlink.h (struct bfd_link_info): Add relro, relro_start and relro_end fields. * elf/common.h (PT_GNU_EH_FRAME, PT_GNU_STACK): Add comments. (PT_GNU_RELRO): Define. binutils/ * readelf.c (get_segment_type): Handle PT_GNU_RELRO. ld/ * genscripts.sh: Generate -z combreloc -z now -z relro scripts for binaries, -shared and -pie. * emulparams/elf_i386.sh (SEPARATE_GOTPLT): Set. * emulparams/elf_x86_64.sh (SEPARATE_GOTPLT): Set. * emulparams/elf32ppc.sh (OTHER_READWRITE_SECTIONS): Rename to... (OTHER_RELRO_SECTIONS): ... this. * ldlex.l (DATA_SEGMENT_RELRO_END): Add. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle -z relro and -z norelro. (gld${EMULATION_NAME}_list_options): Add it to usage. (gld${EMULATION_NAME}_get_script): Return -z combreloc -z now -z relro scripts when appropriate. * scripttempl/elf.sc: Unset SEPARATE_GOTPLT if RELRO_NOW is set. Create separate .got.plt section if SEPARATE_GOTPLT. Move sections which are only written during relocation handling to the beginning of RW segment. If NO_SMALL_DATA, move .got before .data. Add DATA_SEGMENT_RELRO_END directive. Include OTHER_RELRO_SECTIONS. * ldgram.y (DATA_SEGMENT_RELRO_END): Add. * ldexp.c (exp_print_token): Handle DATA_SEGMENT_RELRO_END. (fold_unary): Likewise. (fold_binary): Handle -z relro. * ldexp.h (struct exp_data_seg): Add exp_dataseg_relro_seen and exp_dataseg_relro_adjust phases. Add relro_end field. * ldmain.c (main): Initialize link_info.relro to FALSE. * ldlang.c (lang_size_sections): Handle -z relro. ld/testsuite/ * ld-i386/tlspic.rd: Adjust for section reordering changes and removal of unneeded STT_SECTION symbols from .dynsym. * ld-i386/tlspic.dd: Likewise. * ld-i386/tlspic.sd: Likewise. * ld-i386/tlsbin.rd: Likewise. * ld-i386/tlsbinpic.s: Likewise. * ld-i386/tlsbin.dd: Likewise. * ld-i386/tlsbin.sd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlsnopic1.s: Likewise. * ld-i386/combreloc.d: Likewise. * ld-i386/tlsnopic.dd: Likewise. * ld-i386/tlsnopic.sd: Likewise. * ld-x86-64/tlspic.rd: Likewise. * ld-x86-64/tlspic.dd: Likewise. * ld-x86-64/tlsbin.dd: Likewise. * ld-x86-64/tlspic.sd: Likewise. * ld-x86-64/tlsbin.sd: Likewise. * ld-x86-64/tlspic.td: Likewise. * ld-x86-64/tlsbin.td: Likewise. * ld-x86-64/tlsbin.rd: Likewise. * ld-s390/tlspic1.s: Likewise. * ld-s390/tlsbinpic.s: Likewise. * ld-s390/tlspic.rd: Likewise. * ld-s390/tlsbin.rd: Likewise. * ld-s390/tlspic.dd: Likewise. * ld-s390/tlsbin.dd: Likewise. * ld-s390/tlsbin.sd: Likewise. * ld-s390/tlsbin.td: Likewise. * ld-s390/tlspic.sd: Likewise. * ld-s390/tlspic.td: Likewise. * ld-s390/tlspic1_64.s: Likewise. * ld-s390/tlsbinpic_64.s: Likewise. * ld-s390/tlspic_64.rd: Likewise. * ld-s390/tlsbin_64.rd: Likewise. * ld-s390/tlspic_64.dd: Likewise. * ld-s390/tlsbin_64.dd: Likewise. * ld-s390/tlspic_64.sd: Likewise. * ld-s390/tlspic_64.td: Likewise. * ld-s390/tlsbin_64.td: Likewise. * ld-s390/tlsbin_64.sd: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.t: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlstocso.r: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-ia64/tlspic.rd: Likewise. * ld-ia64/tlspic.dd: Likewise. * ld-ia64/tlspic.sd: Likewise. * ld-ia64/tlspic.td: Likewise. * ld-ia64/tlsbin.rd: Likewise. * ld-ia64/tlsbin.sd: Likewise. * ld-ia64/tlsbin.td: Likewise. * ld-elfvsb/elfvsb.exp: XFAIL non-PIC load offset tests on s390x. * ld-shared/shared.exp: Likewise.
2004-05-11 19:08:38 +02:00
if (last_local < dynindx)
last_local = dynindx;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bed->s->swap_symbol_out (abfd, &sym, dest, 0);
}
}
/* Write out the local dynsyms. */
if (elf_hash_table (info)->dynlocal)
{
struct elf_link_local_dynamic_entry *e;
for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
{
asection *s;
bfd_byte *dest;
bfd/ 2009-09-24 H.J. Lu <hongjiu.lu@intel.com> PR ld/10630 * elflink.c (elf_link_output_extsym): Turn off visibility on local symbol. (bfd_elf_final_link): Turn off visibility on dynamic local symbol. ld/testsuite/ 2009-09-24 H.J. Lu <hongjiu.lu@intel.com> PR ld/10630 * ld-alpha/tlsbin.rd: Remove HIDDEN/.hidden on local symbols. * ld-alpha/tlsbinr.rd: Likewise. * ld-alpha/tlspic.rd: Likewise. * ld-cris/libdso-2.d: Likewise. * ld-cris/locref1.d: Likewise. * ld-cris/locref2.d: Likewise. * ld-cris/tls-e-20a.d: Likewise. * ld-cris/tls-e-20.d: Likewise. * ld-cris/tls-e-80.d: Likewise. * ld-cris/tls-gc-68.d: Likewise. * ld-cris/tls-gc-69.d: Likewise. * ld-cris/tls-gc-70.d: Likewise. * ld-cris/tls-gc-75.d: Likewise. * ld-cris/tls-gc-76.d: Likewise. * ld-cris/tls-gc-79.d: Likewise. * ld-cris/tls-gd-1h.d: Likewise. * ld-cris/tls-gd-2h.d: Likewise. * ld-cris/tls-ld-4.d: Likewise. * ld-cris/tls-ld-5.d: Likewise. * ld-cris/tls-ld-6.d: Likewise. * ld-cris/tls-ld-7.d: Likewise. * ld-cris/tls-ldgd-14.d: Likewise. * ld-cris/tls-ldgd-15.d: Likewise. * ld-cris/tls-local-63.d: Likewise. * ld-cris/tls-local-64.d: Likewise. * ld-elf/pr9676.rd: Likewise. * ld-elf/pr9679.rd: Likewise. * ld-elfvsb/hidden2.d: Likewise. * ld-i386/tlsbindesc.rd: Likewise. * ld-i386/tlsbin.rd: Likewise. * ld-i386/tlsdesc.rd: Likewise. * ld-i386/tlsgdesc.rd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlspic.rd: Likewise. * ld-ia64/tlsbin.rd: Likewise. * ld-ia64/tlspic.rd: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlsso32.r: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstocso.r: Likewise. * ld-s390/tlsbin_64.rd: Likewise. * ld-s390/tlsbin.rd: Likewise. * ld-s390/tlspic_64.rd: Likewise. * ld-s390/tlspic.rd: Likewise. * ld-sparc/gotop32.rd: Likewise. * ld-sparc/gotop64.rd: Likewise. * ld-sparc/tlssunbin32.rd: Likewise. * ld-sparc/tlssunbin64.rd: Likewise. * ld-sparc/tlssunnopic32.rd: Likewise. * ld-sparc/tlssunnopic64.rd: Likewise. * ld-sparc/tlssunpic32.rd: Likewise. * ld-sparc/tlssunpic64.rd: Likewise. * ld-x86-64/tlsbindesc.rd: Likewise. * ld-x86-64/tlsbin.rd: Likewise. * ld-x86-64/tlsdesc.rd: Likewise. * ld-x86-64/tlsgdesc.rd: Likewise. * ld-x86-64/tlspic.rd: Likewise. * ld-xtensa/tlsbin.rd: Likewise. * ld-xtensa/tlspic.rd: Likewise. * ld-elf/local1.d: New. * ld-elf/local1.map: Likewise. * ld-elf/local1.s: Likewise. * ld-ia64/local1.d: Likewise. * ld-ia64/local1.map: Likewise. * ld-ia64/local1.s: Likewise.
2009-09-24 17:56:52 +02:00
/* Copy the internal symbol and turn off visibility.
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
Note that we saved a word of storage and overwrote
the original st_name with the dynstr_index. */
sym = e->isym;
bfd/ 2009-09-24 H.J. Lu <hongjiu.lu@intel.com> PR ld/10630 * elflink.c (elf_link_output_extsym): Turn off visibility on local symbol. (bfd_elf_final_link): Turn off visibility on dynamic local symbol. ld/testsuite/ 2009-09-24 H.J. Lu <hongjiu.lu@intel.com> PR ld/10630 * ld-alpha/tlsbin.rd: Remove HIDDEN/.hidden on local symbols. * ld-alpha/tlsbinr.rd: Likewise. * ld-alpha/tlspic.rd: Likewise. * ld-cris/libdso-2.d: Likewise. * ld-cris/locref1.d: Likewise. * ld-cris/locref2.d: Likewise. * ld-cris/tls-e-20a.d: Likewise. * ld-cris/tls-e-20.d: Likewise. * ld-cris/tls-e-80.d: Likewise. * ld-cris/tls-gc-68.d: Likewise. * ld-cris/tls-gc-69.d: Likewise. * ld-cris/tls-gc-70.d: Likewise. * ld-cris/tls-gc-75.d: Likewise. * ld-cris/tls-gc-76.d: Likewise. * ld-cris/tls-gc-79.d: Likewise. * ld-cris/tls-gd-1h.d: Likewise. * ld-cris/tls-gd-2h.d: Likewise. * ld-cris/tls-ld-4.d: Likewise. * ld-cris/tls-ld-5.d: Likewise. * ld-cris/tls-ld-6.d: Likewise. * ld-cris/tls-ld-7.d: Likewise. * ld-cris/tls-ldgd-14.d: Likewise. * ld-cris/tls-ldgd-15.d: Likewise. * ld-cris/tls-local-63.d: Likewise. * ld-cris/tls-local-64.d: Likewise. * ld-elf/pr9676.rd: Likewise. * ld-elf/pr9679.rd: Likewise. * ld-elfvsb/hidden2.d: Likewise. * ld-i386/tlsbindesc.rd: Likewise. * ld-i386/tlsbin.rd: Likewise. * ld-i386/tlsdesc.rd: Likewise. * ld-i386/tlsgdesc.rd: Likewise. * ld-i386/tlsnopic.rd: Likewise. * ld-i386/tlspic.rd: Likewise. * ld-ia64/tlsbin.rd: Likewise. * ld-ia64/tlspic.rd: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlsso32.r: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstocso.r: Likewise. * ld-s390/tlsbin_64.rd: Likewise. * ld-s390/tlsbin.rd: Likewise. * ld-s390/tlspic_64.rd: Likewise. * ld-s390/tlspic.rd: Likewise. * ld-sparc/gotop32.rd: Likewise. * ld-sparc/gotop64.rd: Likewise. * ld-sparc/tlssunbin32.rd: Likewise. * ld-sparc/tlssunbin64.rd: Likewise. * ld-sparc/tlssunnopic32.rd: Likewise. * ld-sparc/tlssunnopic64.rd: Likewise. * ld-sparc/tlssunpic32.rd: Likewise. * ld-sparc/tlssunpic64.rd: Likewise. * ld-x86-64/tlsbindesc.rd: Likewise. * ld-x86-64/tlsbin.rd: Likewise. * ld-x86-64/tlsdesc.rd: Likewise. * ld-x86-64/tlsgdesc.rd: Likewise. * ld-x86-64/tlspic.rd: Likewise. * ld-xtensa/tlsbin.rd: Likewise. * ld-xtensa/tlspic.rd: Likewise. * ld-elf/local1.d: New. * ld-elf/local1.map: Likewise. * ld-elf/local1.s: Likewise. * ld-ia64/local1.d: Likewise. * ld-ia64/local1.map: Likewise. * ld-ia64/local1.s: Likewise.
2009-09-24 17:56:52 +02:00
sym.st_other &= ~ELF_ST_VISIBILITY (-1);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
s = bfd_section_from_elf_index (e->input_bfd,
e->isym.st_shndx);
if (s != NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
sym.st_shndx =
elf_section_data (s->output_section)->this_idx;
if (! check_dynsym (abfd, &sym))
return FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
sym.st_value = (s->output_section->vma
+ s->output_offset
+ e->isym.st_value);
}
if (last_local < e->dynindx)
last_local = e->dynindx;
dest = dynsym + e->dynindx * bed->s->sizeof_sym;
bed->s->swap_symbol_out (abfd, &sym, dest, 0);
}
}
elf_section_data (elf_hash_table (info)->dynsym->output_section)->this_hdr.sh_info =
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
last_local + 1;
}
/* We get the global symbols from the hash table. */
eoinfo.failed = FALSE;
eoinfo.localsyms = FALSE;
eoinfo.flinfo = &flinfo;
* linker.c (bfd_link_hash_traverse): Follow warning symbol link. (_bfd_generic_link_write_global_symbol, fix_syms): Don't handle warning symbols here. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.c (allocate_dynrelocs_for_symbol, elf32_arm_readonly_dynrelocs): Likewise. * elf32-bfin.c (bfin_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): Likewise. * elf32-hppa.c (allocate_plt_static, allocate_dynrelocs, clobber_millicode_symbols, readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-i386.c (elf_i386_allocate_dynrelocs, elf_i386_readonly_dynrelocs): Likewise. * elf32-lm32.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m32c.c (m32c_relax_plt_check, m32c_relax_plt_realloc): Likewise. * elf32-m32r.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-microblaze.c (allocate_dynrelocs): Likewise. * elf32-ppc.c (allocate_dynrelocs, maybe_set_textrel): Likewise. * elf32-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-score.c (score_elf_sort_hash_table_f): Likewise. * elf32-score7.c (score_elf_sort_hash_table_f): Likewise. * elf32-sh.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf32-tic6x.c (elf32_tic6x_allocate_dynrelocs, elf32_tic6x_readonly_dynrelocs): Likewise. * elf32-vax.c (elf_vax_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check, xstormy16_relax_plt_realloc): Likewise. * elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_1): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions, allocate_global_data_opd, elf64_hppa_mark_milli_and_exported_functions, elf_hppa_unmark_useless_dynamic_symbols, elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref, func_desc_adjust, adjust_opd_syms, adjust_toc_syms, allocate_dynrelocs, readonly_dynrelocs, merge_global_got, reallocate_got, undo_symbol_twiddle): Likewise. * elf64-s390.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs, elf_x86_64_readonly_dynrelocs): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms, elf_link_renumber_local_hash_table_dynsyms, _bfd_elf_export_symbol, _bfd_elf_link_find_version_dependencies, _bfd_elf_link_assign_sym_version, _bfd_elf_adjust_dynamic_symbol, _bfd_elf_link_sec_merge_syms, elf_adjust_dynstr_offsets, elf_collect_hash_codes, elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, elf_gc_sweep_symbol, elf_gc_propagate_vtable_entries_used, elf_gc_smash_unused_vtentry_relocs, bfd_elf_gc_mark_dynamic_ref_symbol, elf_gc_allocate_got_offsets): Likewise. * elfnn-ia64.c (elfNN_ia64_global_dyn_info_free, elfNN_ia64_global_dyn_sym_thunk): Likewise. * elfxx-mips.c (mips_elf_check_symbols, mips_elf_output_extsym, mips_elf_sort_hash_table_f, allocate_dynrelocs): Likewise. * elfxx-sparc.c (allocate_dynrelocs, readonly_dynrelocs): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_post_gc_symbol): Likewise. * elflink.c (elf_link_output_extsym): Make it a bfd_hash_traverse function. Update all callers. * aoutx.h (aout_link_write_other_symbol): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * ecoff.c (ecoff_link_write_external): Likewise. * xcofflink.c (xcoff_write_global_symbol): Likewise. * vms-alpha.c (alpha_vms_link_output_symbol): Likewise. Handle warning symbols. * ecoff.c (ecoff_link_hash_traverse): Delete. * coff-ppc.c (ppc_bfd_coff_final_link): Use bfd_hash_traverse for _bfd_coff_write_global_sym. * libcoff-in.h (_bfd_coff_write_global_sym): Update prototype. * libcoff.h: Regenerate.
2011-06-13 02:59:15 +02:00
bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (eoinfo.failed)
return FALSE;
/* If backend needs to output some symbols not present in the hash
table, do it now. */
if (bed->elf_backend_output_arch_syms
&& (info->strip != strip_all || emit_relocs))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
* elf-bfd.h (struct elf_backend_data <elf_backend_link_output_symbol_hook>): Return an int. * elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop symbols on deleted .opd entries. * elflink.c (elf_link_output_sym): Return without outputting sym if output_symbol_hook returns 2. (elf_link_output_extsym): Don't assign h->indx when symbol discarded. Abort if we must not discard sym. (elf_link_input_bfd): Similarly, don't set finfo->indices for local syms. (bfd_elf_final_link): Adjust elf_link_output_sym calls. * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for elf_backend_link_output_symbol_hook return type change. * elf32-arm.c (output_arch_syminfo): Likewise. (elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise. (elf32_arm_output_arch_local_syms): Likewise. * elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise. * elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise. (bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise. * elf32-spu.c (spu_elf_output_symbol_hook): Likewise. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 16:15:50 +02:00
typedef int (*out_sym_func)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
(void *, const char *, Elf_Internal_Sym *, asection *,
struct elf_link_hash_entry *);
if (! ((*bed->elf_backend_output_arch_syms)
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
(abfd, info, &flinfo,
(out_sym_func) elf_link_output_symstrtab)))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
}
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
/* Finalize the .strtab section. */
_bfd_elf_strtab_finalize (flinfo.symstrtab);
/* Swap out the .strtab section. */
if (!elf_link_swap_symbols_out (&flinfo))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
/* Now we know the size of the symtab section. */
if (bfd_get_symcount (abfd) > 0)
{
/* Finish up and write out the symbol string table (.strtab)
section. */
Elf_Internal_Shdr *symstrtab_hdr;
file_ptr off = symtab_hdr->sh_offset + symtab_hdr->sh_size;
2015-09-23 18:23:58 +02:00
symtab_shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr;
if (symtab_shndx_hdr != NULL && symtab_shndx_hdr->sh_name != 0)
{
symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx);
amt = bfd_get_symcount (abfd) * sizeof (Elf_External_Sym_Shndx);
symtab_shndx_hdr->sh_size = amt;
off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr,
off, TRUE);
if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
|| (bfd_bwrite (flinfo.symshndxbuf, amt, abfd) != amt))
return FALSE;
}
symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
/* sh_name was set in prep_headers. */
symstrtab_hdr->sh_type = SHT_STRTAB;
symstrtab_hdr->sh_flags = 0;
symstrtab_hdr->sh_addr = 0;
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
symstrtab_hdr->sh_size = _bfd_elf_strtab_size (flinfo.symstrtab);
symstrtab_hdr->sh_entsize = 0;
symstrtab_hdr->sh_link = 0;
symstrtab_hdr->sh_info = 0;
/* sh_offset is set just below. */
symstrtab_hdr->sh_addralign = 1;
off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr,
off, TRUE);
elf_next_file_pos (abfd) = off;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
Use strtab with GC and suffix merging for .strtab This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-25 17:16:00 +02:00
|| ! _bfd_elf_strtab_emit (abfd, flinfo.symstrtab))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
}
/* Adjust the relocs to have the correct symbol indices. */
for (o = abfd->sections; o != NULL; o = o->next)
{
bfd/ * elf-bfd.h (struct bfd_elf_section_reloc_data): New structure. (struct bfd_elf_section_data): New members REL and RELA; delete members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX, REL_IDX2, REL_HASHES. (_bfd_elf_init_reloc_shdr): Adjust declaration. (_bfd_elf_single_rel_hdr): Declare. (RELOC_AGAINST_DISCARDED_SECTION): Use it. * elf.c (bfd_section_from_shdr): Adjusted to match changes in data structures. (_bfd_elf_init_reloc_shdr): New arg RELDATA. Remove arg REL_HDR. All callers changed. Allocate memory for the Elf_Internal_Shdr structure. (_bfd_elf_single_rel_hdr): New function. (struct fake_section_arg): New structure. (elf_fake_section): Expect to see a pointer to it in the third argument. If doing a relocatable link, allocate both REL and RELA sections as needed. (assign_section_numbers): Adjusted to match changes in data structures. (_bfd_elf_compute_section_file_positions): Call elf_fake_sections with a struct fake_section_args argument. * elfcode.h (elf_write_relocs): Adjusted to match changes in data structures. (elf_slurp_reloc_table): Likewise. * elflink.c (_bfd_elf_link_read_relocs): Likewise. (_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with RELDATA. Remove argument O. All callers changed. Remove code to discover the right rel_hdr and count. (_bfd_elf_link_output_relocs): Adjusted to match changes in data structures. (elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH; replace with RELDATA. All callers changed. (elf_link_input_bfd): Correctly generate rel_hash data when both REL and RELA sections are present. (elf_reloc_link_order): Adjusted to match changes in data structures. (bfd_elf_final_link): Simplify code to count relocs. Free the hashes array for both REL and RELA. (get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr * elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections): Delete. * elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections): Delete. (elf32_tic6x_rel_relocation_p): Adjusted to match changes in data structures. * elf32-microblaze.c (microblaze_elf_check_relocs): Use _bfd_elf_single_rel_hdr. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-hppa.c (get_reloc_section): Likewise. * elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match changes in data structures. (mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr. * elf64-ppc.c (ppc64_elf_edit_opd): Likewise. (ppc64_elf_edit_toc): Likewise. (get_relocs): Adjusted to match changes in data structures. Allocate an Elf_Internal_Shdr structure if necessary. (ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr. * elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match changes in data structures. * elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr. * elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro. (mips_elf_rel_relocation_p): Adjusted to match changes in data structures. (_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather than MIPS_RELOC_RELOCA_P. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use _bfd_elf_single_rel_hdr. (_bfd_sparc_elf_relocate_section): Likewise. ld/ * emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use _bfd_elf_single_rel_hdr.
2010-10-04 16:13:10 +02:00
struct bfd_elf_section_data *esdo = elf_section_data (o);
bfd_boolean sort;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if ((o->flags & SEC_RELOC) == 0)
continue;
sort = bed->sort_relocs_p == NULL || (*bed->sort_relocs_p) (o);
if (esdo->rel.hdr != NULL
&& !elf_link_adjust_relocs (abfd, &esdo->rel, sort))
return FALSE;
if (esdo->rela.hdr != NULL
&& !elf_link_adjust_relocs (abfd, &esdo->rela, sort))
return FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Set the reloc_count field to 0 to prevent write_relocs from
trying to swap the relocs out itself. */
o->reloc_count = 0;
}
if (dynamic && info->combreloc && dynobj != NULL)
relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
/* If we are linking against a dynamic object, or generating a
shared library, finish up the dynamic linking information. */
if (dynamic)
{
bfd_byte *dyncon, *dynconend;
/* Fix up .dynamic entries. */
2012-06-29 16:46:03 +02:00
o = bfd_get_linker_section (dynobj, ".dynamic");
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
BFD_ASSERT (o != NULL);
dyncon = o->contents;
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
dynconend = o->contents + o->size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
const char *name;
unsigned int type;
bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
switch (dyn.d_tag)
{
default:
continue;
case DT_NULL:
if (relativecount > 0 && dyncon + bed->s->sizeof_dyn < dynconend)
{
switch (elf_section_data (reldyn)->this_hdr.sh_type)
{
case SHT_REL: dyn.d_tag = DT_RELCOUNT; break;
case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break;
default: continue;
}
dyn.d_un.d_val = relativecount;
relativecount = 0;
break;
}
continue;
case DT_INIT:
name = info->init_function;
goto get_sym;
case DT_FINI:
name = info->fini_function;
get_sym:
{
struct elf_link_hash_entry *h;
h = elf_link_hash_lookup (elf_hash_table (info), name,
FALSE, FALSE, TRUE);
if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
dyn.d_un.d_ptr = h->root.u.def.value;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
o = h->root.u.def.section;
if (o->output_section != NULL)
dyn.d_un.d_ptr += (o->output_section->vma
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
+ o->output_offset);
else
{
/* The symbol is imported from another shared
library and does not apply to this one. */
dyn.d_un.d_ptr = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
break;
}
}
continue;
case DT_PREINIT_ARRAYSZ:
name = ".preinit_array";
goto get_size;
case DT_INIT_ARRAYSZ:
name = ".init_array";
goto get_size;
case DT_FINI_ARRAYSZ:
name = ".fini_array";
get_size:
o = bfd_get_section_by_name (abfd, name);
if (o == NULL)
{
(*_bfd_error_handler)
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
(_("%B: could not find output section %s"), abfd, name);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
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 (o->size == 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
(*_bfd_error_handler)
(_("warning: %s section has zero size"), name);
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
dyn.d_un.d_val = o->size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
break;
case DT_PREINIT_ARRAY:
name = ".preinit_array";
goto get_vma;
case DT_INIT_ARRAY:
name = ".init_array";
goto get_vma;
case DT_FINI_ARRAY:
name = ".fini_array";
goto get_vma;
case DT_HASH:
name = ".hash";
goto get_vma;
include/ * bfdlink.h (struct bfd_link_info): Add emit_hash and emit_gnu_hash bitfields. include/elf/ * common.h (SHT_GNU_HASH, DT_GNU_HASH): Define. ld/ * scripttempl/elf.sc: Add .gnu.hash section. * emultempl/elf32.em (OPTION_HASH_STYLE): Define. (gld${EMULATION_NAME}_add_options): Register --hash-style option. (gld${EMULATION_NAME}_handle_option): Handle it. (gld${EMULATION_NAME}_list_options): Document it. * ldmain.c (main): Initialize emit_hash and emit_gnu_hash. * ld.texinfo: Document --hash-style option. bfd/ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH. (bfd_section_from_shdr, elf_fake_sections, assign_section_numbers): Handle SHT_GNU_HASH. (special_sections_g): Include .gnu.hash section. (bfd_elf_gnu_hash): New function. * elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes. (struct elf_backend_data): Add elf_hash_symbol method. * elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash only if info->emit_hash, create .gnu.hash section if info->emit_gnu_hash. (struct collect_gnu_hash_codes): New type. (elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms, _bfd_elf_hash_symbol): New functions. (compute_bucket_count): Don't compute HASHCODES array, instead add that and NSYMS as arguments. Use bed->s->sizeof_hash_entry instead of bed->s->arch_size / 8. Fix .hash size estimation. When not optimizing, use the number of hashed symbols rather than dynsymcount. (bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash, and ADD DT_GNU_HASH if info->emit_gnu_hash. (bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash, adjust compute_bucket_count caller. Create and populate .gnu.hash section if info->emit_gnu_hash. (elf_link_output_extsym): Only populate .hash section if finfo->hash_sec != NULL. (bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH. * elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined. (elfNN_bed): Add elf_backend_hash_symbol. * elf64-x86-64.c (elf64_x86_64_hash_symbol): New function. (elf_backend_hash_symbol): Define. * elf32-i386.c (elf_i386_hash_symbol): New function. (elf_backend_hash_symbol): Define. binutils/ * readelf.c (get_dynamic_type): Handle DT_GNU_HASH. (get_section_type_name): Handle SHT_GNU_HASH. (dynamic_info_DT_GNU_HASH): New variable. (process_dynamic_section): Handle DT_GNU_HASH. (process_symbol_table): Print also DT_GNU_HASH histogram. ld/testsuite/ * ld-powerpc/tlsso32.r: Adjust. * ld-powerpc/tlsso32.d: Adjust. * ld-powerpc/tlsso32.g: Adjust. * ld-powerpc/tlsso.r: Adjust. * ld-powerpc/tlsso.g: Adjust. * ld-powerpc/tlstocso.g: Adjust.
2006-07-10 23:40:25 +02:00
case DT_GNU_HASH:
name = ".gnu.hash";
goto get_vma;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
case DT_STRTAB:
name = ".dynstr";
goto get_vma;
case DT_SYMTAB:
name = ".dynsym";
goto get_vma;
case DT_VERDEF:
name = ".gnu.version_d";
goto get_vma;
case DT_VERNEED:
name = ".gnu.version_r";
goto get_vma;
case DT_VERSYM:
name = ".gnu.version";
get_vma:
o = bfd_get_section_by_name (abfd, name);
if (o == NULL)
{
(*_bfd_error_handler)
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
(_("%B: could not find output section %s"), abfd, name);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
if (elf_section_data (o->output_section)->this_hdr.sh_type == SHT_NOTE)
{
(*_bfd_error_handler)
(_("warning: section '%s' is being made into a note"), name);
bfd_set_error (bfd_error_nonrepresentable_section);
goto error_return;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
dyn.d_un.d_ptr = o->vma;
break;
case DT_REL:
case DT_RELA:
case DT_RELSZ:
case DT_RELASZ:
if (dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ)
type = SHT_REL;
else
type = SHT_RELA;
dyn.d_un.d_val = 0;
dyn.d_un.d_ptr = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (i = 1; i < elf_numsections (abfd); i++)
{
Elf_Internal_Shdr *hdr;
hdr = elf_elfsections (abfd)[i];
if (hdr->sh_type == type
&& (hdr->sh_flags & SHF_ALLOC) != 0)
{
if (dyn.d_tag == DT_RELSZ || dyn.d_tag == DT_RELASZ)
dyn.d_un.d_val += hdr->sh_size;
else
{
if (dyn.d_un.d_ptr == 0
|| hdr->sh_addr < dyn.d_un.d_ptr)
dyn.d_un.d_ptr = hdr->sh_addr;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
}
break;
}
bed->s->swap_dyn_out (dynobj, &dyn, dyncon);
}
}
/* If we have created any dynamic sections, then output them. */
if (dynobj != NULL)
{
if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info))
goto error_return;
/* Check for DT_TEXTREL (late, in case the backend removes it). */
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (((info->warn_shared_textrel && bfd_link_pic (info))
|| info->error_textrel)
2012-06-29 16:46:03 +02:00
&& (o = bfd_get_linker_section (dynobj, ".dynamic")) != NULL)
{
bfd_byte *dyncon, *dynconend;
dyncon = o->contents;
dynconend = o->contents + o->size;
for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
{
Elf_Internal_Dyn dyn;
bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
if (dyn.d_tag == DT_TEXTREL)
{
if (info->error_textrel)
info->callbacks->einfo
(_("%P%X: read-only segment has dynamic relocations.\n"));
else
info->callbacks->einfo
(_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
break;
}
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (o = dynobj->sections; o != NULL; o = o->next)
{
if ((o->flags & SEC_HAS_CONTENTS) == 0
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
|| o->size == 0
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
|| o->output_section == bfd_abs_section_ptr)
continue;
if ((o->flags & SEC_LINKER_CREATED) == 0)
{
/* At this point, we are only interested in sections
created by _bfd_elf_link_create_dynamic_sections. */
continue;
}
if (elf_hash_table (info)->stab_info.stabstr == o)
continue;
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 (elf_hash_table (info)->eh_info.hdr_sec == o)
continue;
2012-06-29 16:46:03 +02:00
if (strcmp (o->name, ".dynstr") != 0)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
/* FIXME: octets_per_byte. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! bfd_set_section_contents (abfd, o->output_section,
o->contents,
(file_ptr) o->output_offset,
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
o->size))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
goto error_return;
}
else
{
/* The contents of the .dynstr section are actually in a
stringtab. */
file_ptr off;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
off = elf_section_data (o->output_section)->this_hdr.sh_offset;
if (bfd_seek (abfd, off, SEEK_SET) != 0
|| ! _bfd_elf_strtab_emit (abfd,
elf_hash_table (info)->dynstr))
goto error_return;
}
}
}
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
if (bfd_link_relocatable (info))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd_boolean failed = FALSE;
bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
if (failed)
goto error_return;
}
/* If we have optimized stabs strings, output them. */
if (elf_hash_table (info)->stab_info.stabstr != NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info))
goto error_return;
}
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
if (! _bfd_elf_write_section_eh_frame_hdr (abfd, info))
goto error_return;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
elf_final_link_free (abfd, &flinfo);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
elf_linker (abfd) = TRUE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd: * elf-attrs.c: New. * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. (BFD32_BACKENDS_CFILES): Add elf-attrs.c. (elf-attrs.lo): Generate dependencies. * Makefile.in: Regenerate. * configure.in (elf): Add elf-attrs.lo. * configure: Regenerate. * elf-bfd.h (struct elf_backend_data): Add entries for object attributes. (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): New. (struct elf_obj_tdata): Add entries for object attributes. (elf_known_obj_attributes, elf_other_obj_attributes, elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): New. (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. (bfd_section_from_shdr): Handle attributes sections. * elflink.c (bfd_elf_final_link): Handle attributes sections. * elfxx-target.h (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. (elfNN_bed): Update. * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, aeabi_attribute_list): Remove. (struct elf32_arm_obj_tdata): Remove object attributes fields. (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): Update for new object attributes interfaces. (uleb128_size, is_default_attr, eabi_attr_size, elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, elf32_arm_add_eabi_attr_int, attr_strdup, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved to generic code in elf-attrs.c. (elf32_arm_obj_attrs_arg_type): New. (elf32_arm_fake_sections): Do not handle .ARM.attributes. (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. (bfd_elf32_bfd_final_link): Remove. (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object attributes. * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_copy_private_data): Likewise. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils: * readelf.c (display_gnu_attribute): New. (process_arm_specific): Rearrange as process_attributes. (process_arm_specific): Replace by wrapper of process_attributes. gas: * as.c (create_obj_attrs_section): New. (main): Call create_obj_attrs_section for ELF. * read.c (s_gnu_attribute, skip_whitespace, skip_past_char, skip_past_comma, s_vendor_attribute): New. (potable): Add gnu_attribute for ELF. * read.h (s_vendor_attribute): Declare. * config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper round s_vendor_attribute. (aeabi_set_public_attributes): Update for new attributes interfaces. (arm_md_end): Remove attributes contents setting now done generically. include/elf: * arm.h (elf32_arm_add_eabi_attr_int, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents, elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): Remove. * common.h (SHT_GNU_ATTRIBUTES): Define. ld: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes. (ATTRS_SECTIONS): Define. * scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc, scripttempl/elf_chaos.sc, scripttempl/elfi370.sc, scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
2007-06-29 18:29:17 +02:00
if (attr_section)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
bfd_byte *contents = (bfd_byte *) bfd_malloc (attr_size);
bfd: * elf-attrs.c: New. * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. (BFD32_BACKENDS_CFILES): Add elf-attrs.c. (elf-attrs.lo): Generate dependencies. * Makefile.in: Regenerate. * configure.in (elf): Add elf-attrs.lo. * configure: Regenerate. * elf-bfd.h (struct elf_backend_data): Add entries for object attributes. (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): New. (struct elf_obj_tdata): Add entries for object attributes. (elf_known_obj_attributes, elf_other_obj_attributes, elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): New. (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. (bfd_section_from_shdr): Handle attributes sections. * elflink.c (bfd_elf_final_link): Handle attributes sections. * elfxx-target.h (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. (elfNN_bed): Update. * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, aeabi_attribute_list): Remove. (struct elf32_arm_obj_tdata): Remove object attributes fields. (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): Update for new object attributes interfaces. (uleb128_size, is_default_attr, eabi_attr_size, elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, elf32_arm_add_eabi_attr_int, attr_strdup, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved to generic code in elf-attrs.c. (elf32_arm_obj_attrs_arg_type): New. (elf32_arm_fake_sections): Do not handle .ARM.attributes. (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. (bfd_elf32_bfd_final_link): Remove. (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object attributes. * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_copy_private_data): Likewise. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils: * readelf.c (display_gnu_attribute): New. (process_arm_specific): Rearrange as process_attributes. (process_arm_specific): Replace by wrapper of process_attributes. gas: * as.c (create_obj_attrs_section): New. (main): Call create_obj_attrs_section for ELF. * read.c (s_gnu_attribute, skip_whitespace, skip_past_char, skip_past_comma, s_vendor_attribute): New. (potable): Add gnu_attribute for ELF. * read.h (s_vendor_attribute): Declare. * config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper round s_vendor_attribute. (aeabi_set_public_attributes): Update for new attributes interfaces. (arm_md_end): Remove attributes contents setting now done generically. include/elf: * arm.h (elf32_arm_add_eabi_attr_int, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents, elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): Remove. * common.h (SHT_GNU_ATTRIBUTES): Define. ld: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes. (ATTRS_SECTIONS): Define. * scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc, scripttempl/elf_chaos.sc, scripttempl/elfi370.sc, scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
2007-06-29 18:29:17 +02:00
if (contents == NULL)
return FALSE; /* Bail out and fail. */
bfd: * elf-attrs.c: New. * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. (BFD32_BACKENDS_CFILES): Add elf-attrs.c. (elf-attrs.lo): Generate dependencies. * Makefile.in: Regenerate. * configure.in (elf): Add elf-attrs.lo. * configure: Regenerate. * elf-bfd.h (struct elf_backend_data): Add entries for object attributes. (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): New. (struct elf_obj_tdata): Add entries for object attributes. (elf_known_obj_attributes, elf_other_obj_attributes, elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): New. (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. (bfd_section_from_shdr): Handle attributes sections. * elflink.c (bfd_elf_final_link): Handle attributes sections. * elfxx-target.h (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. (elfNN_bed): Update. * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, aeabi_attribute_list): Remove. (struct elf32_arm_obj_tdata): Remove object attributes fields. (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): Update for new object attributes interfaces. (uleb128_size, is_default_attr, eabi_attr_size, elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, elf32_arm_add_eabi_attr_int, attr_strdup, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved to generic code in elf-attrs.c. (elf32_arm_obj_attrs_arg_type): New. (elf32_arm_fake_sections): Do not handle .ARM.attributes. (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. (bfd_elf32_bfd_final_link): Remove. (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object attributes. * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_copy_private_data): Likewise. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils: * readelf.c (display_gnu_attribute): New. (process_arm_specific): Rearrange as process_attributes. (process_arm_specific): Replace by wrapper of process_attributes. gas: * as.c (create_obj_attrs_section): New. (main): Call create_obj_attrs_section for ELF. * read.c (s_gnu_attribute, skip_whitespace, skip_past_char, skip_past_comma, s_vendor_attribute): New. (potable): Add gnu_attribute for ELF. * read.h (s_vendor_attribute): Declare. * config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper round s_vendor_attribute. (aeabi_set_public_attributes): Update for new attributes interfaces. (arm_md_end): Remove attributes contents setting now done generically. include/elf: * arm.h (elf32_arm_add_eabi_attr_int, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents, elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): Remove. * common.h (SHT_GNU_ATTRIBUTES): Define. ld: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes. (ATTRS_SECTIONS): Define. * scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc, scripttempl/elf_chaos.sc, scripttempl/elfi370.sc, scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
2007-06-29 18:29:17 +02:00
bfd_elf_set_obj_attr_contents (abfd, contents, attr_size);
bfd_set_section_contents (abfd, attr_section, contents, 0, attr_size);
free (contents);
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
error_return:
* elfcode.h (elf_checksum_contents): Free contents. * elf-bfd.h (_bfd_elf_link_hash_table_free): Declare. * elflink.c (_bfd_elf_link_hash_table_free): New function. (elf_final_link_free): New function, extracted from.. (bfd_elf_final_link): ..here. Always call _bfd_elf_write_section_eh_frame_hdr. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Default to _bfd_elf_link_hash_table_free. * libbfd-in.h (_bfd_merge_sections_free): Declare. * libbfd.h: Regenerate. * merge.c (_bfd_merge_sections_free): New function. * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): Free hdr_info->array. * elf-m10300.c (elf32_mn10300_link_hash_table_free): Call _bfd_elf_link_hash_table_free. * elf32-arm.c (elf32_arm_link_hash_table_free): Likewise. * elf32-avr.c (elf32_avr_link_hash_table_free): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_free): Likewise. * elf32-i386.c (elf_i386_link_hash_table_free): Likewise. * elf32-m68hc1x.c (m68hc11_elf_hash_table_free): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_free): Likewise. * elf32-metag.c (elf_metag_link_hash_table_free): Likewise. * elf32-xgate.c (xgate_elf_bfd_link_hash_table_free): Likewise. * elf64-aarch64.c (elf64_aarch64_link_hash_table_free): Likewise. * elf64-ia64-vms.c (elf64_ia64_hash_table_free): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_free): Likewise. * elf64-x86-64.c (elf_x86_64_link_hash_table_free): Likewise. * elfnn-ia64.c (elfNN_ia64_hash_table_free): Likewise. * elf32-cr16.c (elf32_cr16_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Don't define. * elf32-tic6x.c (elf32_tic6x_link_hash_table_free): Delete. (bfd_elf32_bfd_link_hash_table_free): Dont' define.
2013-02-11 06:30:54 +01:00
elf_final_link_free (abfd, &flinfo);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
}
/* Initialize COOKIE for input bfd ABFD. */
static bfd_boolean
init_reloc_cookie (struct elf_reloc_cookie *cookie,
struct bfd_link_info *info, bfd *abfd)
{
Elf_Internal_Shdr *symtab_hdr;
const struct elf_backend_data *bed;
bed = get_elf_backend_data (abfd);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
cookie->abfd = abfd;
cookie->sym_hashes = elf_sym_hashes (abfd);
cookie->bad_symtab = elf_bad_symtab (abfd);
if (cookie->bad_symtab)
{
cookie->locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
cookie->extsymoff = 0;
}
else
{
cookie->locsymcount = symtab_hdr->sh_info;
cookie->extsymoff = symtab_hdr->sh_info;
}
if (bed->s->arch_size == 32)
cookie->r_sym_shift = 8;
else
cookie->r_sym_shift = 32;
cookie->locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
if (cookie->locsyms == NULL && cookie->locsymcount != 0)
{
cookie->locsyms = bfd_elf_get_elf_syms (abfd, symtab_hdr,
cookie->locsymcount, 0,
NULL, NULL, NULL);
if (cookie->locsyms == NULL)
{
info->callbacks->einfo (_("%P%X: can not read symbols: %E\n"));
return FALSE;
}
if (info->keep_memory)
symtab_hdr->contents = (bfd_byte *) cookie->locsyms;
}
return TRUE;
}
/* Free the memory allocated by init_reloc_cookie, if appropriate. */
static void
fini_reloc_cookie (struct elf_reloc_cookie *cookie, bfd *abfd)
{
Elf_Internal_Shdr *symtab_hdr;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
if (cookie->locsyms != NULL
&& symtab_hdr->contents != (unsigned char *) cookie->locsyms)
free (cookie->locsyms);
}
/* Initialize the relocation information in COOKIE for input section SEC
of input bfd ABFD. */
static bfd_boolean
init_reloc_cookie_rels (struct elf_reloc_cookie *cookie,
struct bfd_link_info *info, bfd *abfd,
asection *sec)
{
const struct elf_backend_data *bed;
if (sec->reloc_count == 0)
{
cookie->rels = NULL;
cookie->relend = NULL;
}
else
{
bed = get_elf_backend_data (abfd);
cookie->rels = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
info->keep_memory);
if (cookie->rels == NULL)
return FALSE;
cookie->rel = cookie->rels;
cookie->relend = (cookie->rels
+ sec->reloc_count * bed->s->int_rels_per_ext_rel);
}
cookie->rel = cookie->rels;
return TRUE;
}
/* Free the memory allocated by init_reloc_cookie_rels,
if appropriate. */
static void
fini_reloc_cookie_rels (struct elf_reloc_cookie *cookie,
asection *sec)
{
if (cookie->rels && elf_section_data (sec)->relocs != cookie->rels)
free (cookie->rels);
}
/* Initialize the whole of COOKIE for input section SEC. */
static bfd_boolean
init_reloc_cookie_for_section (struct elf_reloc_cookie *cookie,
struct bfd_link_info *info,
asection *sec)
{
if (!init_reloc_cookie (cookie, info, sec->owner))
goto error1;
if (!init_reloc_cookie_rels (cookie, info, sec->owner, sec))
goto error2;
return TRUE;
error2:
fini_reloc_cookie (cookie, sec->owner);
error1:
return FALSE;
}
/* Free the memory allocated by init_reloc_cookie_for_section,
if appropriate. */
static void
fini_reloc_cookie_for_section (struct elf_reloc_cookie *cookie,
asection *sec)
{
fini_reloc_cookie_rels (cookie, sec);
fini_reloc_cookie (cookie, sec->owner);
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Garbage collect unused sections. */
* elflink.c (_bfd_elf_gc_mark_hook): New function. * elf-bfd.h (_bfd_elf_gc_mark_hook): Declare. * elfxx-target.h (elf_backend_gc_mark_hook): Default to above. * elf-m10300.c (mn10300_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. * elf32-arm.c (elf32_arm_gc_mark_hook): Likewise. * elf32-cris.c (cris_elf_gc_mark_hook): Likewise. * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise. * elf32-i386.c (elf_i386_gc_mark_hook): Likewise. * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise. * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise. * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise. * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise. * elf32-s390.c (elf_s390_gc_mark_hook): Likewise. * elf32-score.c (_bfd_score_elf_gc_mark_hook): Likewise. * elf32-sh.c (sh_elf_gc_mark_hook): Likewise. * elf32-vax.c (elf_vax_gc_mark_hook): Likewise. * elf32-xtensa.c (elf_xtensa_gc_mark_hook): Likewise. * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise. * elf64-s390.c (elf_s390_gc_mark_hook): Likewise. * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise. * elf32-bfin.c (bfin_gc_mark_hook): Likewise. (bfinfdpic_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define for elf32-bfinfdpic. * elf32-d10v.c (elf32_d10v_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (elf32_d10v_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-fr30.c (fr30_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (fr30_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-frv.c (elf32_frv_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (elf32_frv_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-iq2000.c (iq2000_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (iq2000_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (openrisc_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-v850.c (v850_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (v850_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (xstormy16_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf64-sh64.c (sh_elf64_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (sh_elf64_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-avr.c (elf32_avr_gc_mark_hook): Delete. (elf32_avr_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-cr16c.c (elf32_cr16c_gc_mark_hook): Delete. (elf32_cr16c_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-crx.c (elf32_crx_gc_mark_hook): Delete. (elf32_crx_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-h8300.c (elf32_h8_gc_mark_hook): Delete. (elf32_h8_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-ip2k.c (ip2k_elf_gc_mark_hook): Delete. (ip2k_elf_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-m32c.c (m32c_elf_gc_mark_hook, m32c_elf_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-m68hc11.c (elf_backend_gc_mark_hook): Don't define. (elf_backend_gc_sweep_hook): Don't define. * elf32-m68hc12.c (elf_backend_gc_mark_hook): Don't define. (elf_backend_gc_sweep_hook): Don't define. * elf32-m68hc1x.c (elf32_m68hc11_gc_mark_hook): Delete. (elf32_m68hc11_gc_sweep_hook): Delete. * elf32-m68hc1x.h (elf32_m68hc11_gc_mark_hook): Delete. (elf32_m68hc11_gc_sweep_hook): Delete. * elf32-msp430.c (elf32_msp430_gc_mark_hook): Delete. (elf32_msp430_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-mt.c (mt_elf_gc_mark_hook, mt_elf_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
2006-09-28 15:27:33 +02:00
/* Default gc_mark_hook. */
asection *
_bfd_elf_gc_mark_hook (asection *sec,
struct bfd_link_info *info ATTRIBUTE_UNUSED,
Elf_Internal_Rela *rel ATTRIBUTE_UNUSED,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
{
switch (h->root.type)
{
case bfd_link_hash_defined:
case bfd_link_hash_defweak:
return h->root.u.def.section;
case bfd_link_hash_common:
return h->root.u.c.p->section;
default:
break;
}
}
else
return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
return NULL;
}
/* COOKIE->rel describes a relocation against section SEC, which is
a section we've decided to keep. Return the section that contains
the relocation symbol, or NULL if no section contains it. */
asection *
_bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
elf_gc_mark_hook_fn gc_mark_hook,
struct elf_reloc_cookie *cookie,
bfd_boolean *start_stop)
{
unsigned long r_symndx;
struct elf_link_hash_entry *h;
r_symndx = cookie->rel->r_info >> cookie->r_sym_shift;
if (r_symndx == STN_UNDEF)
return NULL;
if (r_symndx >= cookie->locsymcount
|| ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
{
h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
if (h == NULL)
{
info->callbacks->einfo (_("%F%P: corrupt input: %B\n"),
sec->owner);
return NULL;
}
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
PR ld/13177 bfd/ * elflink.c (_bfd_elf_gc_mark_rsec): Set symbol "mark". (elf_gc_sweep_symbol): Don't test plt/got refcounts, instead test "mark". Hide undefweak too. Clear def_regular and ref_regular. * elf-m10300.c (mn10300_elf_relocate_section): Ignore unresolved reloc errors from garbage-collected code. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-bfin.c (bfin_relocate_section): Likewise. (bfinfdpic_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. ld/testsuite/ * ld-elf/elf.exp: Move test for shared lib support.. * lib/ld-lib.exp (check_shared_lib_support): ..to here. Add m68hc1*, and s/ms1/mt/. (check_gc_sections_available): Match hppa*64 not hppa64. Comment. * ld-gc/libpersonality.s: New. * ld-gc/personality.s, * ld-gc/personality.d: New. * ld-gc/gc.exp: Run personality test.
2011-10-19 09:17:21 +02:00
h->mark = 1;
/* If this symbol is weak and there is a non-weak definition, we
keep the non-weak definition because many backends put
dynamic reloc info on the non-weak definition for code
handling copy relocs. */
if (h->u.weakdef != NULL)
h->u.weakdef->mark = 1;
if (start_stop != NULL
&& (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak))
{
/* To work around a glibc bug, mark all XXX input sections
when there is an as yet undefined reference to __start_XXX
or __stop_XXX symbols. The linker will later define such
symbols for orphan input sections that have a name
representable as a C identifier. */
const char *sec_name = NULL;
if (strncmp (h->root.root.string, "__start_", 8) == 0)
sec_name = h->root.root.string + 8;
else if (strncmp (h->root.root.string, "__stop_", 7) == 0)
sec_name = h->root.root.string + 7;
if (sec_name != NULL && *sec_name != '\0')
{
bfd *i;
for (i = info->input_bfds; i != NULL; i = i->link.next)
{
asection *s = bfd_get_section_by_name (i, sec_name);
if (s != NULL && !s->gc_mark)
{
*start_stop = TRUE;
return s;
}
}
}
}
return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
}
return (*gc_mark_hook) (sec, info, cookie->rel, NULL,
&cookie->locsyms[r_symndx]);
}
/* COOKIE->rel describes a relocation against section SEC, which is
a section we've decided to keep. Mark the section that contains
the relocation symbol. */
bfd_boolean
_bfd_elf_gc_mark_reloc (struct bfd_link_info *info,
asection *sec,
elf_gc_mark_hook_fn gc_mark_hook,
struct elf_reloc_cookie *cookie)
{
asection *rsec;
bfd_boolean start_stop = FALSE;
rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie, &start_stop);
while (rsec != NULL)
{
if (!rsec->gc_mark)
{
if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour
|| (rsec->owner->flags & DYNAMIC) != 0)
rsec->gc_mark = 1;
else if (!_bfd_elf_gc_mark (info, rsec, gc_mark_hook))
return FALSE;
}
if (!start_stop)
break;
rsec = bfd_get_next_section_by_name (rsec->owner, rsec);
}
return TRUE;
}
* elflink.c (_bfd_elf_gc_mark_hook): New function. * elf-bfd.h (_bfd_elf_gc_mark_hook): Declare. * elfxx-target.h (elf_backend_gc_mark_hook): Default to above. * elf-m10300.c (mn10300_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. * elf32-arm.c (elf32_arm_gc_mark_hook): Likewise. * elf32-cris.c (cris_elf_gc_mark_hook): Likewise. * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise. * elf32-i386.c (elf_i386_gc_mark_hook): Likewise. * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise. * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise. * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise. * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise. * elf32-s390.c (elf_s390_gc_mark_hook): Likewise. * elf32-score.c (_bfd_score_elf_gc_mark_hook): Likewise. * elf32-sh.c (sh_elf_gc_mark_hook): Likewise. * elf32-vax.c (elf_vax_gc_mark_hook): Likewise. * elf32-xtensa.c (elf_xtensa_gc_mark_hook): Likewise. * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise. * elf64-s390.c (elf_s390_gc_mark_hook): Likewise. * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise. * elf32-bfin.c (bfin_gc_mark_hook): Likewise. (bfinfdpic_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define for elf32-bfinfdpic. * elf32-d10v.c (elf32_d10v_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (elf32_d10v_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-fr30.c (fr30_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (fr30_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-frv.c (elf32_frv_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (elf32_frv_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-iq2000.c (iq2000_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (iq2000_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (openrisc_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-v850.c (v850_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (v850_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (xstormy16_elf_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf64-sh64.c (sh_elf64_gc_mark_hook): Use _bfd_elf_gc_mark_hook. (sh_elf64_gc_sweep_hook): Delete. (elf_backend_gc_sweep_hook): Don't define. * elf32-avr.c (elf32_avr_gc_mark_hook): Delete. (elf32_avr_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-cr16c.c (elf32_cr16c_gc_mark_hook): Delete. (elf32_cr16c_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-crx.c (elf32_crx_gc_mark_hook): Delete. (elf32_crx_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-h8300.c (elf32_h8_gc_mark_hook): Delete. (elf32_h8_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-ip2k.c (ip2k_elf_gc_mark_hook): Delete. (ip2k_elf_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-m32c.c (m32c_elf_gc_mark_hook, m32c_elf_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-m68hc11.c (elf_backend_gc_mark_hook): Don't define. (elf_backend_gc_sweep_hook): Don't define. * elf32-m68hc12.c (elf_backend_gc_mark_hook): Don't define. (elf_backend_gc_sweep_hook): Don't define. * elf32-m68hc1x.c (elf32_m68hc11_gc_mark_hook): Delete. (elf32_m68hc11_gc_sweep_hook): Delete. * elf32-m68hc1x.h (elf32_m68hc11_gc_mark_hook): Delete. (elf32_m68hc11_gc_sweep_hook): Delete. * elf32-msp430.c (elf32_msp430_gc_mark_hook): Delete. (elf32_msp430_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define. * elf32-mt.c (mt_elf_gc_mark_hook, mt_elf_gc_sweep_hook): Delete. (elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
2006-09-28 15:27:33 +02:00
/* The mark phase of garbage collection. For a given section, mark
it and any sections in this section's group, and all the sections
which define symbols to which it refers. */
bfd_boolean
_bfd_elf_gc_mark (struct bfd_link_info *info,
asection *sec,
elf_gc_mark_hook_fn gc_mark_hook)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd_boolean ret;
asection *group_sec, *eh_frame;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
sec->gc_mark = 1;
/* Mark all the sections in the group. */
group_sec = elf_section_data (sec)->next_in_group;
if (group_sec && !group_sec->gc_mark)
if (!_bfd_elf_gc_mark (info, group_sec, gc_mark_hook))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return FALSE;
/* Look through the section relocs. */
ret = TRUE;
eh_frame = elf_eh_frame_section (sec->owner);
if ((sec->flags & SEC_RELOC) != 0
&& sec->reloc_count > 0
&& sec != eh_frame)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
struct elf_reloc_cookie cookie;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (!init_reloc_cookie_for_section (&cookie, info, sec))
ret = FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
else
{
for (; cookie.rel < cookie.relend; cookie.rel++)
if (!_bfd_elf_gc_mark_reloc (info, sec, gc_mark_hook, &cookie))
{
ret = FALSE;
break;
}
fini_reloc_cookie_for_section (&cookie, sec);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
if (ret && eh_frame && elf_fde_list (sec))
{
struct elf_reloc_cookie cookie;
if (!init_reloc_cookie_for_section (&cookie, info, eh_frame))
ret = FALSE;
else
{
if (!_bfd_elf_gc_mark_fdes (info, sec, eh_frame,
gc_mark_hook, &cookie))
ret = FALSE;
fini_reloc_cookie_for_section (&cookie, eh_frame);
}
}
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
eh_frame = elf_section_eh_frame_entry (sec);
if (ret && eh_frame && !eh_frame->gc_mark)
if (!_bfd_elf_gc_mark (info, eh_frame, gc_mark_hook))
ret = FALSE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return ret;
}
/* Scan and mark sections in a special or debug section group. */
static void
_bfd_elf_gc_mark_debug_special_section_group (asection *grp)
{
/* Point to first section of section group. */
asection *ssec;
/* Used to iterate the section group. */
asection *msec;
bfd_boolean is_special_grp = TRUE;
bfd_boolean is_debug_grp = TRUE;
/* First scan to see if group contains any section other than debug
and special section. */
ssec = msec = elf_next_in_group (grp);
do
{
if ((msec->flags & SEC_DEBUGGING) == 0)
is_debug_grp = FALSE;
if ((msec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) != 0)
is_special_grp = FALSE;
msec = elf_next_in_group (msec);
}
while (msec != ssec);
/* If this is a pure debug section group or pure special section group,
keep all sections in this group. */
if (is_debug_grp || is_special_grp)
{
do
{
msec->gc_mark = 1;
msec = elf_next_in_group (msec);
}
while (msec != ssec);
}
}
/* Keep debug and special sections. */
bfd_boolean
_bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info,
elf_gc_mark_hook_fn mark_hook ATTRIBUTE_UNUSED)
{
bfd *ibfd;
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
asection *isec;
bfd_boolean some_kept;
bfd_boolean debug_frag_seen;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
continue;
/* Ensure all linker created sections are kept,
see if any other section is already marked,
and note if we have any fragmented debug sections. */
debug_frag_seen = some_kept = FALSE;
for (isec = ibfd->sections; isec != NULL; isec = isec->next)
{
if ((isec->flags & SEC_LINKER_CREATED) != 0)
isec->gc_mark = 1;
else if (isec->gc_mark)
some_kept = TRUE;
if (debug_frag_seen == FALSE
&& (isec->flags & SEC_DEBUGGING)
&& CONST_STRNEQ (isec->name, ".debug_line."))
debug_frag_seen = TRUE;
}
/* If no section in this file will be kept, then we can
toss out the debug and special sections. */
if (!some_kept)
continue;
/* Keep debug and special sections like .comment when they are
not part of a group. Also keep section groups that contain
just debug sections or special sections. */
for (isec = ibfd->sections; isec != NULL; isec = isec->next)
{
if ((isec->flags & SEC_GROUP) != 0)
_bfd_elf_gc_mark_debug_special_section_group (isec);
else if (((isec->flags & SEC_DEBUGGING) != 0
|| (isec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0)
&& elf_next_in_group (isec) == NULL)
isec->gc_mark = 1;
}
if (! debug_frag_seen)
continue;
/* Look for CODE sections which are going to be discarded,
and find and discard any fragmented debug sections which
are associated with that code section. */
for (isec = ibfd->sections; isec != NULL; isec = isec->next)
if ((isec->flags & SEC_CODE) != 0
&& isec->gc_mark == 0)
{
unsigned int ilen;
asection *dsec;
ilen = strlen (isec->name);
/* Association is determined by the name of the debug section
containing the name of the code section as a suffix. For
example .debug_line.text.foo is a debug section associated
with .text.foo. */
for (dsec = ibfd->sections; dsec != NULL; dsec = dsec->next)
{
unsigned int dlen;
if (dsec->gc_mark == 0
|| (dsec->flags & SEC_DEBUGGING) == 0)
continue;
dlen = strlen (dsec->name);
if (dlen > ilen
&& strncmp (dsec->name + (dlen - ilen),
isec->name, ilen) == 0)
{
dsec->gc_mark = 0;
}
}
}
}
return TRUE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */
struct elf_gc_sweep_symbol_info
{
struct bfd_link_info *info;
void (*hide_symbol) (struct bfd_link_info *, struct elf_link_hash_entry *,
bfd_boolean);
};
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
static bfd_boolean
elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
PR ld/13177 bfd/ * elflink.c (_bfd_elf_gc_mark_rsec): Set symbol "mark". (elf_gc_sweep_symbol): Don't test plt/got refcounts, instead test "mark". Hide undefweak too. Clear def_regular and ref_regular. * elf-m10300.c (mn10300_elf_relocate_section): Ignore unresolved reloc errors from garbage-collected code. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-bfin.c (bfin_relocate_section): Likewise. (bfinfdpic_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. ld/testsuite/ * ld-elf/elf.exp: Move test for shared lib support.. * lib/ld-lib.exp (check_shared_lib_support): ..to here. Add m68hc1*, and s/ms1/mt/. (check_gc_sections_available): Match hppa*64 not hppa64. Comment. * ld-gc/libpersonality.s: New. * ld-gc/personality.s, * ld-gc/personality.d: New. * ld-gc/gc.exp: Run personality test.
2011-10-19 09:17:21 +02:00
if (!h->mark
&& (((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& !((h->def_regular || ELF_COMMON_DEF_P (h))
&& h->root.u.def.section->gc_mark))
PR ld/13177 bfd/ * elflink.c (_bfd_elf_gc_mark_rsec): Set symbol "mark". (elf_gc_sweep_symbol): Don't test plt/got refcounts, instead test "mark". Hide undefweak too. Clear def_regular and ref_regular. * elf-m10300.c (mn10300_elf_relocate_section): Ignore unresolved reloc errors from garbage-collected code. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-bfin.c (bfin_relocate_section): Likewise. (bfinfdpic_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. ld/testsuite/ * ld-elf/elf.exp: Move test for shared lib support.. * lib/ld-lib.exp (check_shared_lib_support): ..to here. Add m68hc1*, and s/ms1/mt/. (check_gc_sections_available): Match hppa*64 not hppa64. Comment. * ld-gc/libpersonality.s: New. * ld-gc/personality.s, * ld-gc/personality.d: New. * ld-gc/gc.exp: Run personality test.
2011-10-19 09:17:21 +02:00
|| h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak))
{
struct elf_gc_sweep_symbol_info *inf;
inf = (struct elf_gc_sweep_symbol_info *) data;
(*inf->hide_symbol) (inf->info, h, TRUE);
PR ld/13177 bfd/ * elflink.c (_bfd_elf_gc_mark_rsec): Set symbol "mark". (elf_gc_sweep_symbol): Don't test plt/got refcounts, instead test "mark". Hide undefweak too. Clear def_regular and ref_regular. * elf-m10300.c (mn10300_elf_relocate_section): Ignore unresolved reloc errors from garbage-collected code. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-bfin.c (bfin_relocate_section): Likewise. (bfinfdpic_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. ld/testsuite/ * ld-elf/elf.exp: Move test for shared lib support.. * lib/ld-lib.exp (check_shared_lib_support): ..to here. Add m68hc1*, and s/ms1/mt/. (check_gc_sections_available): Match hppa*64 not hppa64. Comment. * ld-gc/libpersonality.s: New. * ld-gc/personality.s, * ld-gc/personality.d: New. * ld-gc/gc.exp: Run personality test.
2011-10-19 09:17:21 +02:00
h->def_regular = 0;
h->ref_regular = 0;
h->ref_regular_nonweak = 0;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
/* The sweep phase of garbage collection. Remove all garbage sections. */
typedef bfd_boolean (*gc_sweep_hook_fn)
(bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
static bfd_boolean
elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd *sub;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
gc_sweep_hook_fn gc_sweep_hook = bed->gc_sweep_hook;
unsigned long section_sym_count;
struct elf_gc_sweep_symbol_info sweep_info;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
asection *o;
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
continue;
for (o = sub->sections; o != NULL; o = o->next)
{
/* When any section in a section group is kept, we keep all
sections in the section group. If the first member of
the section group is excluded, we will also exclude the
group section. */
if (o->flags & SEC_GROUP)
{
asection *first = elf_next_in_group (o);
o->gc_mark = first->gc_mark;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (o->gc_mark)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
continue;
/* Skip sweeping sections already excluded. */
if (o->flags & SEC_EXCLUDE)
continue;
/* Since this is early in the link process, it is simple
to remove a section from the output. */
o->flags |= SEC_EXCLUDE;
if (info->print_gc_sections && o->size != 0)
_bfd_error_handler (_("Removing unused section '%s' in file '%B'"), sub, o->name);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* But we also have to update some of the relocation
info we collected before. */
if (gc_sweep_hook
&& (o->flags & SEC_RELOC) != 0
&& o->reloc_count != 0
&& !((info->strip == strip_all || info->strip == strip_debugger)
&& (o->flags & SEC_DEBUGGING) != 0)
&& !bfd_is_abs_section (o->output_section))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
Elf_Internal_Rela *internal_relocs;
bfd_boolean r;
internal_relocs
= _bfd_elf_link_read_relocs (o->owner, o, NULL, NULL,
info->keep_memory);
if (internal_relocs == NULL)
return FALSE;
r = (*gc_sweep_hook) (o->owner, info, o, internal_relocs);
if (elf_section_data (o)->relocs != internal_relocs)
free (internal_relocs);
if (!r)
return FALSE;
}
}
}
/* Remove the symbols that were in the swept sections from the dynamic
symbol table. GCFIXME: Anyone know how to get them out of the
static symbol table as well? */
sweep_info.info = info;
sweep_info.hide_symbol = bed->elf_backend_hide_symbol;
elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol,
&sweep_info);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
_bfd_elf_link_renumber_dynsyms (abfd, info, &section_sym_count);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
/* Propagate collected vtable information. This is called through
elf_link_hash_traverse. */
static bfd_boolean
elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
{
/* Those that are not vtables. */
if (h->vtable == NULL || h->vtable->parent == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
/* Those vtables that do not have parents, we cannot merge. */
if (h->vtable->parent == (struct elf_link_hash_entry *) -1)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
/* If we've already been done, exit. */
if (h->vtable->used && h->vtable->used[-1])
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
/* Make sure the parent's table is up to date. */
elf_gc_propagate_vtable_entries_used (h->vtable->parent, okp);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (h->vtable->used == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
/* None of this table's entries were referenced. Re-use the
parent's table. */
h->vtable->used = h->vtable->parent->vtable->used;
h->vtable->size = h->vtable->parent->vtable->size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
else
{
size_t n;
bfd_boolean *cu, *pu;
/* Or the parent's entries into ours. */
cu = h->vtable->used;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
cu[-1] = TRUE;
pu = h->vtable->parent->vtable->used;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (pu != NULL)
{
const struct elf_backend_data *bed;
unsigned int log_file_align;
bed = get_elf_backend_data (h->root.u.def.section->owner);
log_file_align = bed->s->log_file_align;
n = h->vtable->parent->vtable->size >> log_file_align;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
while (n--)
{
if (*pu)
*cu = TRUE;
pu++;
cu++;
}
}
}
return TRUE;
}
static bfd_boolean
elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
{
asection *sec;
bfd_vma hstart, hend;
Elf_Internal_Rela *relstart, *relend, *rel;
const struct elf_backend_data *bed;
unsigned int log_file_align;
/* Take care of both those symbols that do not describe vtables as
well as those that are not loaded. */
if (h->vtable == NULL || h->vtable->parent == NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
BFD_ASSERT (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak);
sec = h->root.u.def.section;
hstart = h->root.u.def.value;
hend = hstart + h->size;
relstart = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, TRUE);
if (!relstart)
return *(bfd_boolean *) okp = FALSE;
bed = get_elf_backend_data (sec->owner);
log_file_align = bed->s->log_file_align;
relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
for (rel = relstart; rel < relend; ++rel)
if (rel->r_offset >= hstart && rel->r_offset < hend)
{
/* If the entry is in use, do nothing. */
if (h->vtable->used
&& (rel->r_offset - hstart) < h->vtable->size)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd_vma entry = (rel->r_offset - hstart) >> log_file_align;
if (h->vtable->used[entry])
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
continue;
}
/* Otherwise, kill it. */
rel->r_offset = rel->r_info = rel->r_addend = 0;
}
return TRUE;
}
/* Mark sections containing dynamically referenced symbols. When
building shared libraries, we must assume that any visible symbol is
referenced. */
bfd_boolean
bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
{
struct bfd_link_info *info = (struct bfd_link_info *) inf;
struct bfd_elf_dynamic_list *d = info->dynamic_list;
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& (h->ref_dynamic
|| ((h->def_regular || ELF_COMMON_DEF_P (h))
&& ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& (!bfd_link_executable (info)
|| info->export_dynamic
|| (h->dynamic
&& d != NULL
&& (*d->match) (&d->head, NULL, h->root.root.string)))
&& (h->versioned >= versioned
|| !bfd_hide_sym_by_version (info->version_info,
h->root.root.string)))))
h->root.u.def.section->flags |= SEC_KEEP;
return TRUE;
}
bfd/ * elf-bfd.h (struct elf_backend_data): Remove got_symbol_offset. * elfxx-target.h (elf_backend_got_symbol_offset): Delete. * elflink.c (_bfd_elf_create_got_section): Use zero in place of got_symbol_offset. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise. * elf32-frv.c (_frv_create_got_section): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Delete ppc code. (elf_backend_got_symbol_offset): Don't define. * elf64-ppc.c (elf_backend_got_symbol_offset): Don't define. * elf32-ppc.c (struct ppc_elf_link_hash_table): Add got_header_size and got_gap. (ppc_elf_create_got): Tidy. (ppc_elf_create_dynamic_sections): Don't set SEC_IN_MEMORY for .plt. (ppc_elf_check_relocs): Reduce string comparisons by using elf.hgot. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_relocate_section): Likewise. (ppc_elf_finish_dynamic_symbol): Likewise. (allocate_got): New function. (allocate_dynrelocs): Use allocate_got. (ppc_elf_size_dynamic_sections): Likewise. Delay tlsld_got allocation so that local got can refcount it. Set got_header_size. (ppc_elf_relocate_section): Use value of elf.hgot rather than hard- coded 4. (ppc_elf_finish_dynamic_sections): Likewise. (elf_backend_got_symbol_offset): Don't define. (elf_backend_got_header_size): Ditto. ld/testsuite/ * ld-powerpc/tlsexe32.d: Update for changed got layout. * ld-powerpc/tlsexe32.g: Likewise. * ld-powerpc/tlsexe32.r: Likewise. * ld-powerpc/tlsso32.d: Likewise. * ld-powerpc/tlsso32.g: Likewise. * ld-powerpc/tlsso32.r: Likewise.
2005-05-07 04:55:55 +02:00
/* Keep all sections containing symbols undefined on the command-line,
and the section containing the entry symbol. */
void
_bfd_elf_gc_keep (struct bfd_link_info *info)
{
struct bfd_sym_chain *sym;
for (sym = info->gc_sym_list; sym != NULL; sym = sym->next)
{
struct elf_link_hash_entry *h;
h = elf_link_hash_lookup (elf_hash_table (info), sym->name,
FALSE, FALSE, FALSE);
if (h != NULL
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& !bfd_is_abs_section (h->root.u.def.section))
h->root.u.def.section->flags |= SEC_KEEP;
}
}
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
bfd_boolean
bfd_elf_parse_eh_frame_entries (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
bfd *ibfd = info->input_bfds;
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
asection *sec;
struct elf_reloc_cookie cookie;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
continue;
if (!init_reloc_cookie (&cookie, info, ibfd))
return FALSE;
for (sec = ibfd->sections; sec; sec = sec->next)
{
if (CONST_STRNEQ (bfd_section_name (ibfd, sec), ".eh_frame_entry")
&& init_reloc_cookie_rels (&cookie, info, ibfd, sec))
{
_bfd_elf_parse_eh_frame_entry (info, sec, &cookie);
fini_reloc_cookie_rels (&cookie, sec);
}
}
}
return TRUE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Do mark and sweep of unused sections. */
bfd_boolean
bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
{
bfd_boolean ok = TRUE;
bfd *sub;
elf_gc_mark_hook_fn gc_mark_hook;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
Index PowerPC64 linker generated .eh_frame in .eh_frame_hdr I noticed recently that .eh_frame FDEs generated by the linker for call stubs and .glink weren't being indexed in .eh_frame_hdr, due to bfd_elf_discard_info being run before the linker generated .eh_frame sections were available for parsing. This patch moves code around in elf64-ppc.c and ppc64elf.em to avoid that problem. Another problem fixed here is that --gc-sections parses .eh_frame early, and the existing machinery allows only one go at parsing the .eh_frame sections. That resulted in the linker generated .eh_frame CIEs not being merged and no .eh_frame_hdr index entries for those FDEs. It turns out that all the info from parsing .eh_frame is attached to the section, so order of parsing isn't important, and after parsing sec_info_type being set will prevent a section being parsed again. At least, when parsing doesn't hit an error. So there isn't really any need for "parsed_eh_frame". "merge_cies" is also redundant, which means _bfd_elf_{begin,end}_eh_frame_parsing can also disappear. bfd/ * elf-bfd.h (struct eh_frame_hdr_info): Delete merge_cies and parsed_eh_frames. (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. * elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. (_bfd_elf_parse_eh_frame): Don't test parsed_eh_frame. Test !info->relocatable in place of merge_cies. * elflink.c (bfd_elf_gc_sections, bfd_elf_discard_info): Adjust. * elf64-ppc.c (glink_eh_frame_cie): Pad to multiple of 8. (ppc64_elf_size_stubs): Likewise pad stub FDE. (ppc64_elf_build_stubs): Move code setting glink .eh_frame to.. (ppc64_elf_size_stubs): ..here and.. (ppc64_elf_finish_dynamic_sections): ..here. ld/ * emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call bfd_elf_discard_info after generating glink .eh_frame. Delete redundant test on ppc64_elf_setup_section_lists status.
2014-08-22 01:37:35 +02:00
struct elf_link_hash_table *htab;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (!bed->can_gc_sections
|| !is_elf_hash_table (info->hash))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
(*_bfd_error_handler)(_("Warning: gc-sections option ignored"));
return TRUE;
}
bed->gc_keep (info);
Index PowerPC64 linker generated .eh_frame in .eh_frame_hdr I noticed recently that .eh_frame FDEs generated by the linker for call stubs and .glink weren't being indexed in .eh_frame_hdr, due to bfd_elf_discard_info being run before the linker generated .eh_frame sections were available for parsing. This patch moves code around in elf64-ppc.c and ppc64elf.em to avoid that problem. Another problem fixed here is that --gc-sections parses .eh_frame early, and the existing machinery allows only one go at parsing the .eh_frame sections. That resulted in the linker generated .eh_frame CIEs not being merged and no .eh_frame_hdr index entries for those FDEs. It turns out that all the info from parsing .eh_frame is attached to the section, so order of parsing isn't important, and after parsing sec_info_type being set will prevent a section being parsed again. At least, when parsing doesn't hit an error. So there isn't really any need for "parsed_eh_frame". "merge_cies" is also redundant, which means _bfd_elf_{begin,end}_eh_frame_parsing can also disappear. bfd/ * elf-bfd.h (struct eh_frame_hdr_info): Delete merge_cies and parsed_eh_frames. (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. * elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. (_bfd_elf_parse_eh_frame): Don't test parsed_eh_frame. Test !info->relocatable in place of merge_cies. * elflink.c (bfd_elf_gc_sections, bfd_elf_discard_info): Adjust. * elf64-ppc.c (glink_eh_frame_cie): Pad to multiple of 8. (ppc64_elf_size_stubs): Likewise pad stub FDE. (ppc64_elf_build_stubs): Move code setting glink .eh_frame to.. (ppc64_elf_size_stubs): ..here and.. (ppc64_elf_finish_dynamic_sections): ..here. ld/ * emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call bfd_elf_discard_info after generating glink .eh_frame. Delete redundant test on ppc64_elf_setup_section_lists status.
2014-08-22 01:37:35 +02:00
htab = elf_hash_table (info);
/* Try to parse each bfd's .eh_frame section. Point elf_eh_frame_section
at the .eh_frame section if we can mark the FDEs individually. */
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
for (sub = info->input_bfds;
info->eh_frame_hdr_type != COMPACT_EH_HDR && sub != NULL;
sub = sub->link.next)
{
asection *sec;
struct elf_reloc_cookie cookie;
sec = bfd_get_section_by_name (sub, ".eh_frame");
while (sec && init_reloc_cookie_for_section (&cookie, info, sec))
{
_bfd_elf_parse_eh_frame (sub, info, sec, &cookie);
if (elf_section_data (sec)->sec_info
&& (sec->flags & SEC_LINKER_CREATED) == 0)
elf_eh_frame_section (sub) = sec;
fini_reloc_cookie_for_section (&cookie, sec);
sec = bfd_get_next_section_by_name (NULL, sec);
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Apply transitive closure to the vtable entry usage info. */
Index PowerPC64 linker generated .eh_frame in .eh_frame_hdr I noticed recently that .eh_frame FDEs generated by the linker for call stubs and .glink weren't being indexed in .eh_frame_hdr, due to bfd_elf_discard_info being run before the linker generated .eh_frame sections were available for parsing. This patch moves code around in elf64-ppc.c and ppc64elf.em to avoid that problem. Another problem fixed here is that --gc-sections parses .eh_frame early, and the existing machinery allows only one go at parsing the .eh_frame sections. That resulted in the linker generated .eh_frame CIEs not being merged and no .eh_frame_hdr index entries for those FDEs. It turns out that all the info from parsing .eh_frame is attached to the section, so order of parsing isn't important, and after parsing sec_info_type being set will prevent a section being parsed again. At least, when parsing doesn't hit an error. So there isn't really any need for "parsed_eh_frame". "merge_cies" is also redundant, which means _bfd_elf_{begin,end}_eh_frame_parsing can also disappear. bfd/ * elf-bfd.h (struct eh_frame_hdr_info): Delete merge_cies and parsed_eh_frames. (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. * elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. (_bfd_elf_parse_eh_frame): Don't test parsed_eh_frame. Test !info->relocatable in place of merge_cies. * elflink.c (bfd_elf_gc_sections, bfd_elf_discard_info): Adjust. * elf64-ppc.c (glink_eh_frame_cie): Pad to multiple of 8. (ppc64_elf_size_stubs): Likewise pad stub FDE. (ppc64_elf_build_stubs): Move code setting glink .eh_frame to.. (ppc64_elf_size_stubs): ..here and.. (ppc64_elf_finish_dynamic_sections): ..here. ld/ * emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call bfd_elf_discard_info after generating glink .eh_frame. Delete redundant test on ppc64_elf_setup_section_lists status.
2014-08-22 01:37:35 +02:00
elf_link_hash_traverse (htab, elf_gc_propagate_vtable_entries_used, &ok);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (!ok)
return FALSE;
/* Kill the vtable relocations that were not used. */
Index PowerPC64 linker generated .eh_frame in .eh_frame_hdr I noticed recently that .eh_frame FDEs generated by the linker for call stubs and .glink weren't being indexed in .eh_frame_hdr, due to bfd_elf_discard_info being run before the linker generated .eh_frame sections were available for parsing. This patch moves code around in elf64-ppc.c and ppc64elf.em to avoid that problem. Another problem fixed here is that --gc-sections parses .eh_frame early, and the existing machinery allows only one go at parsing the .eh_frame sections. That resulted in the linker generated .eh_frame CIEs not being merged and no .eh_frame_hdr index entries for those FDEs. It turns out that all the info from parsing .eh_frame is attached to the section, so order of parsing isn't important, and after parsing sec_info_type being set will prevent a section being parsed again. At least, when parsing doesn't hit an error. So there isn't really any need for "parsed_eh_frame". "merge_cies" is also redundant, which means _bfd_elf_{begin,end}_eh_frame_parsing can also disappear. bfd/ * elf-bfd.h (struct eh_frame_hdr_info): Delete merge_cies and parsed_eh_frames. (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. * elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. (_bfd_elf_parse_eh_frame): Don't test parsed_eh_frame. Test !info->relocatable in place of merge_cies. * elflink.c (bfd_elf_gc_sections, bfd_elf_discard_info): Adjust. * elf64-ppc.c (glink_eh_frame_cie): Pad to multiple of 8. (ppc64_elf_size_stubs): Likewise pad stub FDE. (ppc64_elf_build_stubs): Move code setting glink .eh_frame to.. (ppc64_elf_size_stubs): ..here and.. (ppc64_elf_finish_dynamic_sections): ..here. ld/ * emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call bfd_elf_discard_info after generating glink .eh_frame. Delete redundant test on ppc64_elf_setup_section_lists status.
2014-08-22 01:37:35 +02:00
elf_link_hash_traverse (htab, elf_gc_smash_unused_vtentry_relocs, &ok);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (!ok)
return FALSE;
/* Mark dynamically referenced symbols. */
Index PowerPC64 linker generated .eh_frame in .eh_frame_hdr I noticed recently that .eh_frame FDEs generated by the linker for call stubs and .glink weren't being indexed in .eh_frame_hdr, due to bfd_elf_discard_info being run before the linker generated .eh_frame sections were available for parsing. This patch moves code around in elf64-ppc.c and ppc64elf.em to avoid that problem. Another problem fixed here is that --gc-sections parses .eh_frame early, and the existing machinery allows only one go at parsing the .eh_frame sections. That resulted in the linker generated .eh_frame CIEs not being merged and no .eh_frame_hdr index entries for those FDEs. It turns out that all the info from parsing .eh_frame is attached to the section, so order of parsing isn't important, and after parsing sec_info_type being set will prevent a section being parsed again. At least, when parsing doesn't hit an error. So there isn't really any need for "parsed_eh_frame". "merge_cies" is also redundant, which means _bfd_elf_{begin,end}_eh_frame_parsing can also disappear. bfd/ * elf-bfd.h (struct eh_frame_hdr_info): Delete merge_cies and parsed_eh_frames. (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. * elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): Delete. (_bfd_elf_end_eh_frame_parsing): Delete. (_bfd_elf_parse_eh_frame): Don't test parsed_eh_frame. Test !info->relocatable in place of merge_cies. * elflink.c (bfd_elf_gc_sections, bfd_elf_discard_info): Adjust. * elf64-ppc.c (glink_eh_frame_cie): Pad to multiple of 8. (ppc64_elf_size_stubs): Likewise pad stub FDE. (ppc64_elf_build_stubs): Move code setting glink .eh_frame to.. (ppc64_elf_size_stubs): ..here and.. (ppc64_elf_finish_dynamic_sections): ..here. ld/ * emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call bfd_elf_discard_info after generating glink .eh_frame. Delete redundant test on ppc64_elf_setup_section_lists status.
2014-08-22 01:37:35 +02:00
if (htab->dynamic_sections_created)
elf_link_hash_traverse (htab, bed->gc_mark_dynamic_ref, info);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* Grovel through relocs to find out who stays ... */
gc_mark_hook = bed->gc_mark_hook;
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
asection *o;
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
continue;
/* Start at sections marked with SEC_KEEP (ref _bfd_elf_gc_keep).
Also treat note sections as a root, if the section is not part
of a group. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (o = sub->sections; o != NULL; o = o->next)
if (!o->gc_mark
&& (o->flags & SEC_EXCLUDE) == 0
&& ((o->flags & SEC_KEEP) != 0
|| (elf_section_data (o)->this_hdr.sh_type == SHT_NOTE
&& elf_next_in_group (o) == NULL )))
{
if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
return FALSE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
/* Allow the backend to mark additional target specific sections. */
bed->gc_mark_extra_sections (info, gc_mark_hook);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* ... and mark SEC_EXCLUDE for those that go. */
return elf_gc_sweep (abfd, info);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
/* Called from check_relocs to record the existence of a VTINHERIT reloc. */
bfd_boolean
bfd_elf_gc_record_vtinherit (bfd *abfd,
asection *sec,
struct elf_link_hash_entry *h,
bfd_vma offset)
{
struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
struct elf_link_hash_entry **search, *child;
bfd_size_type extsymcount;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
/* The sh_info field of the symtab header tells us where the
external symbols start. We don't care about the local symbols at
this point. */
extsymcount = elf_tdata (abfd)->symtab_hdr.sh_size / bed->s->sizeof_sym;
if (!elf_bad_symtab (abfd))
extsymcount -= elf_tdata (abfd)->symtab_hdr.sh_info;
sym_hashes = elf_sym_hashes (abfd);
sym_hashes_end = sym_hashes + extsymcount;
/* Hunt down the child symbol, which is in this section at the same
offset as the relocation. */
for (search = sym_hashes; search != sym_hashes_end; ++search)
{
if ((child = *search) != NULL
&& (child->root.type == bfd_link_hash_defined
|| child->root.type == bfd_link_hash_defweak)
&& child->root.u.def.section == sec
&& child->root.u.def.value == offset)
goto win;
}
bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration.
2004-08-13 05:16:01 +02:00
(*_bfd_error_handler) ("%B: %A+%lu: No symbol found for INHERIT",
abfd, sec, (unsigned long) offset);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
win:
if (!child->vtable)
{
child->vtable = ((struct elf_link_virtual_table_entry *)
bfd_zalloc (abfd, sizeof (*child->vtable)));
if (!child->vtable)
return FALSE;
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (!h)
{
/* This *should* only be the absolute section. It could potentially
be that someone has defined a non-global vtable though, which
would be bad. It isn't worth paging in the local symbols to be
sure though; that case should simply be handled by the assembler. */
child->vtable->parent = (struct elf_link_hash_entry *) -1;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
else
child->vtable->parent = h;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
/* Called from check_relocs to record the existence of a VTENTRY reloc. */
bfd_boolean
bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec ATTRIBUTE_UNUSED,
struct elf_link_hash_entry *h,
bfd_vma addend)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int log_file_align = bed->s->log_file_align;
if (!h->vtable)
{
h->vtable = ((struct elf_link_virtual_table_entry *)
bfd_zalloc (abfd, sizeof (*h->vtable)));
if (!h->vtable)
return FALSE;
}
if (addend >= h->vtable->size)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
size_t size, bytes, file_align;
bfd_boolean *ptr = h->vtable->used;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
/* While the symbol is undefined, we have to be prepared to handle
a zero size. */
file_align = 1 << log_file_align;
if (h->root.type == bfd_link_hash_undefined)
size = addend + file_align;
else
{
size = h->size;
if (addend >= size)
{
/* Oops! We've got a reference past the defined end of
the table. This is probably a bug -- shall we warn? */
size = addend + file_align;
}
}
size = (size + file_align - 1) & -file_align;
/* Allocate one extra entry for use as a "done" flag for the
consolidation pass. */
bytes = ((size >> log_file_align) + 1) * sizeof (bfd_boolean);
if (ptr)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
ptr = (bfd_boolean *) bfd_realloc (ptr - 1, bytes);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (ptr != NULL)
{
size_t oldbytes;
oldbytes = (((h->vtable->size >> log_file_align) + 1)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
* sizeof (bfd_boolean));
memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
}
}
else
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
ptr = (bfd_boolean *) bfd_zmalloc (bytes);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (ptr == NULL)
return FALSE;
/* And arrange for that done flag to be at index -1. */
h->vtable->used = ptr + 1;
h->vtable->size = size;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
h->vtable->used[addend >> log_file_align] = TRUE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
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
/* Map an ELF section header flag to its corresponding string. */
typedef struct
{
char *flag_name;
flagword flag_value;
} elf_flags_to_name_table;
static elf_flags_to_name_table elf_flags_to_names [] =
{
{ "SHF_WRITE", SHF_WRITE },
{ "SHF_ALLOC", SHF_ALLOC },
{ "SHF_EXECINSTR", SHF_EXECINSTR },
{ "SHF_MERGE", SHF_MERGE },
{ "SHF_STRINGS", SHF_STRINGS },
{ "SHF_INFO_LINK", SHF_INFO_LINK},
{ "SHF_LINK_ORDER", SHF_LINK_ORDER},
{ "SHF_OS_NONCONFORMING", SHF_OS_NONCONFORMING},
{ "SHF_GROUP", SHF_GROUP },
{ "SHF_TLS", SHF_TLS },
{ "SHF_MASKOS", SHF_MASKOS },
{ "SHF_EXCLUDE", SHF_EXCLUDE },
};
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
/* Returns TRUE if the section is to be included, otherwise FALSE. */
bfd_boolean
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
bfd_elf_lookup_section_flags (struct bfd_link_info *info,
struct flag_info *flaginfo,
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
asection *section)
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
{
const bfd_vma sh_flags = elf_section_flags (section);
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
if (!flaginfo->flags_initialized)
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
{
bfd *obfd = info->output_bfd;
const struct elf_backend_data *bed = get_elf_backend_data (obfd);
struct flag_info_list *tf = flaginfo->flag_list;
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
int with_hex = 0;
int without_hex = 0;
for (tf = flaginfo->flag_list; tf != NULL; tf = tf->next)
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
{
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
unsigned i;
flagword (*lookup) (char *);
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
lookup = bed->elf_backend_lookup_section_flags_hook;
if (lookup != NULL)
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
{
flagword hexval = (*lookup) ((char *) tf->name);
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
if (hexval != 0)
{
if (tf->with == with_flags)
with_hex |= hexval;
else if (tf->with == without_flags)
without_hex |= hexval;
tf->valid = TRUE;
continue;
}
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
}
for (i = 0; i < ARRAY_SIZE (elf_flags_to_names); ++i)
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
{
if (strcmp (tf->name, elf_flags_to_names[i].flag_name) == 0)
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
{
if (tf->with == with_flags)
with_hex |= elf_flags_to_names[i].flag_value;
else if (tf->with == without_flags)
without_hex |= elf_flags_to_names[i].flag_value;
tf->valid = TRUE;
break;
}
}
if (!tf->valid)
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
{
Remove trailing white spaces in bfd * aout0.c: Remove trailing white spaces. * archive.c: Likewise. * archures.c: Likewise. * bfd-in.h: Likewise. * bfd-in2.h: Likewise. * coff-alpha.c: Likewise. * coff-i860.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-tic80.c: Likewise. * coff-x86_64.c: Likewise. * coff-z80.c: Likewise. * coffcode.h: Likewise. * coffgen.c: Likewise. * cofflink.c: Likewise. * compress.c: Likewise. * corefile.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-crx.c: Likewise. * cpu-h8300.c: Likewise. * cpu-i386.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m68k.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-sh.c: Likewise. * cpu-xc16x.c: Likewise. * dwarf2.c: Likewise. * ecofflink.c: Likewise. * ecoffswap.h: Likewise. * elf-ifunc.c: Likewise. * elf-m10300.c: Likewise. * elf-vxworks.c: Likewise. * elf32-avr.c: Likewise. * elf32-avr.h: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i860.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.h: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-v850.c: Likewise. * elf32-xc16x.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elfcore.h: Likewise. * elflink.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * ieee.c: Likewise. * libcoff.h: Likewise. * libpei.h: Likewise. * libxcoff.h: Likewise. * linker.c: Likewise. * mach-o-i386.c: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mach-o.h: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * pe-x86_64.c: Likewise. * peXXigen.c: Likewise. * pef-traceback.h: Likewise. * pei-x86_64.c: Likewise. * peicode.h: Likewise. * plugin.c: Likewise. * reloc.c: Likewise. * riscix.c: Likewise. * section.c: Likewise. * som.c: Likewise. * syms.c: Likewise. * tekhex.c: Likewise. * ticoff.h: Likewise. * vaxbsd.c: Likewise. * xcofflink.c: Likewise. * xtensa-isa.c: Likewise.
2013-01-10 21:03:55 +01:00
info->callbacks->einfo
(_("Unrecognized INPUT_SECTION_FLAG %s\n"), tf->name);
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
return FALSE;
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
}
}
flaginfo->flags_initialized = TRUE;
flaginfo->only_with_flags |= with_hex;
flaginfo->not_with_flags |= without_hex;
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
}
if ((flaginfo->only_with_flags & sh_flags) != flaginfo->only_with_flags)
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
return FALSE;
if ((flaginfo->not_with_flags & sh_flags) != 0)
Add support for PowerPC VLE. 2012-05-14 Catherine Moore <clm@codesourcery.com> * NEWS: Mention PowerPC VLE port. 2012-05-14 James Lemke <jwlemke@codesourcery.com> Catherine Moore <clm@codesourcery.com> bfd/ * bfd.c (bfd_lookup_section_flags): Add section parm. * ecoff.c (bfd_debug_section): Remove flag_info initializer. * elf-bfd.h (bfd_elf_section_data): Move in section_flag_info. (bfd_elf_lookup_section_flags): Add section parm. * elf32-ppc.c (is_ppc_vle): New function. (ppc_elf_modify_segment_map): New function. (elf_backend_modify_segment_map): Define. (has_vle_insns): New define. * elf32-ppc.h (ppc_elf_modify_segment_map): Declare. * elflink.c (bfd_elf_lookup_section_flags): Add return value & parm. Move in logic to omit / include a section. * libbfd-in.h (bfd_link_info): Add section parm. (bfd_generic_lookup_section_flags): Likewise. * reloc.c (bfd_generic_lookup_section_flags): Likewise. * section.c (bfd_section): Move out section_flag_info. (BFD_FAKE_SECTION): Remove flag_info initializer. * targets.c (_bfd_lookup_section_flags): Add section parm. 2012-05-14 Catherine Moore <clm@codesourcery.com> bfd/ * archures.c (bfd_mach_ppc_vle): New. * bfd-in2.h: Regenerated. * cpu-powerpc.c (bfd_powerpc_archs): New entry for vle. * elf32-ppc.c (split16_format_type): New enumeration. (ppc_elf_vle_split16): New function. (HOWTO): Add entries for R_PPC_VLE relocations. (ppc_elf_reloc_type_lookup): Handle PPC_VLE relocations. (ppc_elf_section_flags): New function. (ppc_elf_lookup_section_flags): New function. (ppc_elf_section_processing): New function. (ppc_elf_check_relocs): Handle PPC_VLE relocations. (ppc_elf_relocation_section): Likewise. (elf_backend_lookup_section_flags_hook): Define. (elf_backend_section_flags): Define. (elf_backend_section_processing): Define. * elf32-ppc.h (ppc_elf_section_processing): Declare. * libbfd.h: Regenerated. * reloc.c (BFD_RELOC_PPC_VLE_REL8, BFD_RELOC_PPC_VLE_REL15, BFD_RELOC_PPC_VLE_REL24, BFD_RELOC_PPC_VLE_LO16A, BFD_RELOC_PPC_VLE_LO16D, BFD_RELOC_PPC_VLE_HI16A, BFD_RELOC_PPC_VLE_HI16D, BFD_RELOC_PPC_VLE_HA16A, BFD_RELOC_PPC_VLE_HA16D, BFD_RELOC_PPC_VLE_SDA21, BFD_RELOC_PPC_VLE_SDA21_LO, BFD_RELOC_PPC_VLE_SDAREL_LO16A, BFD_RELOC_PPC_VLE_SDAREL_LO16D, BFD_RELOC_PPC_VLE_SDAREL_HI16A, BFD_RELOC_PPC_VLE_SDAREL_HI16D, BFD_RELOC_PPC_VLE_SDAREL_HA16A, BFD_RELOC_PPC_VLE_SDAREL_HA16D): New bfd relocations. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (insn_validate): New func of existing code to call.. (ppc_setup_opcodes): ..from 2 places here. Revise for second (VLE) opcode table. Add #ifdef'd code to print opcode tables. 2012-05-14 James Lemke <jwlemke@codesourcery.com> gas/ * config/tc-ppc.c (ppc_setup_opcodes): Allow out-of-order for the VLE conditional branches. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/ * config/tc-ppc.c (PPC_VLE_SPLIT16A): New macro. (PPC_VLE_SPLIT16D): New macro. (PPC_VLE_LO16A): New macro. (PPC_VLE_LO16D): New macro. (PPC_VLE_HI16A): New macro. (PPC_VLE_HI16D): New macro. (PPC_VLE_HA16A): New macro. (PPC_VLE_HA16D): New macro. (PPC_APUINFO_VLE): New definition. (md_chars_to_number): New function. (md_parse_option): Check for combinations of little endian and -mvle. (md_show_usage): Document -mvle. (ppc_arch): Recognize VLE. (ppc_mach): Recognize bfd_mach_ppc_vle. (ppc_setup_opcodes): Print the opcode table if * config/tc-ppc.h (ppc_frag_check): Declare. * doc/c-ppc.texi: Document -mvle. * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> gas/ * config/tc-ppc.h (ppc_dw2_line_min_insn_length): Declare. (DWARF2_LINE_MIN_INSN_LENGTH): Redefine. * config/tc-ppc.c (ppc_dw2_line_min_insn_length): New. * dwarf2dbg.c (scale_addr_delta): Handle values of 1 for DWARF2_LINE_MIN_INSN_LENGTH. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> gas/testsuite/ * gas/ppc/ppc.exp: Run new tests. * gas/ppc/vle-reloc.d: New test. * gas/ppc/vle-reloc.s: New test. * gas/ppc/vle-simple-1.d: New test. * gas/ppc/vle-simple-1.s: New test. * gas/ppc/vle-simple-2.d: New test. * gas/ppc/vle-simple-2.s: New test. * gas/ppc/vle-simple-3.d: New test. * gas/ppc/vle-simple-3.s: New test. * gas/ppc/vle-simple-4.d: New test. * gas/ppc/vle-simple-4.s: New test. * gas/ppc/vle-simple-5.d: New test. * gas/ppc/vle-simple-5.s: New test. * gas/ppc/vle-simple-6.d: New test. * gas/ppc/vle-simple-6.s: New test. * gas/ppc/vle.d: New test. * gas/ppc/vle.s: New test. 2012-05-14 James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (SEC_PPC_VLE): Remove. 2012-05-14 Catherine Moore <clm@codesourcery.com> James Lemke <jwlemke@codesourcery.com> include/elf/ * ppc.h (R_PPC_VLE_REL8): New reloction. (R_PPC_VLE_REL15): Likewise. (R_PPC_VLE_REL24): Likewise. (R_PPC_VLE_LO16A): Likewise. (R_PPC_VLE_LO16D): Likewise. (R_PPC_VLE_HI16A): Likewise. (R_PPC_VLE_HI16D): Likewise. (R_PPC_VLE_HA16A): Likewise. (R_PPC_VLE_HA16D): Likewise. (R_PPC_VLE_SDA21): Likewise. (R_PPC_VLE_SDA21_LO): Likewise. (R_PPC_VLE_SDAREL_LO16A): Likewise. (R_PPC_VLE_SDAREL_LO16D): Likewise. (R_PPC_VLE_SDAREL_HI16A): Likewise. (R_PPC_VLE_SDAREL_HI16D): Likewise. (R_PPC_VLE_SDAREL_HA16A): Likewise. (R_PPC_VLE_SDAREL_HA16D): Likewise. (SEC_PPC_VLE): Remove. (PF_PPC_VLE): New program header flag. (SHF_PPC_VLE): New section header flag. (vle_opcodes, vle_num_opcodes): New. (VLE_OP): New macro. (VLE_OP_TO_SEG): New macro. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> include/opcode/ * ppc.h (PPC_OPCODE_VLE): New definition. (PPC_OP_SA): New macro. (PPC_OP_SE_VLE): New macro. (PPC_OP): Use a variable shift amount. (powerpc_operand): Update comments. (PPC_OPSHIFT_INV): New macro. (PPC_OPERAND_CR): Replace with... (PPC_OPERAND_CR_BIT): ...this and (PPC_OPERAND_CR_REG): ...this. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/ * ldlang.c (walk_wild_consider_section): Don't copy section_flag_list. Pass it to callback. (walk_wild_section_general): Pass section_flag_list to callback. (lang_add_section): Add sflag_list parm. Move out logic to keep / omit a section & call bfd_lookup_section_flags. (output_section_callback_fast): Add sflag_list parm. Add new parm to lang_add_section calls. (output_section_callback): Likewise. (check_section_callback): Add sflag_list parm. (lang_place_orphans): Add new parm to lang_add_section calls. (gc_section_callback): Add sflag_list parm. (find_relro_section_callback): Likewise. * ldlang.h (callback_t): Add flag_info parm. (lang_add_section): Add sflag_list parm. * emultempl/armelf.em (elf32_arm_add_stub_section): Add lang_add_section parm. * emultempl/beos.em (gld*_place_orphan): Likewise. * emultempl/elf32.em (gld*_place_orphan): Likewise. * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. * emultempl/mipself.em (mips_add_stub_section): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_*_place_orphan): Likewise. * emultempl/pep.em (gld_*_place_orphan): Likewise. * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. * emultempl/spuelf.em (spu_place_special_section): Likewise. * emultempl/vms.em (vms_place_orphan): Likewise. 2012-05-14 James Lemke <jwlemke@codesourcery.com> ld/testsuite/ * ld-powerpc/powerpc.exp: Create ppceabitests. * ld-powerpc/vle-multiseg.s: New. * ld-powerpc/vle-multiseg-1.d: New. * ld-powerpc/vle-multiseg-1.ld: New. * ld-powerpc/vle-multiseg-2.d: New. * ld-powerpc/vle-multiseg-2.ld: New. * ld-powerpc/vle-multiseg-3.d: New. * ld-powerpc/vle-multiseg-3.ld: New. * ld-powerpc/vle-multiseg-4.d: New. * ld-powerpc/vle-multiseg-4.ld: New. * ld-powerpc/vle-multiseg-5.d: New. * ld-powerpc/vle-multiseg-5.ld: New. * ld-powerpc/vle-multiseg-6.d: New. * ld-powerpc/vle-multiseg-6.ld: New. * ld-powerpc/vle-multiseg-6a.s: New. * ld-powerpc/vle-multiseg-6b.s: New. * ld-powerpc/vle-multiseg-6c.s: New. * ld-powerpc/vle-multiseg-6d.s: New. * ld-powerpc/powerpc.exp: Run new tests. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/ * NEWS: Mention PowerPC VLE port. 2012-05-14 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-powerpc/apuinfo.rd: Update for VLE. * ld-powerpc/vle-reloc-1.d: New. * ld-powerpc/vle-reloc-1.s: New. * ld-powerpc/vle-reloc-2.d: New. * ld-powerpc/vle-reloc-2.s: New. * ld-powerpc/vle-reloc-3.d: New. * ld-powerpc/vle-reloc-3.s: New. * ld-powerpc/vle-reloc-def-1.s: New. * ld-powerpc/vle-reloc-def-2.s: New. * ld-powerpc/vle-reloc-def-3.s: New. 2012-05-14 James Lemke <jwlemke@codesourcery.com> opcodes/ * ppc-dis.c (get_powerpc_dialect): Use is_ppc_vle. (PPC_OPCD_SEGS, VLE_OPCD_SEGS): New defines. (vle_opcd_indices): New array. (lookup_vle): New function. (disassemble_init_powerpc): Revise for second (VLE) opcode table. (print_insn_powerpc): Likewise. * ppc-opc.c: Likewise. 2012-05-14 Catherine Moore <clm@codesourcery.com> Maciej W. Rozycki <macro@codesourcery.com> Rhonda Wittels <rhonda@codesourcery.com> Nathan Froyd <froydnj@codesourcery.com> opcodes/ * ppc-opc.c (insert_arx, extract_arx): New functions. (insert_ary, extract_ary): New functions. (insert_li20, extract_li20): New functions. (insert_rx, extract_rx): New functions. (insert_ry, extract_ry): New functions. (insert_sci8, extract_sci8): New functions. (insert_sci8n, extract_sci8n): New functions. (insert_sd4h, extract_sd4h): New functions. (insert_sd4w, extract_sd4w): New functions. (insert_vlesi, extract_vlesi): New functions. (insert_vlensi, extract_vlensi): New functions. (insert_vleui, extract_vleui): New functions. (insert_vleil, extract_vleil): New functions. (BI_MASK, BB_MASK, BT): Use PPC_OPERAND_CR_BIT. (BI16, BI32, BO32, B8): New. (B15, B24, CRD32, CRS): New. (CRD, OBF, BFA, CR, CRFS): Use PPC_OPERAND_CR_REG. (DB, IMM20, RD, Rx, ARX, RY, RZ): New. (ARY, SCLSCI8, SCLSCI8N, SE_SD, SE_SDH): New. (SH6_MASK): Use PPC_OPSHIFT_INV. (SI8, UI5, OIMM5, UI7, BO16): New. (VLESIMM, VLENSIMM, VLEUIMM, VLEUIMML): New. (XT6, XA6, XB6, XB6S, XC6): Use PPC_OPSHIFT_INV. (ALLOW8_SPRG): New. (insert_sprg, extract_sprg): Check ALLOW8_SPRG. (OPVUP, OPVUP_MASK OPVUP): New (BD8, BD8_MASK, BD8IO, BD8IO_MASK): New. (EBD8IO, EBD8IO1_MASK, EBD8IO2_MASK, EBD8IO3_MASK): New. (BD15, BD15_MASK, EBD15, EBD15_MASK, EBD15BI, EBD15BI_MASK): New. (BD24,BD24_MASK, C_LK, C_LK_MASK, C, C_MASK): New. (IA16, IA16_MASK, I16A, I16A_MASK, I16L, I16L_MASK): New. (IM7, IM7_MASK, LI20, LI20_MASK, SCI8, SCI8_MASK): New. (SCI8BF, SCI8BF_MASK, SD4, SD4_MASK): New. (SE_IM5, SE_IM5_MASK): New. (SE_R, SE_R_MASK, SE_RR, SE_RR_MASK): New. (EX, EX_MASK, BO16F, BO16T, BO32F, BO32T): New. (BO32DNZ, BO32DZ): New. (NO371, PPCSPE, PPCISEL, PPCEFS, MULHW): Include PPC_OPCODE_VLE. (PPCVLE): New. (powerpc_opcodes): Add new VLE instructions. Update existing instruction to include PPCVLE if supported. * ppc-dis.c (ppc_opts): Add vle entry. (get_powerpc_dialect): New function. (powerpc_init_dialect): VLE support. (print_insn_big_powerpc): Call get_powerpc_dialect. (print_insn_little_powerpc): Likewise. (operand_value_powerpc): Handle negative shift counts. (print_insn_powerpc): Handle 2-byte instruction lengths.
2012-05-14 21:45:30 +02:00
return FALSE;
return TRUE;
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
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
struct alloc_got_off_arg {
bfd_vma gotoff;
struct bfd_link_info *info;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
};
/* We need a special top-level link routine to convert got reference counts
to real got offsets. */
static bfd_boolean
elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *arg)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct alloc_got_off_arg *gofarg = (struct alloc_got_off_arg *) arg;
bfd *obfd = gofarg->info->output_bfd;
const struct elf_backend_data *bed = get_elf_backend_data (obfd);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (h->got.refcount > 0)
{
h->got.offset = gofarg->gotoff;
gofarg->gotoff += bed->got_elt_size (obfd, gofarg->info, h, NULL, 0);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
else
h->got.offset = (bfd_vma) -1;
return TRUE;
}
/* And an accompanying bit to work out final got entry offsets once
we're done. Should be called from final_link. */
bfd_boolean
bfd_elf_gc_common_finalize_got_offsets (bfd *abfd,
struct bfd_link_info *info)
{
bfd *i;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_vma gotoff;
struct alloc_got_off_arg gofarg;
BFD_ASSERT (abfd == info->output_bfd);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (! is_elf_hash_table (info->hash))
return FALSE;
/* The GOT offset is relative to the .got section, but the GOT header is
put into the .got.plt section, if the backend uses it. */
if (bed->want_got_plt)
gotoff = 0;
else
gotoff = bed->got_header_size;
/* Do the local .got entries first. */
for (i = info->input_bfds; i; i = i->link.next)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
bfd_signed_vma *local_got;
bfd_size_type j, locsymcount;
Elf_Internal_Shdr *symtab_hdr;
if (bfd_get_flavour (i) != bfd_target_elf_flavour)
continue;
local_got = elf_local_got_refcounts (i);
if (!local_got)
continue;
symtab_hdr = &elf_tdata (i)->symtab_hdr;
if (elf_bad_symtab (i))
locsymcount = symtab_hdr->sh_size / bed->s->sizeof_sym;
else
locsymcount = symtab_hdr->sh_info;
for (j = 0; j < locsymcount; ++j)
{
if (local_got[j] > 0)
{
local_got[j] = gotoff;
gotoff += bed->got_elt_size (abfd, info, NULL, i, j);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
else
local_got[j] = (bfd_vma) -1;
}
}
/* Then the global .got entries. .plt refcounts are handled by
adjust_dynamic_symbol */
gofarg.gotoff = gotoff;
gofarg.info = info;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
elf_link_hash_traverse (elf_hash_table (info),
elf_gc_allocate_got_offsets,
&gofarg);
return TRUE;
}
/* Many folk need no more in the way of final link than this, once
got entry reference counting is enabled. */
bfd_boolean
bfd_elf_gc_common_final_link (bfd *abfd, struct bfd_link_info *info)
{
if (!bfd_elf_gc_common_finalize_got_offsets (abfd, info))
return FALSE;
/* Invoke the regular ELF backend linker to do all the work. */
return bfd_elf_final_link (abfd, info);
}
bfd_boolean
bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
{
Updated soruces in bfd/* to compile cleanly with -Wc++-compat. * bfd/aoutx.h: Add casts. * bfd/archive.c: Add casts. * bfd/archive64.c: Add casts. * bfd/archures.c: Add casts. * bfd/bfd-in2.h: Regenerated. * bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top level. * bfd/bfdio.c: Add casts. * bfd/binary.c: Add casts. * bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated parameter to use enum value instead of int. * bfd/coffcode.h: Add casts. * bfd/coffgen.c: Add casts. * bfd/cofflink.c: Add casts. * bfd/compress.c: Add casts. * bfd/dwarf1.c: Add casts. * bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to bfd_ptr. Update code to use new name. * bfd/elf-attrs.c: Add casts. * bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to anonymous struct. (union gotplt_union, struct elf_link_virtual_table_entry): Move to top level. * bfd/elf-eh-frame.c: Add casts. * bfd/elf-strtab.c: Add casts. * bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change argument name from typename to type_name. * bfd/elf32-i386.c: Add casts. * bfd/elf64-x86-64.c: Add casts. * bfd/elfcode.h: Add casts. * bfd/elfcore.h: Add casts. * bfd/elflink.c: Add casts. * bfd/format.c: Add casts. * bfd/hash.c: Add casts. * bfd/ihex.c: Add casts. * bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to top level. * bfd/libbfd.c: Add casts. * bfd/linker.c: Add casts. * bfd/merge.c: Add casts. * bfd/opncls.c: Add casts. * bfd/peXXigen.c: Add casts. * bfd/peicode.h: Add casts. * bfd/reloc.c: Add casts. * bfd/section.c: Add casts. * bfd/simple.c: Add casts. * bfd/srec.c: Add casts. * bfd/stabs.c: Add casts. * bfd/syms.c: Add casts. * bfd/targets.c: Add casts. * bfd/tekhex.c: Add casts. * bfd/verilog.c: Add casts. * include/bfdlink.h (struct bfd_link_hash_common_entry): Move to top level.
2009-09-09 23:38:59 +02:00
struct elf_reloc_cookie *rcookie = (struct elf_reloc_cookie *) cookie;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (rcookie->bad_symtab)
rcookie->rel = rcookie->rels;
for (; rcookie->rel < rcookie->relend; rcookie->rel++)
{
unsigned long r_symndx;
if (! rcookie->bad_symtab)
if (rcookie->rel->r_offset > offset)
return FALSE;
if (rcookie->rel->r_offset != offset)
continue;
r_symndx = rcookie->rel->r_info >> rcookie->r_sym_shift;
if (r_symndx == STN_UNDEF)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
if (r_symndx >= rcookie->locsymcount
|| ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL)
{
struct elf_link_hash_entry *h;
h = rcookie->sym_hashes[r_symndx - rcookie->extsymoff];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& (h->root.u.def.section->owner != rcookie->abfd
|| h->root.u.def.section->kept_section != NULL
|| discarded_section (h->root.u.def.section)))
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return TRUE;
}
else
{
/* It's not a relocation against a global symbol,
but it could be a relocation against a local
symbol for a discarded section. */
asection *isec;
Elf_Internal_Sym *isym;
/* Need to: get the symbol; get the section. */
isym = &rcookie->locsyms[r_symndx];
isec = bfd_section_from_elf_index (rcookie->abfd, isym->st_shndx);
if (isec != NULL
&& (isec->kept_section != NULL
|| discarded_section (isec)))
return TRUE;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
return FALSE;
}
return FALSE;
}
/* Discard unneeded references to discarded sections.
Returns -1 on error, 1 if any section's size was changed, 0 if
nothing changed. This function assumes that the relocations are in
sorted order, which is true for all known assemblers. */
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
int
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
{
struct elf_reloc_cookie cookie;
asection *o;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd *abfd;
int changed = 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (info->traditional_format
|| !is_elf_hash_table (info->hash))
return 0;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
o = bfd_get_section_by_name (output_bfd, ".stab");
if (o != NULL)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
asection *i;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (i = o->map_head.s; i != NULL; i = i->map_head.s)
{
if (i->size == 0
|| i->reloc_count == 0
|| i->sec_info_type != SEC_INFO_TYPE_STABS)
continue;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
abfd = i->owner;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
continue;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (!init_reloc_cookie_for_section (&cookie, info, i))
return -1;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (_bfd_discard_section_stabs (abfd, i,
elf_section_data (i)->sec_info,
bfd_elf_reloc_symbol_deleted_p,
&cookie))
changed = 1;
fini_reloc_cookie_for_section (&cookie, i);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
o = NULL;
if (info->eh_frame_hdr_type != COMPACT_EH_HDR)
o = bfd_get_section_by_name (output_bfd, ".eh_frame");
if (o != NULL)
{
asection *i;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (i = o->map_head.s; i != NULL; i = i->map_head.s)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
{
if (i->size == 0)
continue;
abfd = i->owner;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
continue;
if (!init_reloc_cookie_for_section (&cookie, info, i))
return -1;
_bfd_elf_parse_eh_frame (abfd, info, i, &cookie);
if (_bfd_elf_discard_section_eh_frame (abfd, info, i,
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
bfd_elf_reloc_symbol_deleted_p,
&cookie))
changed = 1;
fini_reloc_cookie_for_section (&cookie, i);
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
{
const struct elf_backend_data *bed;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
continue;
bed = get_elf_backend_data (abfd);
if (bed->elf_backend_discard_info != NULL)
{
if (!init_reloc_cookie (&cookie, info, abfd))
return -1;
if ((*bed->elf_backend_discard_info) (abfd, &cookie, info))
changed = 1;
fini_reloc_cookie (&cookie, abfd);
}
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
Compact EH Support The specification for the Compact EH format is available at: https://github.com/MentorEmbedded/cxx-abi/blob/master/MIPSCompactEH.pdf 2015-05-28 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> Paul Brook <paul@codesourcery.com> bfd/ * bfd-in2.h: Regenerated. * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define. (COMPACT_EH_CANT_UNWIND_OPCODE): Define. (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from eh_frame_hdr_info. (compact_eh_frame_hdr_info): Declare. (eh_frame_hdr_info): Redeclare with union for dwarf-specific fields and compact-eh fields. (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding. (bfd_elf_section_data): Add eh_frame_entry_field. (elf_section_eh_frame_entry): Define. (bfd_elf_parse_eh_frame_entries): Declare. (_bfd_elf_parse_eh_frame_entry): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. (_bfd_elf_write_section_eh_frame_entry): Declare. (_bfd_elf_eh_frame_entry_present): Declare. (_bfd_elf_section_for_symbol): Declare. * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function. (bfd_elf_record_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame_entry): New function. (_bfd_elf_parse_eh_frame): Update hdr_info field references. (cmp_eh_frame_hdr): New function. (add_eh_frame_hdr_terminator): New function. (_bfd_elf_end_eh_frame_parsing): New function. (find_merged_cie): Update hdr_info field references. (_bfd_elf_discard_section_eh_frame): Likewise. (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support. (_bfd_elf_eh_frame_entry_present): New function. (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support. (_bfd_elf_write_section_eh_frame_entry): New function. (_bfd_elf_write_section_eh_frame): Update hdr_info field references. (_bfd_elf_fixup_eh_frame_hdr): New function. (write_compact_eh_frame_hdr): New function. (write_dwarf_eh_frame_hdr): New function. (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support. * elflink.c (_bfd_elf_section_for_symbol): New function. (elf_section_ignore_discarded_relocs): Add Compact EH support. (elf_link_input_bfd): Likewise. (bfd_elf_final_link): Likewise. (_bfd_elf_gc_mark): Likewise. (bfd_elf_parse_eh_frame_entries): New function. (bfd_elf_gc_sections): Add Compact EH support. (bfd_elf_discard_info): Likewise. * elfxx-mips.c: Include dwarf2.h. (_bfd_mips_elf_compact_eh_encoding): New function. (_bfd_mips_elf_cant_unwind_opcode): New function. * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare. (_bfd_mips_elf_cant_unwind_opcode): Declare. (elf_backend_compact_eh_encoding): Define. (elf_backend_cant_unwind_opcode): Define. * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default. (elf_backend_cant_unwind_opcode): Provide default. (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and elf_backend_cant_unwind_opcode. * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition. gas/ * config/tc-alpha.c (all_cfi_sections): Declare. (s_alpha_ent): Initialize all_cfi_sections. (alpha_elf_md_end): Invoke cfi_set_sections. * config/tc-mips.c (md_apply_fix): Handle BFD_RELOC_NONE. (s_ehword): Use BFD_RELOC_32_PCREL. (mips_fix_adjustable): Handle BFD_RELOC_32_PCREL. (mips_cfi_reloc_for_encoding): New function. * tc-mips.h (DWARF2_FDE_RELOC_SIZE): Redefine. (DWARF2_FDE_RELOC_ENCODING): Define. (tc_cfi_reloc_for_encoding): Define. (mips_cfi_reloc_for_encoding): Define. (tc_compact_eh_opcode_stop): Define. (tc_compact_eh_opcode_pad): Define. * doc/as.texinfo: Document Compact EH extensions. * doc/internals.texi: Likewise. * dw2gencfi.c (EH_FRAME_LINKONCE): Redefine. (tc_cfi_reloc_for_encoding): Provide default. (compact_eh): Declare. (emit_expr_encoded): New function. (get_debugseg_name): Add Compact EH support. (alloc_debugseg_item): Likewise. (cfi_set_sections): New function. (dot_cfi_fde_data): New function. (dot_cfi_personality_id): New function. (dot_cfi_inline_lsda): New function. (cfi_pseudo_table): Add cfi_fde_data, cfi_personality_id, and cfi_inline_lsda. (dot_cfi_personality): Add Compact EH support. (dot_cfi_lsda): Likewise. (dot_cfi_sections): Likewise. (dot_cfi_startproc): Likewise. (get_cfi_seg): Likewise. (output_compact_unwind_data): New function. (output_cfi_insn): Add Compact EH support. (output_cie): Likewise. (output_fde): Likewise. (cfi_finish): Likewise. (cfi_emit_eh_header): New function. (output_eh_header): New function. * dw2gencfi.h (cfi_set_sections): Declare. (SUPPORT_COMPACT_EH): Define. (MULTIPLE_FRAME_SECTIONS): Define. New enumeration to describe the Compact EH header format. (fde_entry): Add new fields personality_id, eh_header_type, eh_data_size, eh_data, eh_loc and sections. (CFI_EMIT_eh_frame, CFI_EMIT_debug_frame, CFI_EMIT_target, CFI_EMIT_eh_frame_compact): Define. 2015-05-22 Catherine Moore <clm@codesourcery.com> Bernd Schmidt <bernds@codesourcery.com> gas/testsuite/ * gas/mips/mips.exp: Run new tests. * gas/mips/compact-eh-1.s: New file. * gas/mips/compact-eh-2.s: New file. * gas/mips/compact-eh-3.s: New file. * gas/mips/compact-eh-4.s: New file. * gas/mips/compact-eh-5.s: New file. * gas/mips/compact-eh-6.s: New file. * gas/mips/compact-eh-7.s: New file. * gas/mips/compact-eh-eb-1.d: New file. * gas/mips/compact-eh-eb-2.d: New file. * gas/mips/compact-eh-eb-3.d: New file. * gas/mips/compact-eh-eb-4.d: New file. * gas/mips/compact-eh-eb-5.d: New file. * gas/mips/compact-eh-eb-6.d: New file. * gas/mips/compact-eh-eb-7.d: New file. * gas/mips/compact-eh-el-1.d: New file. * gas/mips/compact-eh-el-2.d: New file. * gas/mips/compact-eh-el-3.d: New file. * gas/mips/compact-eh-el-4.d: New file. * gas/mips/compact-eh-el-5.d: New file. * gas/mips/compact-eh-el-6.d: New file. * gas/mips/compact-eh-el-7.d: New file. * gas/mips/compact-eh-err1.l: New file. * gas/mips/compact-eh-err1.s: New file. * gas/mips/compact-eh-err2.l: New file. * gas/mips/compact-eh-err2.s: New file. 2015-05-22 Catherine Moore <clm@codesourcery.com> include/ * bfdlink.h: Rename eh_frame_hdr to eh_frame_hdr_type. 2015-05-22 Catherine Moore <clm@codesourcery.com> Paul Brook <paul@codesourcery.com> ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Add Compact EH support. * scripttempl/elf.sc: Handle .eh_frame_entry and .gnu_extab sections. 2015-05-22 Catherine Moore <clm@codesourcery.com> ld/testsuite/ * ld-mips-elf/compact-eh.ld: New linker script. * ld-mips-elf/compact-eh1.d: New. * ld-mips-elf/compact-eh1.s: New. * ld-mips-elf/compact-eh1a.s: New. * ld-mips-elf/compact-eh1b.s: New. * ld-mips-elf/compact-eh2.d: New. * ld-mips-elf/compact-eh2.s: New. * ld-mips-elf/compact-eh3.d: New. * ld-mips-elf/compact-eh3.s: New. * ld-mips-elf/compact-eh3a.s: New. * ld-mips-elf/compact-eh4.d: New. * ld-mips-elf/compact-eh5.d: New. * ld-mips-elf/compact-eh6.d: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-05-28 23:50:36 +02:00
if (info->eh_frame_hdr_type == COMPACT_EH_HDR)
_bfd_elf_end_eh_frame_parsing (info);
if (info->eh_frame_hdr_type
Add output_type to bfd_link_info The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
2015-08-18 14:51:03 +02:00
&& !bfd_link_relocatable (info)
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
&& _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info))
changed = 1;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
return changed;
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 11:58:09 +01:00
}
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
bfd_boolean
_bfd_elf_section_already_linked (bfd *abfd,
asection *sec,
2006-10-31 00:25:51 +01:00
struct bfd_link_info *info)
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
{
flagword flags;
const char *name, *key;
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
struct bfd_section_already_linked *l;
struct bfd_section_already_linked_hash_entry *already_linked_list;
if (sec->output_section == bfd_abs_section_ptr)
return FALSE;
flags = sec->flags;
/* Return if it isn't a linkonce section. A comdat group section
also has SEC_LINK_ONCE set. */
if ((flags & SEC_LINK_ONCE) == 0)
return FALSE;
/* Don't put group member sections on our list of already linked
sections. They are handled as a group via their group section. */
if (elf_sec_group (sec) != NULL)
return FALSE;
/* For a SHT_GROUP section, use the group signature as the key. */
name = sec->name;
if ((flags & SEC_GROUP) != 0
&& elf_next_in_group (sec) != NULL
&& elf_group_name (elf_next_in_group (sec)) != NULL)
key = elf_group_name (elf_next_in_group (sec));
else
{
/* Otherwise we should have a .gnu.linkonce.<type>.<key> section. */
if (CONST_STRNEQ (name, ".gnu.linkonce.")
&& (key = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL)
key++;
else
/* Must be a user linkonce section that doesn't follow gcc's
naming convention. In this case we won't be matching
single member groups. */
key = name;
}
already_linked_list = bfd_section_already_linked_table_lookup (key);
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
for (l = already_linked_list->entry; l != NULL; l = l->next)
{
/* We may have 2 different types of sections on the list: group
sections with a signature of <key> (<key> is some string),
and linkonce sections named .gnu.linkonce.<type>.<key>.
Match like sections. LTO plugin sections are an exception.
They are always named .gnu.linkonce.t.<key> and match either
type of section. */
if (((flags & SEC_GROUP) == (l->sec->flags & SEC_GROUP)
&& ((flags & SEC_GROUP) != 0
|| strcmp (name, l->sec->name) == 0))
|| (l->sec->owner->flags & BFD_PLUGIN) != 0)
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
{
/* The section has already been linked. See if we should
issue a warning. */
if (!_bfd_handle_already_linked (sec, l, info))
return FALSE;
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
if (flags & SEC_GROUP)
{
asection *first = elf_next_in_group (sec);
asection *s = first;
while (s != NULL)
{
s->output_section = bfd_abs_section_ptr;
/* Record which group discards it. */
s->kept_section = l->sec;
s = elf_next_in_group (s);
/* These lists are circular. */
if (s == first)
break;
}
}
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
return TRUE;
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
}
}
/* A single member comdat group section may be discarded by a
linkonce section and vice versa. */
if ((flags & SEC_GROUP) != 0)
{
asection *first = elf_next_in_group (sec);
if (first != NULL && elf_next_in_group (first) == first)
/* Check this single member group against linkonce sections. */
for (l = already_linked_list->entry; l != NULL; l = l->next)
if ((l->sec->flags & SEC_GROUP) == 0
&& bfd_elf_match_symbols_in_sections (l->sec, first, info))
{
first->output_section = bfd_abs_section_ptr;
first->kept_section = l->sec;
sec->output_section = bfd_abs_section_ptr;
break;
}
}
else
/* Check this linkonce section against single member groups. */
for (l = already_linked_list->entry; l != NULL; l = l->next)
if (l->sec->flags & SEC_GROUP)
{
asection *first = elf_next_in_group (l->sec);
if (first != NULL
&& elf_next_in_group (first) == first
&& bfd_elf_match_symbols_in_sections (first, sec, info))
{
sec->output_section = bfd_abs_section_ptr;
sec->kept_section = first;
break;
}
}
/* Do not complain on unresolved relocations in `.gnu.linkonce.r.F'
referencing its discarded `.gnu.linkonce.t.F' counterpart - g++-3.4
specific as g++-4.x is using COMDAT groups (without the `.gnu.linkonce'
prefix) instead. `.gnu.linkonce.r.*' were the `.rodata' part of its
matching `.gnu.linkonce.t.*'. If `.gnu.linkonce.r.F' is not discarded
but its `.gnu.linkonce.t.F' is discarded means we chose one-only
`.gnu.linkonce.t.F' section from a different bfd not requiring any
`.gnu.linkonce.r.F'. Thus `.gnu.linkonce.r.F' should be discarded.
The reverse order cannot happen as there is never a bfd with only the
`.gnu.linkonce.r.F' section. The order of sections in a bfd does not
matter as here were are looking only for cross-bfd sections. */
if ((flags & SEC_GROUP) == 0 && CONST_STRNEQ (name, ".gnu.linkonce.r."))
for (l = already_linked_list->entry; l != NULL; l = l->next)
if ((l->sec->flags & SEC_GROUP) == 0
&& CONST_STRNEQ (l->sec->name, ".gnu.linkonce.t."))
{
if (abfd != l->sec->owner)
sec->output_section = bfd_abs_section_ptr;
break;
}
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
/* This is the first section with this name. Record it. */
if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
info->callbacks->einfo (_("%F%P: already_linked_table: %E\n"));
return sec->output_section == bfd_abs_section_ptr;
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
}
bfd_boolean
_bfd_elf_common_definition (Elf_Internal_Sym *sym)
{
return sym->st_shndx == SHN_COMMON;
}
unsigned int
_bfd_elf_common_section_index (asection *sec ATTRIBUTE_UNUSED)
{
return SHN_COMMON;
}
asection *
_bfd_elf_common_section (asection *sec ATTRIBUTE_UNUSED)
{
return bfd_com_section_ptr;
}
bfd_vma
_bfd_elf_default_got_elt_size (bfd *abfd,
struct bfd_link_info *info ATTRIBUTE_UNUSED,
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED,
bfd *ibfd ATTRIBUTE_UNUSED,
unsigned long symndx ATTRIBUTE_UNUSED)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
return bed->s->arch_size / 8;
}
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
/* Routines to support the creation of dynamic relocs. */
/* Returns the name of the dynamic reloc section associated with SEC. */
static const char *
get_dynamic_reloc_section_name (bfd * abfd,
asection * sec,
bfd_boolean is_rela)
{
char *name;
const char *old_name = bfd_get_section_name (NULL, sec);
const char *prefix = is_rela ? ".rela" : ".rel";
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
if (old_name == NULL)
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
return NULL;
name = bfd_alloc (abfd, strlen (prefix) + strlen (old_name) + 1);
Remove trailing white spaces in bfd * aout0.c: Remove trailing white spaces. * archive.c: Likewise. * archures.c: Likewise. * bfd-in.h: Likewise. * bfd-in2.h: Likewise. * coff-alpha.c: Likewise. * coff-i860.c: Likewise. * coff-mips.c: Likewise. * coff-ppc.c: Likewise. * coff-tic80.c: Likewise. * coff-x86_64.c: Likewise. * coff-z80.c: Likewise. * coffcode.h: Likewise. * coffgen.c: Likewise. * cofflink.c: Likewise. * compress.c: Likewise. * corefile.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-crx.c: Likewise. * cpu-h8300.c: Likewise. * cpu-i386.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m68k.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-sh.c: Likewise. * cpu-xc16x.c: Likewise. * dwarf2.c: Likewise. * ecofflink.c: Likewise. * ecoffswap.h: Likewise. * elf-ifunc.c: Likewise. * elf-m10300.c: Likewise. * elf-vxworks.c: Likewise. * elf32-avr.c: Likewise. * elf32-avr.h: Likewise. * elf32-cr16.c: Likewise. * elf32-cr16c.c: Likewise. * elf32-cris.c: Likewise. * elf32-crx.c: Likewise. * elf32-frv.c: Likewise. * elf32-hppa.c: Likewise. * elf32-i860.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-iq2000.c: Likewise. * elf32-m32c.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-msp430.c: Likewise. * elf32-mt.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-s390.c: Likewise. * elf32-score.h: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Likewise. * elf32-spu.c: Likewise. * elf32-tic6x.c: Likewise. * elf32-v850.c: Likewise. * elf32-xc16x.c: Likewise. * elf32-xtensa.c: Likewise. * elf64-alpha.c: Likewise. * elf64-hppa.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elfcore.h: Likewise. * elflink.c: Likewise. * elfxx-mips.c: Likewise. * elfxx-sparc.c: Likewise. * elfxx-tilegx.c: Likewise. * ieee.c: Likewise. * libcoff.h: Likewise. * libpei.h: Likewise. * libxcoff.h: Likewise. * linker.c: Likewise. * mach-o-i386.c: Likewise. * mach-o-target.c: Likewise. * mach-o.c: Likewise. * mach-o.h: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pdp11.c: Likewise. * pe-x86_64.c: Likewise. * peXXigen.c: Likewise. * pef-traceback.h: Likewise. * pei-x86_64.c: Likewise. * peicode.h: Likewise. * plugin.c: Likewise. * reloc.c: Likewise. * riscix.c: Likewise. * section.c: Likewise. * som.c: Likewise. * syms.c: Likewise. * tekhex.c: Likewise. * ticoff.h: Likewise. * vaxbsd.c: Likewise. * xcofflink.c: Likewise. * xtensa-isa.c: Likewise.
2013-01-10 21:03:55 +01:00
sprintf (name, "%s%s", prefix, old_name);
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
return name;
}
/* Returns the dynamic reloc section associated with SEC.
If necessary compute the name of the dynamic reloc section based
on SEC's name (looked up in ABFD's string table) and the setting
of IS_RELA. */
asection *
_bfd_elf_get_dynamic_reloc_section (bfd * abfd,
asection * sec,
bfd_boolean is_rela)
{
asection * reloc_sec = elf_section_data (sec)->sreloc;
if (reloc_sec == NULL)
{
const char * name = get_dynamic_reloc_section_name (abfd, sec, is_rela);
if (name != NULL)
{
2012-06-29 16:46:03 +02:00
reloc_sec = bfd_get_linker_section (abfd, name);
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
if (reloc_sec != NULL)
elf_section_data (sec)->sreloc = reloc_sec;
}
}
return reloc_sec;
}
/* Returns the dynamic reloc section associated with SEC. If the
section does not exist it is created and attached to the DYNOBJ
bfd and stored in the SRELOC field of SEC's elf_section_data
structure.
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
ALIGNMENT is the alignment for the newly created section and
IS_RELA defines whether the name should be .rela.<SEC's name>
or .rel.<SEC's name>. The section name is looked up in the
string table associated with ABFD. */
asection *
_bfd_elf_make_dynamic_reloc_section (asection *sec,
bfd *dynobj,
unsigned int alignment,
bfd *abfd,
bfd_boolean is_rela)
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
{
asection * reloc_sec = elf_section_data (sec)->sreloc;
if (reloc_sec == NULL)
{
const char * name = get_dynamic_reloc_section_name (abfd, sec, is_rela);
if (name == NULL)
return NULL;
2012-06-29 16:46:03 +02:00
reloc_sec = bfd_get_linker_section (dynobj, name);
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
if (reloc_sec == NULL)
{
2012-06-29 16:46:03 +02:00
flagword flags = (SEC_HAS_CONTENTS | SEC_READONLY
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
if ((sec->flags & SEC_ALLOC) != 0)
flags |= SEC_ALLOC | SEC_LOAD;
2012-06-29 16:46:03 +02:00
reloc_sec = bfd_make_section_anyway_with_flags (dynobj, name, flags);
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
if (reloc_sec != NULL)
{
/* _bfd_elf_get_sec_type_attr chooses a section type by
name. Override as it may be wrong, eg. for a user
section named "auto" we'll get ".relauto" which is
seen to be a .rela section. */
elf_section_type (reloc_sec) = is_rela ? SHT_RELA : SHT_REL;
* elflink.c (is_reloc_section): New function. Returns true if the given name matches the name of the reloc-containing section associated with the given section. (get_dynamic_reloc_section_name): New function. Computes the name of the section that contains the dynamic relocs associated with the given section. (_bfd_elf_get_dynamic_reloc_section): New function. Returns a pointer to the section containing the dynamic relocs associated with the given section. (_bfd_elf_make_dynamic_reloc_section): New function. Creates a section to contain the dynamic relocs associated with a given section. * elf-bfd.h: Prototype the new functions. * elf-m10300.c (mn10300_elf_check_relocs): Use new functions. (mn10300_elf_final_link_relocs): Likewise. * elf32-arm.c (reloc_section_p): Delete - replaced by new functions. (elf32_arm_final_link_relocate): Use new functions. (elf32_arm_check_relocs): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. (elf_cris_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i370.c (i370_elf_check_relocs): Likewise. (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32_ppc.c (ppc_elf_check_relocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Remove redundant local variable 'sreloc'. (bfin_relocate_section): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise.
2008-11-25 14:03:56 +01:00
if (! bfd_set_section_alignment (dynobj, reloc_sec, alignment))
reloc_sec = NULL;
}
}
elf_section_data (sec)->sreloc = reloc_sec;
}
return reloc_sec;
}
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
/* Copy the ELF symbol type and other attributes for a linker script
assignment from HSRC to HDEST. Generally this should be treated as
if we found a strong non-dynamic definition for HDEST (except that
ld ignores multiple definition errors). */
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
void
_bfd_elf_copy_link_hash_symbol_type (bfd *abfd,
struct bfd_link_hash_entry *hdest,
struct bfd_link_hash_entry *hsrc)
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
{
struct elf_link_hash_entry *ehdest = (struct elf_link_hash_entry *) hdest;
struct elf_link_hash_entry *ehsrc = (struct elf_link_hash_entry *) hsrc;
Elf_Internal_Sym isym;
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
ehdest->type = ehsrc->type;
include/elf/ * internal.h (elf_internal_sym): Add st_target_internal. * arm.h (arm_st_branch_type): New enum. (ARM_SYM_BRANCH_TYPE): New macro. bfd/ * elf-bfd.h (elf_link_hash_entry): Add target_internal. * elf.c (swap_out_syms): Set st_target_internal for each Elf_Internal_Sym. * elfcode.h (elf_swap_symbol_in): Likewise. * elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise. * elf32-sh-symbian.c (sh_symbian_relocate_section): Likewise. * elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elflink.c (elf_link_output_extsym): Likewise. (bfd_elf_final_link): Likewise. (elf_link_add_object_symbols): Copy st_target_internal to the hash table if we see a definition. (_bfd_elf_copy_link_hash_symbol_type): Copy target_internal. * elf32-arm.c (elf32_arm_stub_hash_entry): Replace st_type with a branch_type field. (a8_erratum_fix, a8_erratum_reloc): Likewise. (arm_type_of_stub): Replace actual_st_type with an actual_branch_type parameter. (arm_build_one_stub): Use branch types rather than st_types to determine the type of branch. (cortex_a8_erratum_scan): Likewise. (elf32_arm_size_stubs): Likewise. (bfd_elf32_arm_process_before_allocation): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_finish_dynamic_sections): Likewise. (elf32_arm_final_link_relocate): Replace sym_flags parameter with a branch_type parameter. (elf32_arm_relocate_section): Update call accordingly. (elf32_arm_adjust_dynamic_symbol): Don't check STT_ARM_TFUNC. (elf32_arm_output_map_sym): Initialize st_target_internal. (elf32_arm_output_stub_sym): Likewise. (elf32_arm_symbol_processing): Delete. (elf32_arm_swap_symbol_in): Convert STT_ARM_TFUNCs into STT_FUNCs. Use st_target_internal to record the branch type. (elf32_arm_swap_symbol_out): Use st_target_internal to test for Thumb functions. (elf32_arm_is_function_type): Delete. (elf_backend_symbol_processing): Likewise. (elf_backend_is_function_type): Likewise. gas/ * config/tc-arm.c (arm_adjust_symtab): Set the branch type for Thumb symbols. ld/ * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Check eh->target_internal. opcodes/ * arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC. Use branch types instead. (print_insn): Likewise.
2011-03-14 16:55:04 +01:00
ehdest->target_internal = ehsrc->target_internal;
isym.st_other = ehsrc->other;
elf_merge_st_other (abfd, ehdest, &isym, NULL, TRUE, FALSE);
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
}
Add x86-64 ILP32 support. bfd/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * archures.c (bfd_mach_x64_32): New. (bfd_mach_x64_32_intel_syntax): Likewise. * bfd-in2.h: Regenerated. * config.bfd (targ64_selvecs): Add bfd_elf32_x86_64_vec for i[3-7]86-*-linux-*. (targ_selvecs): Add bfd_elf32_x86_64_vec for x86_64-*-linux-*. * configure.in: Support bfd_elf32_x86_64_vec. * configure: Regenerated. * cpu-i386.c (bfd_x64_32_arch_intel_syntax): New. (bfd_x64_32_arch): Likewise. * elf-bfd.h (elf_append_rela): New prototype. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * elf64-x86-64.c (ABI_64_P): New. (elf_x86_64_info_to_howto): Replace ELF64_R_TYPE with ELF32_R_TYPE. Replace ELF64_ST_TYPE with ELF_ST_TYPE. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_reloc_type_class): Likewise. (ELF_DYNAMIC_INTERPRETER): Renamed to ... (ELF64_DYNAMIC_INTERPRETER): This. (ELF32_DYNAMIC_INTERPRETER): New. (elf_x86_64_link_hash_table): Add r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_get_local_sym_hash): Replace ELF64_R_SYM with htab->r_sym. Replace ELF64_R_INFO with htab->r_info. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_local_dynamic_symbol): Likewise. (elf_x86_64_link_hash_table_create): Initialize r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_check_relocs): Check ABI_64_P when requesting for PIC. (elf_x86_64_relocate_section): Likewise. (elf64_x86_64_adjust_dynamic_symbol): Replace sizeof (Elf64_External_Rela) with bed->s->sizeof_rela. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_append_rela): Removed. (elf32_x86_64_elf_object_p): New. Add bfd_elf32_x86_64_vec. * elf64-x86-64.c (elf64_x86_64_xxx): Renamed to ... (elf_x86_64_xxx): This. * elflink.c (bfd_elf_final_link): Check ELF file class on error. (elf_append_rela): New. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * targets.c (bfd_elf32_x86_64_vec): New. (_bfd_target_vector): Add bfd_elf32_x86_64_vec. gas/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (x86_elf_abi): New. (i386_mach): Return bfd_mach_x64_32 for ILP32. (OPTION_N32): Likewise. (md_longopts): Add "n32" for ELF. (md_parse_option): Handle OPTION_N32. (md_show_usage): Add --n32. (i386_target_format): Update and check x86_elf_abi. * config/tc-i386.h (ELF_TARGET_FORMAT32): New. * doc/as.texinfo: Document --n32. * doc/c-i386.texi: Likewise. gas/testsuite/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/ilp32/lns/ilp32.exp: New. * gas/i386/ilp32/lns/lns-common-1.d: Likewise. * gas/i386/ilp32/lns/lns-duplicate.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-1.d: New. * gas/i386/ilp32/cfi/cfi-common-2.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-3.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-4.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-5.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-6.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-7.d: Likewise. * gas/i386/ilp32/cfi/cfi-x86_64.d: Likewise. * gas/i386/ilp32/cfi/ilp32.exp: Likewise. * gas/i386/ilp32/elf/ehopt0.d: Likewise. * gas/i386/ilp32/elf/equ-reloc.d: Likewise. * gas/i386/ilp32/elf/file.d: Likewise. * gas/i386/ilp32/elf/group0a.d: Likewise. * gas/i386/ilp32/elf/group0b.d: Likewise. * gas/i386/ilp32/elf/group1a.d: Likewise. * gas/i386/ilp32/elf/group1b.d: Likewise. * gas/i386/ilp32/elf/ifunc-1.d: Likewise. * gas/i386/ilp32/elf/ilp32.exp: Likewise. * gas/i386/ilp32/elf/redef.d: Likewise. * gas/i386/ilp32/elf/section0.d: Likewise. * gas/i386/ilp32/elf/section1.d: Likewise. * gas/i386/ilp32/elf/section3.d: Likewise. * gas/i386/ilp32/elf/section4.d: Likewise. * gas/i386/ilp32/elf/section6.d: Likewise. * gas/i386/ilp32/elf/section7.d: Likewise. * gas/i386/ilp32/elf/struct.d: Likewise. * gas/i386/ilp32/elf/symtab.d: Likewise. * gas/i386/ilp32/elf/symver.d: Likewise. * gas/i386/ilp32/ilp32.exp: New. * gas/i386/ilp32/immed64.d: Likewise. * gas/i386/ilp32/mixed-mode-reloc64.d: Likewise. * gas/i386/ilp32/reloc64.d: Likewise. * gas/i386/ilp32/rex.d: Likewise. * gas/i386/ilp32/rexw.d: Likewise. * gas/i386/ilp32/svme64.d: Likewise. * gas/i386/ilp32/x86-64-addr32.d: Likewise. * gas/i386/ilp32/x86-64-addr32-intel.d: Likewise. * gas/i386/ilp32/x86-64-aes.d: Likewise. * gas/i386/ilp32/x86-64-aes-intel.d: Likewise. * gas/i386/ilp32/x86-64-amdfam10.d: Likewise. * gas/i386/ilp32/x86-64-arch-1.d: Likewise. * gas/i386/ilp32/x86-64-arch-2.d: Likewise. * gas/i386/ilp32/x86-64-avx.d: Likewise. * gas/i386/ilp32/x86-64-avx-intel.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap-intel.d: Likewise. * gas/i386/ilp32/x86-64-branch.d: Likewise. * gas/i386/ilp32/x86-64-cbw.d: Likewise. * gas/i386/ilp32/x86-64-cbw-intel.d: Likewise. * gas/i386/ilp32/x86-64-clmul.d: Likewise. * gas/i386/ilp32/x86-64-clmul-intel.d: Likewise. * gas/i386/ilp32/x86-64-crc32.d: Likewise. * gas/i386/ilp32/x86-64-crc32-intel.d: Likewise. * gas/i386/ilp32/x86-64-crx.d: Likewise. * gas/i386/ilp32/x86-64-crx-suffix.d: Likewise. * gas/i386/ilp32/x86-64.d: Likewise. * gas/i386/ilp32/x86-64-disp.d: Likewise. * gas/i386/ilp32/x86-64-disp-intel.d: Likewise. * gas/i386/ilp32/x86-64-drx.d: Likewise. * gas/i386/ilp32/x86-64-drx-suffix.d: Likewise. * gas/i386/ilp32/x86-64-ept.d: Likewise. * gas/i386/ilp32/x86-64-ept-intel.d: Likewise. * gas/i386/ilp32/x86-64-fma4.d: Likewise. * gas/i386/ilp32/x86-64-fma.d: Likewise. * gas/i386/ilp32/x86-64-fma-intel.d: Likewise. * gas/i386/ilp32/x86-64-gidt.d: Likewise. * gas/i386/ilp32/x86-64-ifunc.d: Likewise. * gas/i386/ilp32/x86-64-intel64.d: Likewise. * gas/i386/ilp32/x86-64-io.d: Likewise. * gas/i386/ilp32/x86-64-io-intel.d: Likewise. * gas/i386/ilp32/x86-64-io-suffix.d: Likewise. * gas/i386/ilp32/x86-64-localpic.d: Likewise. * gas/i386/ilp32/x86-64-mem.d: Likewise. * gas/i386/ilp32/x86-64-mem-intel.d: Likewise. * gas/i386/ilp32/x86-64-movbe.d: Likewise. * gas/i386/ilp32/x86-64-movbe-intel.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-1.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise. * gas/i386/ilp32/x86-64-nops-2.d: Likewise. * gas/i386/ilp32/x86-64-nops-3.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-4.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-5.d: Likewise. * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops.d: Likewise. * gas/i386/ilp32/x86-64-opcode.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/ilp32/x86-64-opts.d: Likewise. * gas/i386/ilp32/x86-64-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-pcrel.d: Likewise. * gas/i386/ilp32/x86-64-reg.d: Likewise. * gas/i386/ilp32/x86-64-reg-intel.d: Likewise. * gas/i386/ilp32/x86-64-rep.d: Likewise. * gas/i386/ilp32/x86-64-rep-suffix.d: Likewise. * gas/i386/ilp32/x86-64-rip.d: Likewise. * gas/i386/ilp32/x86-64-rip-intel.d: Likewise. * gas/i386/ilp32/x86-64-sib.d: Likewise. * gas/i386/ilp32/x86-64-sib-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd.d: Likewise. * gas/i386/ilp32/x86-64-simd-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd-suffix.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse3.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse-check.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-none.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-warn.d: Likewise. * gas/i386/ilp32/x86-64-sse-noavx.d: Likewise. * gas/i386/ilp32/x86-64-ssse3.d: Likewise. * gas/i386/ilp32/x86-64-stack.d: Likewise. * gas/i386/ilp32/x86-64-stack-intel.d: Likewise. * gas/i386/ilp32/x86-64-stack-suffix.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/ilp32/x86-64-vmx.d: Likewise. * gas/i386/ilp32/x86-64-xsave.d: Likewise. * gas/i386/ilp32/x86-64-xsave-intel.d: Likewise. ld/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * emulparams/elf32_x86_64.sh: New. * configure.tgt (targ64_extra_emuls): Add elf32_x86_64 for i[3-7]86-*-linux-*. (targ_extra_libpath): Likewise. (targ_extra_emuls): Add elf32_x86_64 for x86_64-*-linux-*. (targ_extra_libpath): Likewise. * Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf32_x86_64.c. (eelf32_x86_64.c): New. * Makefile.in: Regenerated. opcodes/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (print_insn): Support bfd_mach_x64_32 and bfd_mach_x64_32_intel_syntax.
2010-12-31 01:33:36 +01:00
/* Append a RELA relocation REL to section S in BFD. */
void
elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_byte *loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rela);
BFD_ASSERT (loc + bed->s->sizeof_rela <= s->contents + s->size);
bed->s->swap_reloca_out (abfd, rel, loc);
}
/* Append a REL relocation REL to section S in BFD. */
void
elf_append_rel (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_byte *loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rel);
BFD_ASSERT (loc + bed->s->sizeof_rel <= s->contents + s->size);
bed->s->swap_reloc_out (abfd, rel, loc);
Add x86-64 ILP32 support. bfd/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * archures.c (bfd_mach_x64_32): New. (bfd_mach_x64_32_intel_syntax): Likewise. * bfd-in2.h: Regenerated. * config.bfd (targ64_selvecs): Add bfd_elf32_x86_64_vec for i[3-7]86-*-linux-*. (targ_selvecs): Add bfd_elf32_x86_64_vec for x86_64-*-linux-*. * configure.in: Support bfd_elf32_x86_64_vec. * configure: Regenerated. * cpu-i386.c (bfd_x64_32_arch_intel_syntax): New. (bfd_x64_32_arch): Likewise. * elf-bfd.h (elf_append_rela): New prototype. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * elf64-x86-64.c (ABI_64_P): New. (elf_x86_64_info_to_howto): Replace ELF64_R_TYPE with ELF32_R_TYPE. Replace ELF64_ST_TYPE with ELF_ST_TYPE. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_reloc_type_class): Likewise. (ELF_DYNAMIC_INTERPRETER): Renamed to ... (ELF64_DYNAMIC_INTERPRETER): This. (ELF32_DYNAMIC_INTERPRETER): New. (elf_x86_64_link_hash_table): Add r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_get_local_sym_hash): Replace ELF64_R_SYM with htab->r_sym. Replace ELF64_R_INFO with htab->r_info. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_check_tls_transition):Likewise. (elf_x86_64_check_relocs): Likewise. (elf_x86_64_gc_mark_hook):Likewise. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_local_dynamic_symbol): Likewise. (elf_x86_64_link_hash_table_create): Initialize r_info, r_sym, swap_reloca_out, dynamic_interpreter and dynamic_interpreter_size. (elf_x86_64_check_relocs): Check ABI_64_P when requesting for PIC. (elf_x86_64_relocate_section): Likewise. (elf64_x86_64_adjust_dynamic_symbol): Replace sizeof (Elf64_External_Rela) with bed->s->sizeof_rela. (elf64_x86_64_allocate_dynrelocs): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_finish_dynamic_symbol): Likewise. (elf64_x86_64_append_rela): Removed. (elf32_x86_64_elf_object_p): New. Add bfd_elf32_x86_64_vec. * elf64-x86-64.c (elf64_x86_64_xxx): Renamed to ... (elf_x86_64_xxx): This. * elflink.c (bfd_elf_final_link): Check ELF file class on error. (elf_append_rela): New. (elf_append_rel): Likewise. (elf64_r_info): Likewise. (elf32_r_info): Likewise. (elf64_r_sym): Likewise. (elf32_r_sym): Likewise. * targets.c (bfd_elf32_x86_64_vec): New. (_bfd_target_vector): Add bfd_elf32_x86_64_vec. gas/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * config/tc-i386.c (x86_elf_abi): New. (i386_mach): Return bfd_mach_x64_32 for ILP32. (OPTION_N32): Likewise. (md_longopts): Add "n32" for ELF. (md_parse_option): Handle OPTION_N32. (md_show_usage): Add --n32. (i386_target_format): Update and check x86_elf_abi. * config/tc-i386.h (ELF_TARGET_FORMAT32): New. * doc/as.texinfo: Document --n32. * doc/c-i386.texi: Likewise. gas/testsuite/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/ilp32/lns/ilp32.exp: New. * gas/i386/ilp32/lns/lns-common-1.d: Likewise. * gas/i386/ilp32/lns/lns-duplicate.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-1.d: New. * gas/i386/ilp32/cfi/cfi-common-2.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-3.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-4.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-5.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-6.d: Likewise. * gas/i386/ilp32/cfi/cfi-common-7.d: Likewise. * gas/i386/ilp32/cfi/cfi-x86_64.d: Likewise. * gas/i386/ilp32/cfi/ilp32.exp: Likewise. * gas/i386/ilp32/elf/ehopt0.d: Likewise. * gas/i386/ilp32/elf/equ-reloc.d: Likewise. * gas/i386/ilp32/elf/file.d: Likewise. * gas/i386/ilp32/elf/group0a.d: Likewise. * gas/i386/ilp32/elf/group0b.d: Likewise. * gas/i386/ilp32/elf/group1a.d: Likewise. * gas/i386/ilp32/elf/group1b.d: Likewise. * gas/i386/ilp32/elf/ifunc-1.d: Likewise. * gas/i386/ilp32/elf/ilp32.exp: Likewise. * gas/i386/ilp32/elf/redef.d: Likewise. * gas/i386/ilp32/elf/section0.d: Likewise. * gas/i386/ilp32/elf/section1.d: Likewise. * gas/i386/ilp32/elf/section3.d: Likewise. * gas/i386/ilp32/elf/section4.d: Likewise. * gas/i386/ilp32/elf/section6.d: Likewise. * gas/i386/ilp32/elf/section7.d: Likewise. * gas/i386/ilp32/elf/struct.d: Likewise. * gas/i386/ilp32/elf/symtab.d: Likewise. * gas/i386/ilp32/elf/symver.d: Likewise. * gas/i386/ilp32/ilp32.exp: New. * gas/i386/ilp32/immed64.d: Likewise. * gas/i386/ilp32/mixed-mode-reloc64.d: Likewise. * gas/i386/ilp32/reloc64.d: Likewise. * gas/i386/ilp32/rex.d: Likewise. * gas/i386/ilp32/rexw.d: Likewise. * gas/i386/ilp32/svme64.d: Likewise. * gas/i386/ilp32/x86-64-addr32.d: Likewise. * gas/i386/ilp32/x86-64-addr32-intel.d: Likewise. * gas/i386/ilp32/x86-64-aes.d: Likewise. * gas/i386/ilp32/x86-64-aes-intel.d: Likewise. * gas/i386/ilp32/x86-64-amdfam10.d: Likewise. * gas/i386/ilp32/x86-64-arch-1.d: Likewise. * gas/i386/ilp32/x86-64-arch-2.d: Likewise. * gas/i386/ilp32/x86-64-avx.d: Likewise. * gas/i386/ilp32/x86-64-avx-intel.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap.d: Likewise. * gas/i386/ilp32/x86-64-avx-swap-intel.d: Likewise. * gas/i386/ilp32/x86-64-branch.d: Likewise. * gas/i386/ilp32/x86-64-cbw.d: Likewise. * gas/i386/ilp32/x86-64-cbw-intel.d: Likewise. * gas/i386/ilp32/x86-64-clmul.d: Likewise. * gas/i386/ilp32/x86-64-clmul-intel.d: Likewise. * gas/i386/ilp32/x86-64-crc32.d: Likewise. * gas/i386/ilp32/x86-64-crc32-intel.d: Likewise. * gas/i386/ilp32/x86-64-crx.d: Likewise. * gas/i386/ilp32/x86-64-crx-suffix.d: Likewise. * gas/i386/ilp32/x86-64.d: Likewise. * gas/i386/ilp32/x86-64-disp.d: Likewise. * gas/i386/ilp32/x86-64-disp-intel.d: Likewise. * gas/i386/ilp32/x86-64-drx.d: Likewise. * gas/i386/ilp32/x86-64-drx-suffix.d: Likewise. * gas/i386/ilp32/x86-64-ept.d: Likewise. * gas/i386/ilp32/x86-64-ept-intel.d: Likewise. * gas/i386/ilp32/x86-64-fma4.d: Likewise. * gas/i386/ilp32/x86-64-fma.d: Likewise. * gas/i386/ilp32/x86-64-fma-intel.d: Likewise. * gas/i386/ilp32/x86-64-gidt.d: Likewise. * gas/i386/ilp32/x86-64-ifunc.d: Likewise. * gas/i386/ilp32/x86-64-intel64.d: Likewise. * gas/i386/ilp32/x86-64-io.d: Likewise. * gas/i386/ilp32/x86-64-io-intel.d: Likewise. * gas/i386/ilp32/x86-64-io-suffix.d: Likewise. * gas/i386/ilp32/x86-64-localpic.d: Likewise. * gas/i386/ilp32/x86-64-mem.d: Likewise. * gas/i386/ilp32/x86-64-mem-intel.d: Likewise. * gas/i386/ilp32/x86-64-movbe.d: Likewise. * gas/i386/ilp32/x86-64-movbe-intel.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-1.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise. * gas/i386/ilp32/x86-64-nops-2.d: Likewise. * gas/i386/ilp32/x86-64-nops-3.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-4.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-5.d: Likewise. * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops.d: Likewise. * gas/i386/ilp32/x86-64-opcode.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval.d: Likewise. * gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise. * gas/i386/ilp32/x86-64-opts.d: Likewise. * gas/i386/ilp32/x86-64-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-pcrel.d: Likewise. * gas/i386/ilp32/x86-64-reg.d: Likewise. * gas/i386/ilp32/x86-64-reg-intel.d: Likewise. * gas/i386/ilp32/x86-64-rep.d: Likewise. * gas/i386/ilp32/x86-64-rep-suffix.d: Likewise. * gas/i386/ilp32/x86-64-rip.d: Likewise. * gas/i386/ilp32/x86-64-rip-intel.d: Likewise. * gas/i386/ilp32/x86-64-sib.d: Likewise. * gas/i386/ilp32/x86-64-sib-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd.d: Likewise. * gas/i386/ilp32/x86-64-simd-intel.d: Likewise. * gas/i386/ilp32/x86-64-simd-suffix.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts.d: Likewise. * gas/i386/ilp32/x86-64-sse2avx-opts-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse3.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1.d: Likewise. * gas/i386/ilp32/x86-64-sse4_1-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2.d: Likewise. * gas/i386/ilp32/x86-64-sse4_2-intel.d: Likewise. * gas/i386/ilp32/x86-64-sse-check.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-none.d: Likewise. * gas/i386/ilp32/x86-64-sse-check-warn.d: Likewise. * gas/i386/ilp32/x86-64-sse-noavx.d: Likewise. * gas/i386/ilp32/x86-64-ssse3.d: Likewise. * gas/i386/ilp32/x86-64-stack.d: Likewise. * gas/i386/ilp32/x86-64-stack-intel.d: Likewise. * gas/i386/ilp32/x86-64-stack-suffix.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/ilp32/x86-64-vmx.d: Likewise. * gas/i386/ilp32/x86-64-xsave.d: Likewise. * gas/i386/ilp32/x86-64-xsave-intel.d: Likewise. ld/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * emulparams/elf32_x86_64.sh: New. * configure.tgt (targ64_extra_emuls): Add elf32_x86_64 for i[3-7]86-*-linux-*. (targ_extra_libpath): Likewise. (targ_extra_emuls): Add elf32_x86_64 for x86_64-*-linux-*. (targ_extra_libpath): Likewise. * Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf32_x86_64.c. (eelf32_x86_64.c): New. * Makefile.in: Regenerated. opcodes/ 2010-12-30 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (print_insn): Support bfd_mach_x64_32 and bfd_mach_x64_32_intel_syntax.
2010-12-31 01:33:36 +01:00
}