darling-gdb/bfd/elf32-s390.c

3529 lines
107 KiB
C
Raw Normal View History

2001-02-10 00:58:38 +00:00
/* IBM S/390-specific support for 32-bit ELF
2009-09-02 07:25:43 +00:00
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
2001-02-10 00:58:38 +00:00
Contributed by Carl B. Pedersen and Martin Schwidefsky.
This file is part of BFD, the Binary File Descriptor library.
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
2001-02-10 00:58:38 +00:00
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
2001-02-10 00:58:38 +00:00
#include "sysdep.h"
#include "bfd.h"
2001-02-10 00:58:38 +00:00
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
static reloc_howto_type *elf_s390_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf_s390_info_to_howto
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_boolean elf_s390_is_local_label_name
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
PARAMS ((bfd *, const char *));
static struct bfd_hash_entry *link_hash_newfunc
2001-02-10 00:58:38 +00:00
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static struct bfd_link_hash_table *elf_s390_link_hash_table_create
PARAMS ((bfd *));
static bfd_boolean create_got_section
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
PARAMS((bfd *, struct bfd_link_info *));
static bfd_boolean elf_s390_create_dynamic_sections
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
PARAMS((bfd *, struct bfd_link_info *));
static void elf_s390_copy_indirect_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
static bfd_boolean elf_s390_check_relocs
2001-02-10 00:58:38 +00:00
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
struct elf_s390_link_hash_entry;
static void elf_s390_adjust_gotplt
PARAMS ((struct elf_s390_link_hash_entry *));
static bfd_boolean elf_s390_adjust_dynamic_symbol
2001-02-10 00:58:38 +00:00
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
static bfd_boolean allocate_dynrelocs
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
PARAMS ((struct elf_link_hash_entry *, PTR));
static bfd_boolean readonly_dynrelocs
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
PARAMS ((struct elf_link_hash_entry *, PTR));
static bfd_boolean elf_s390_size_dynamic_sections
2001-02-10 00:58:38 +00:00
PARAMS ((bfd *, struct bfd_link_info *));
static bfd_boolean elf_s390_relocate_section
2001-02-10 00:58:38 +00:00
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static bfd_boolean elf_s390_finish_dynamic_symbol
2001-02-10 00:58:38 +00:00
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *));
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
static enum elf_reloc_type_class elf_s390_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
static bfd_boolean elf_s390_finish_dynamic_sections
2001-02-10 00:58:38 +00:00
PARAMS ((bfd *, struct bfd_link_info *));
static bfd_boolean elf_s390_object_p
PARAMS ((bfd *));
static bfd_boolean elf_s390_grok_prstatus
PARAMS ((bfd *, Elf_Internal_Note *));
static int elf_s390_tls_transition
PARAMS ((struct bfd_link_info *, int, int));
static bfd_reloc_status_type s390_tls_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static bfd_vma dtpoff_base
PARAMS ((struct bfd_link_info *));
static bfd_vma tpoff
PARAMS ((struct bfd_link_info *, bfd_vma));
static void invalid_tls_insn
PARAMS ((bfd *, asection *, Elf_Internal_Rela *));
static bfd_reloc_status_type s390_elf_ldisp_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
2001-02-10 00:58:38 +00:00
#include "elf/s390.h"
/* The relocation "howto" table. */
static reloc_howto_type elf_howto_table[] =
{
HOWTO (R_390_NONE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
2001-02-10 00:58:38 +00:00
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_390_NONE", /* name */
FALSE, /* partial_inplace */
2001-02-10 00:58:38 +00:00
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO(R_390_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_8", FALSE, 0,0x000000ff, FALSE),
HOWTO(R_390_12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_390_12", FALSE, 0,0x00000fff, FALSE),
HOWTO(R_390_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_16", FALSE, 0,0x0000ffff, FALSE),
HOWTO(R_390_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_32", FALSE, 0,0xffffffff, FALSE),
HOWTO(R_390_PC32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PC32", FALSE, 0,0xffffffff, TRUE),
HOWTO(R_390_GOT12, 0, 1, 12, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOT12", FALSE, 0,0x00000fff, FALSE),
HOWTO(R_390_GOT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOT32", FALSE, 0,0xffffffff, FALSE),
HOWTO(R_390_PLT32, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PLT32", FALSE, 0,0xffffffff, TRUE),
HOWTO(R_390_COPY, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_COPY", FALSE, 0,0xffffffff, FALSE),
HOWTO(R_390_GLOB_DAT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GLOB_DAT", FALSE, 0,0xffffffff, FALSE),
HOWTO(R_390_JMP_SLOT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_JMP_SLOT", FALSE, 0,0xffffffff, FALSE),
HOWTO(R_390_RELATIVE, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_RELATIVE", FALSE, 0,0xffffffff, FALSE),
HOWTO(R_390_GOTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOTOFF32", FALSE, 0,0xffffffff, FALSE),
HOWTO(R_390_GOTPC, 0, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOTPC", FALSE, 0,0xffffffff, TRUE),
HOWTO(R_390_GOT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOT16", FALSE, 0,0x0000ffff, FALSE),
HOWTO(R_390_PC16, 0, 1, 16, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PC16", FALSE, 0,0x0000ffff, TRUE),
HOWTO(R_390_PC16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PC16DBL", FALSE, 0,0x0000ffff, TRUE),
HOWTO(R_390_PLT16DBL, 1, 1, 16, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PLT16DBL", FALSE, 0,0x0000ffff, TRUE),
HOWTO(R_390_PC32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PC32DBL", FALSE, 0,0xffffffff, TRUE),
HOWTO(R_390_PLT32DBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PLT32DBL", FALSE, 0,0xffffffff, TRUE),
HOWTO(R_390_GOTPCDBL, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOTPCDBL", FALSE, 0,0xffffffff, TRUE),
EMPTY_HOWTO (R_390_64), /* Empty entry for R_390_64. */
EMPTY_HOWTO (R_390_PC64), /* Empty entry for R_390_PC64. */
EMPTY_HOWTO (R_390_GOT64), /* Empty entry for R_390_GOT64. */
EMPTY_HOWTO (R_390_PLT64), /* Empty entry for R_390_PLT64. */
HOWTO(R_390_GOTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOTENT", FALSE, 0,0xffffffff, TRUE),
HOWTO(R_390_GOTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOTOFF16", FALSE, 0,0x0000ffff, FALSE),
EMPTY_HOWTO (R_390_GOTOFF64), /* Empty entry for R_390_GOTOFF64. */
HOWTO(R_390_GOTPLT12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_390_GOTPLT12", FALSE, 0,0x00000fff, FALSE),
HOWTO(R_390_GOTPLT16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOTPLT16", FALSE, 0,0x0000ffff, FALSE),
HOWTO(R_390_GOTPLT32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOTPLT32", FALSE, 0,0xffffffff, FALSE),
EMPTY_HOWTO (R_390_GOTPLT64), /* Empty entry for R_390_GOTPLT64. */
HOWTO(R_390_GOTPLTENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_GOTPLTENT",FALSE, 0,0xffffffff, TRUE),
HOWTO(R_390_PLTOFF16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PLTOFF16", FALSE, 0,0x0000ffff, FALSE),
HOWTO(R_390_PLTOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_PLTOFF32", FALSE, 0,0xffffffff, FALSE),
EMPTY_HOWTO (R_390_PLTOFF64), /* Empty entry for R_390_PLTOFF64. */
HOWTO(R_390_TLS_LOAD, 0, 0, 0, FALSE, 0, complain_overflow_dont,
s390_tls_reloc, "R_390_TLS_LOAD", FALSE, 0, 0, FALSE),
HOWTO(R_390_TLS_GDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
s390_tls_reloc, "R_390_TLS_GDCALL", FALSE, 0, 0, FALSE),
HOWTO(R_390_TLS_LDCALL, 0, 0, 0, FALSE, 0, complain_overflow_dont,
s390_tls_reloc, "R_390_TLS_LDCALL", FALSE, 0, 0, FALSE),
HOWTO(R_390_TLS_GD32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_GD32", FALSE, 0, 0xffffffff, FALSE),
EMPTY_HOWTO (R_390_TLS_GD64), /* Empty entry for R_390_TLS_GD64. */
HOWTO(R_390_TLS_GOTIE12, 0, 1, 12, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "R_390_TLS_GOTIE12", FALSE, 0, 0x00000fff, FALSE),
HOWTO(R_390_TLS_GOTIE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_GOTIE32", FALSE, 0, 0xffffffff, FALSE),
EMPTY_HOWTO (R_390_TLS_GOTIE64), /* Empty entry for R_390_TLS_GOTIE64. */
HOWTO(R_390_TLS_LDM32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_LDM32", FALSE, 0, 0xffffffff, FALSE),
EMPTY_HOWTO (R_390_TLS_LDM64), /* Empty entry for R_390_TLS_LDM64. */
HOWTO(R_390_TLS_IE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_IE32", FALSE, 0, 0xffffffff, FALSE),
EMPTY_HOWTO (R_390_TLS_IE64), /* Empty entry for R_390_TLS_IE64. */
HOWTO(R_390_TLS_IEENT, 1, 2, 32, TRUE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_IEENT", FALSE, 0, 0xffffffff, TRUE),
HOWTO(R_390_TLS_LE32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_LE32", FALSE, 0, 0xffffffff, FALSE),
EMPTY_HOWTO (R_390_TLS_LE64), /* Empty entry for R_390_TLS_LE64. */
HOWTO(R_390_TLS_LDO32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_LDO32", FALSE, 0, 0xffffffff, FALSE),
EMPTY_HOWTO (R_390_TLS_LDO64), /* Empty entry for R_390_TLS_LDO64. */
HOWTO(R_390_TLS_DTPMOD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_DTPMOD", FALSE, 0, 0xffffffff, FALSE),
HOWTO(R_390_TLS_DTPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_DTPOFF", FALSE, 0, 0xffffffff, FALSE),
HOWTO(R_390_TLS_TPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
bfd_elf_generic_reloc, "R_390_TLS_TPOFF", FALSE, 0, 0xffffffff, FALSE),
HOWTO(R_390_20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
s390_elf_ldisp_reloc, "R_390_20", FALSE, 0,0x0fffff00, FALSE),
HOWTO(R_390_GOT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
s390_elf_ldisp_reloc, "R_390_GOT20", FALSE, 0,0x0fffff00, FALSE),
HOWTO(R_390_GOTPLT20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
s390_elf_ldisp_reloc, "R_390_GOTPLT20", FALSE, 0,0x0fffff00, FALSE),
HOWTO(R_390_TLS_GOTIE20, 0, 2, 20, FALSE, 8, complain_overflow_dont,
s390_elf_ldisp_reloc, "R_390_TLS_GOTIE20", FALSE, 0,0x0fffff00, FALSE),
2001-02-10 00:58:38 +00:00
};
/* GNU extension to record C++ vtable hierarchy. */
static reloc_howto_type elf32_s390_vtinherit_howto =
HOWTO (R_390_GNU_VTINHERIT, 0,2,0,FALSE,0,complain_overflow_dont, NULL, "R_390_GNU_VTINHERIT", FALSE,0, 0, FALSE);
2001-02-10 00:58:38 +00:00
static reloc_howto_type elf32_s390_vtentry_howto =
HOWTO (R_390_GNU_VTENTRY, 0,2,0,FALSE,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_390_GNU_VTENTRY", FALSE,0,0, FALSE);
2001-02-10 00:58:38 +00:00
static reloc_howto_type *
elf_s390_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
switch (code)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
case BFD_RELOC_NONE:
return &elf_howto_table[(int) R_390_NONE];
case BFD_RELOC_8:
return &elf_howto_table[(int) R_390_8];
case BFD_RELOC_390_12:
return &elf_howto_table[(int) R_390_12];
case BFD_RELOC_16:
return &elf_howto_table[(int) R_390_16];
case BFD_RELOC_32:
return &elf_howto_table[(int) R_390_32];
case BFD_RELOC_CTOR:
return &elf_howto_table[(int) R_390_32];
case BFD_RELOC_32_PCREL:
return &elf_howto_table[(int) R_390_PC32];
case BFD_RELOC_390_GOT12:
return &elf_howto_table[(int) R_390_GOT12];
case BFD_RELOC_32_GOT_PCREL:
return &elf_howto_table[(int) R_390_GOT32];
case BFD_RELOC_390_PLT32:
return &elf_howto_table[(int) R_390_PLT32];
case BFD_RELOC_390_COPY:
return &elf_howto_table[(int) R_390_COPY];
case BFD_RELOC_390_GLOB_DAT:
return &elf_howto_table[(int) R_390_GLOB_DAT];
case BFD_RELOC_390_JMP_SLOT:
return &elf_howto_table[(int) R_390_JMP_SLOT];
case BFD_RELOC_390_RELATIVE:
return &elf_howto_table[(int) R_390_RELATIVE];
case BFD_RELOC_32_GOTOFF:
return &elf_howto_table[(int) R_390_GOTOFF32];
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
case BFD_RELOC_390_GOTPC:
return &elf_howto_table[(int) R_390_GOTPC];
case BFD_RELOC_390_GOT16:
return &elf_howto_table[(int) R_390_GOT16];
case BFD_RELOC_16_PCREL:
return &elf_howto_table[(int) R_390_PC16];
case BFD_RELOC_390_PC16DBL:
return &elf_howto_table[(int) R_390_PC16DBL];
case BFD_RELOC_390_PLT16DBL:
return &elf_howto_table[(int) R_390_PLT16DBL];
case BFD_RELOC_390_PC32DBL:
return &elf_howto_table[(int) R_390_PC32DBL];
case BFD_RELOC_390_PLT32DBL:
return &elf_howto_table[(int) R_390_PLT32DBL];
case BFD_RELOC_390_GOTPCDBL:
return &elf_howto_table[(int) R_390_GOTPCDBL];
case BFD_RELOC_390_GOTENT:
return &elf_howto_table[(int) R_390_GOTENT];
case BFD_RELOC_16_GOTOFF:
return &elf_howto_table[(int) R_390_GOTOFF16];
case BFD_RELOC_390_GOTPLT12:
return &elf_howto_table[(int) R_390_GOTPLT12];
case BFD_RELOC_390_GOTPLT16:
return &elf_howto_table[(int) R_390_GOTPLT16];
case BFD_RELOC_390_GOTPLT32:
return &elf_howto_table[(int) R_390_GOTPLT32];
case BFD_RELOC_390_GOTPLTENT:
return &elf_howto_table[(int) R_390_GOTPLTENT];
case BFD_RELOC_390_PLTOFF16:
return &elf_howto_table[(int) R_390_PLTOFF16];
case BFD_RELOC_390_PLTOFF32:
return &elf_howto_table[(int) R_390_PLTOFF32];
case BFD_RELOC_390_TLS_LOAD:
return &elf_howto_table[(int) R_390_TLS_LOAD];
case BFD_RELOC_390_TLS_GDCALL:
return &elf_howto_table[(int) R_390_TLS_GDCALL];
case BFD_RELOC_390_TLS_LDCALL:
return &elf_howto_table[(int) R_390_TLS_LDCALL];
case BFD_RELOC_390_TLS_GD32:
return &elf_howto_table[(int) R_390_TLS_GD32];
case BFD_RELOC_390_TLS_GOTIE12:
return &elf_howto_table[(int) R_390_TLS_GOTIE12];
case BFD_RELOC_390_TLS_GOTIE32:
return &elf_howto_table[(int) R_390_TLS_GOTIE32];
case BFD_RELOC_390_TLS_LDM32:
return &elf_howto_table[(int) R_390_TLS_LDM32];
case BFD_RELOC_390_TLS_IE32:
return &elf_howto_table[(int) R_390_TLS_IE32];
case BFD_RELOC_390_TLS_IEENT:
return &elf_howto_table[(int) R_390_TLS_IEENT];
case BFD_RELOC_390_TLS_LE32:
return &elf_howto_table[(int) R_390_TLS_LE32];
case BFD_RELOC_390_TLS_LDO32:
return &elf_howto_table[(int) R_390_TLS_LDO32];
case BFD_RELOC_390_TLS_DTPMOD:
return &elf_howto_table[(int) R_390_TLS_DTPMOD];
case BFD_RELOC_390_TLS_DTPOFF:
return &elf_howto_table[(int) R_390_TLS_DTPOFF];
case BFD_RELOC_390_TLS_TPOFF:
return &elf_howto_table[(int) R_390_TLS_TPOFF];
case BFD_RELOC_390_20:
return &elf_howto_table[(int) R_390_20];
case BFD_RELOC_390_GOT20:
return &elf_howto_table[(int) R_390_GOT20];
case BFD_RELOC_390_GOTPLT20:
return &elf_howto_table[(int) R_390_GOTPLT20];
case BFD_RELOC_390_TLS_GOTIE20:
return &elf_howto_table[(int) R_390_TLS_GOTIE20];
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
case BFD_RELOC_VTABLE_INHERIT:
return &elf32_s390_vtinherit_howto;
case BFD_RELOC_VTABLE_ENTRY:
return &elf32_s390_vtentry_howto;
default:
break;
}
2001-02-10 00:58:38 +00:00
return 0;
}
* aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define. * aout-arm.c (MY_bfd_reloc_name_lookup): Define. (MY (bfd_reloc_name_lookup)): New function. * aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function. * aout-target.h (NAME (aout, reloc_name_lookup)): Declare. (MY_bfd_reloc_name_lookup): Define. * aout-tic30.c (tic30_aout_reloc_name_lookup): New function. (MY_bfd_reloc_name_lookup): Define. * aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare. (NAME (aout, reloc_name_lookup)): New function. * bout.c (b_out_bfd_reloc_name_lookup): New function. * coff-alpha.c (alpha_bfd_reloc_name_lookup): New function. (_bfd_ecoff_bfd_reloc_name_lookup): Define. * coff-arm.c (coff_arm_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-i386.c (coff_bfd_reloc_name_lookup): Define. (coff_i386_reloc_name_lookup): New function. * coff-i860.c (coff_i860_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-i960.c (coff_i960_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-m68k.c (m68k_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-maxq.c (maxq_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-mcore.c (mcore_coff_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-mips.c (mips_bfd_reloc_name_lookup): New function. (_bfd_ecoff_bfd_reloc_name_lookup): Define. * coff-ppc.c (ppc_coff_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-rs6000.c (coff_bfd_reloc_name_lookup): Define. (_bfd_xcoff_reloc_name_lookup): New function. (rs6000coff_vec, pmac_xcoff_vec): Init new field. * coff-sh.c (coff_bfd_reloc_name_lookup): Define. (sh_coff_reloc_name_lookup): New function. * coff-sparc.c (coff_sparc_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-tic30.c (coff_bfd_reloc_name_lookup): Define. (tic30_coff_reloc_name_lookup): New function. * coff-tic4x.c (coff_bfd_reloc_name_lookup): Define. (tic4x_coff_reloc_name_lookup): New function. * coff-tic54x.c (coff_bfd_reloc_name_lookup): Define. (tic54x_coff_reloc_name_lookup): New function. * coff-x86_64.c (coff_bfd_reloc_name_lookup): Define. (coff_amd64_reloc_name_lookup): New function. * coff-z80.c (coff_z80_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-z8k.c (coff_z8k_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define. (xcoff64_reloc_name_lookup): New function. (rs6000coff64_vec, aix5coff64_vec): Init new field. * coffcode.h (coff_bfd_reloc_name_lookup): Define. * elf-hppa.h (elf_hppa_reloc_name_lookup): New function. * elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-arm.c (elf32_arm_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-cris.c (cris_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-crx.c (elf_crx_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-fr30.c (fr30_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-frv.c (frv_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-h8300.c (elf32_h8_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i370.c (i370_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i386.c (elf_i386_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i860.c (elf32_i860_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i960.c (elf32_i960_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-ip2k.c (ip2k_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-iq2000.c (iq2000_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m32c.c (m32c_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68k.c (reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mcore.c (mcore_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mep.c (mep_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. (mips_vxworks_bfd_reloc_name_lookup): Likewise. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-mt.c (mt_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-openrisc.c (openrisc_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-pj.c (pj_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-ppc.c (ppc_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-s390.c (elf_s390_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-score.c (elf32_score_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-sh.c (sh_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-spu.c (spu_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-v850.c (v850_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-vax.c (reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xc16x.c (xc16x_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function. * elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function. * elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-s390.c (elf_s390_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-sh64.c (sh_elf64_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function. (bfd_elfNN_bfd_reloc_name_lookup): Define. * elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function. * elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare. * i386msdos.c (msdos_bfd_reloc_name_lookup): Define. * i386os9k.c (aout_32_bfd_reloc_name_lookup): Define. * ieee.c (ieee_bfd_reloc_name_lookup): Define. * libaout.h (NAME (aout, reloc_name_lookup)): Declare. * libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare. * mipsbsd.c (MY_bfd_reloc_name_lookup): Define. (MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup). (MY(reloc_name_lookup)): New function. * nlm-target.h (nlm_bfd_reloc_name_lookup): Define. * oasys.c (oasys_bfd_reloc_name_lookup): Define. * pdp11.c (NAME (aout, reloc_name_lookup)): New function. * pe-mips.c (coff_mips_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * reloc.c (bfd_reloc_name_lookup): New function. * riscix.c (riscix_reloc_name_lookup): New function. (MY_bfd_reloc_name_lookup): Define. * som.c (som_bfd_reloc_name_lookup): New function. * targets.c (struct bfd_target): Add reloc_name_lookup. (BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup. * versados.c (versados_bfd_reloc_name_lookup): Define. * vms.c (vms_bfd_reloc_name_lookup): New function. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2007-03-26 12:23:03 +00:00
static reloc_howto_type *
elf_s390_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
const char *r_name)
{
unsigned int i;
for (i = 0; i < sizeof (elf_howto_table) / sizeof (elf_howto_table[0]); i++)
if (elf_howto_table[i].name != NULL
&& strcasecmp (elf_howto_table[i].name, r_name) == 0)
return &elf_howto_table[i];
if (strcasecmp (elf32_s390_vtinherit_howto.name, r_name) == 0)
return &elf32_s390_vtinherit_howto;
if (strcasecmp (elf32_s390_vtentry_howto.name, r_name) == 0)
return &elf32_s390_vtentry_howto;
return NULL;
}
2001-02-10 00:58:38 +00:00
/* We need to use ELF32_R_TYPE so we have our own copy of this function,
and elf32-s390.c has its own copy. */
static void
elf_s390_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
Elf_Internal_Rela *dst;
{
unsigned int r_type = ELF32_R_TYPE(dst->r_info);
switch (r_type)
2001-02-10 00:58:38 +00:00
{
case R_390_GNU_VTINHERIT:
cache_ptr->howto = &elf32_s390_vtinherit_howto;
break;
case R_390_GNU_VTENTRY:
cache_ptr->howto = &elf32_s390_vtentry_howto;
break;
default:
if (r_type >= sizeof (elf_howto_table) / sizeof (elf_howto_table[0]))
{
(*_bfd_error_handler) (_("%B: invalid relocation type %d"),
abfd, (int) r_type);
r_type = R_390_NONE;
}
cache_ptr->howto = &elf_howto_table[r_type];
}
2001-02-10 00:58:38 +00:00
}
/* A relocation function which doesn't do anything. */
static bfd_reloc_status_type
s390_tls_reloc (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry;
asymbol *symbol ATTRIBUTE_UNUSED;
PTR data ATTRIBUTE_UNUSED;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{
if (output_bfd)
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
/* Handle the large displacement relocs. */
static bfd_reloc_status_type
s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry;
asymbol *symbol;
PTR data ATTRIBUTE_UNUSED;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{
reloc_howto_type *howto = reloc_entry->howto;
bfd_vma relocation;
bfd_vma insn;
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
&& (! howto->partial_inplace
|| reloc_entry->addend == 0))
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
if (output_bfd != NULL)
return bfd_reloc_continue;
* bfd-in.h (bfd_get_section_limit): Define. * reloc.c (bfd_perform_relocation, bfd_install_relocation) (_bfd_final_link_relocate): Use bfd_get_section_limit. * aout-tic30.c (tic30_aout_final_link_relocate): Likewise. * coff-arm.c (coff_arm_relocate_section): Likewise. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): Likewise. * cpu-ns32k.c (do_ns32k_reloc): Likewise. (bfd_ns32k_final_link_relocate): Likewise. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): Likwise. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): Likewise. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc) (i860_howto_highadj_reloc, i860_howto_splitn_reloc): Likewise. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc) (m32r_elf_generic_reloc, m32r_elf_relocate_section): Likewise. * elf32-m68hc1x.c (m68hc11_elf_special_reloc): Likewise. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc): Likewise. * elf32-or32.c (or32_elf_consth_reloc): Likewise. * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Likewise. * elf32-s390.c (s390_elf_ldisp_reloc): Likewise. * elf32-sh.c (sh_elf_reloc_loop): Likewise. * elf32-sparc.c (sparc_elf_wdisp16_reloc): Likewise. (sparc_elf_hix22_reloc, sparc_elf_lox10_reloc): Likwise. * elf32-v850.c (v850_elf_reloc): Likewise. * elf32-xstormy16.c (xstormy16_elf_24_reloc): Likewise. * elf32-xtensa.c (bfd_elf_xtensa_reloc): Likewise. * elf64-alpha.c (elf64_alpha_reloc_gpdisp): Likewise. * elf64-mips.c (mips_elf64_gprel32_reloc) (mips16_gprel_reloc): Likewise. * elf64-mmix.c (mmix_elf_reloc): Likewise. * elf64-s390.c (s390_elf_ldisp_reloc): Likewise. * elf64-sparc.c (init_insn_reloc): Likewise. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc): Likewise. * elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp) (_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_lo16_reloc) (_bfd_mips_elf_generic_reloc): Likewise. * bfd-in2.h: Regenerate.
2004-06-29 13:46:34 +00:00
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
relocation = (symbol->value
+ symbol->section->output_section->vma
+ symbol->section->output_offset);
relocation += reloc_entry->addend;
if (howto->pc_relative)
{
relocation -= (input_section->output_section->vma
+ input_section->output_offset);
relocation -= reloc_entry->address;
}
insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
insn |= (relocation & 0xfff) << 16 | (relocation & 0xff000) >> 4;
bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
if ((bfd_signed_vma) relocation < - 0x80000
|| (bfd_signed_vma) relocation > 0x7ffff)
return bfd_reloc_overflow;
else
return bfd_reloc_ok;
}
static bfd_boolean
2001-02-10 00:58:38 +00:00
elf_s390_is_local_label_name (abfd, name)
bfd *abfd;
const char *name;
{
if (name[0] == '.' && (name[1] == 'X' || name[1] == 'L'))
return TRUE;
2001-02-10 00:58:38 +00:00
return _bfd_elf_is_local_label_name (abfd, name);
}
/* Functions for the 390 ELF linker. */
/* The name of the dynamic interpreter. This is put in the .interp
section. */
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
copying dynamic variables from a shared lib into an app's dynbss
section, and instead use a dynamic relocation to point into the
shared lib. */
#define ELIMINATE_COPY_RELOCS 1
2001-02-10 00:58:38 +00:00
/* The size in bytes of the first entry in the procedure linkage table. */
#define PLT_FIRST_ENTRY_SIZE 32
/* The size in bytes of an entry in the procedure linkage table. */
#define PLT_ENTRY_SIZE 32
2001-02-10 00:58:38 +00:00
#define GOT_ENTRY_SIZE 4
/* The first three entries in a procedure linkage table are reserved,
and the initial contents are unimportant (we zero them out).
Subsequent entries look like this. See the SVR4 ABI 386
supplement to see how this works. */
/* For the s390, simple addr offset can only be 0 - 4096.
To use the full 2 GB address space, several instructions
are needed to load an address in a register and execute
a branch( or just saving the address)
Furthermore, only r 0 and 1 are free to use!!! */
2001-02-10 00:58:38 +00:00
/* The first 3 words in the GOT are then reserved.
Word 0 is the address of the dynamic table.
Word 1 is a pointer to a structure describing the object
Word 2 is used to point to the loader entry address.
The code for position independent PLT entries looks like this:
2001-02-10 00:58:38 +00:00
r12 holds addr of the current GOT at entry to the PLT
The GOT holds the address in the PLT to be executed.
The loader then gets:
24(15) = Pointer to the structure describing the object.
28(15) = Offset in symbol table
2001-02-10 00:58:38 +00:00
The loader must then find the module where the function is
and insert the address in the GOT.
Note: 390 can only address +- 64 K relative.
We check if offset > 65536, then make a relative branch -64xxx
back to a previous defined branch
PLT1: BASR 1,0 # 2 bytes
L 1,22(1) # 4 bytes Load offset in GOT in r 1
L 1,(1,12) # 4 bytes Load address from GOT in r1
BCR 15,1 # 2 bytes Jump to address
RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
L 1,14(1) # 4 bytes Load offset in symol table in r1
BRC 15,-x # 4 bytes Jump to start of PLT
.word 0 # 2 bytes filler
.long ? # 4 bytes offset in GOT
.long ? # 4 bytes offset into symbol table
This was the general case. There are two additional, optimizes PLT
definitions. One for GOT offsets < 4096 and one for GOT offsets < 32768.
First the one for GOT offsets < 4096:
PLT1: L 1,<offset>(12) # 4 bytes Load address from GOT in R1
BCR 15,1 # 2 bytes Jump to address
.word 0,0,0 # 6 bytes filler
RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
L 1,14(1) # 4 bytes Load offset in symbol table in r1
BRC 15,-x # 4 bytes Jump to start of PLT
.word 0,0,0 # 6 bytes filler
.long ? # 4 bytes offset into symbol table
Second the one for GOT offsets < 32768:
PLT1: LHI 1,<offset> # 4 bytes Load offset in GOT to r1
L 1,(1,12) # 4 bytes Load address from GOT to r1
BCR 15,1 # 2 bytes Jump to address
.word 0 # 2 bytes filler
RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
L 1,14(1) # 4 bytes Load offset in symbol table in r1
BRC 15,-x # 4 bytes Jump to start of PLT
.word 0,0,0 # 6 bytes filler
.long ? # 4 bytes offset into symbol table
Total = 32 bytes per PLT entry
The code for static build PLT entries looks like this:
PLT1: BASR 1,0 # 2 bytes
L 1,22(1) # 4 bytes Load address of GOT entry
L 1,0(0,1) # 4 bytes Load address from GOT in r1
BCR 15,1 # 2 bytes Jump to address
RET1: BASR 1,0 # 2 bytes Return from GOT 1st time
L 1,14(1) # 4 bytes Load offset in symbol table in r1
BRC 15,-x # 4 bytes Jump to start of PLT
.word 0 # 2 bytes filler
.long ? # 4 bytes address of GOT entry
.long ? # 4 bytes offset into symbol table */
#define PLT_PIC_ENTRY_WORD0 0x0d105810
#define PLT_PIC_ENTRY_WORD1 0x10165811
#define PLT_PIC_ENTRY_WORD2 0xc00007f1
#define PLT_PIC_ENTRY_WORD3 0x0d105810
#define PLT_PIC_ENTRY_WORD4 0x100ea7f4
#define PLT_PIC12_ENTRY_WORD0 0x5810c000
#define PLT_PIC12_ENTRY_WORD1 0x07f10000
#define PLT_PIC12_ENTRY_WORD2 0x00000000
#define PLT_PIC12_ENTRY_WORD3 0x0d105810
#define PLT_PIC12_ENTRY_WORD4 0x100ea7f4
#define PLT_PIC16_ENTRY_WORD0 0xa7180000
#define PLT_PIC16_ENTRY_WORD1 0x5811c000
#define PLT_PIC16_ENTRY_WORD2 0x07f10000
#define PLT_PIC16_ENTRY_WORD3 0x0d105810
#define PLT_PIC16_ENTRY_WORD4 0x100ea7f4
#define PLT_ENTRY_WORD0 0x0d105810
#define PLT_ENTRY_WORD1 0x10165810
#define PLT_ENTRY_WORD2 0x100007f1
#define PLT_ENTRY_WORD3 0x0d105810
#define PLT_ENTRY_WORD4 0x100ea7f4
/* The first PLT entry pushes the offset into the symbol table
from R1 onto the stack at 8(15) and the loader object info
at 12(15), loads the loader address in R1 and jumps to it. */
/* The first entry in the PLT for PIC code:
PLT0:
ST 1,28(15) # R1 has offset into symbol table
L 1,4(12) # Get loader ino(object struct address)
ST 1,24(15) # Store address
2001-02-10 00:58:38 +00:00
L 1,8(12) # Entry address of loader in R1
BR 1 # Jump to loader
The first entry in the PLT for static code:
PLT0:
ST 1,28(15) # R1 has offset into symbol table
BASR 1,0
L 1,18(0,1) # Get address of GOT
MVC 24(4,15),4(1) # Move loader ino to stack
L 1,8(1) # Get address of loader
BR 1 # Jump to loader
.word 0 # filler
.long got # address of GOT */
#define PLT_PIC_FIRST_ENTRY_WORD0 0x5010f01c
#define PLT_PIC_FIRST_ENTRY_WORD1 0x5810c004
#define PLT_PIC_FIRST_ENTRY_WORD2 0x5010f018
#define PLT_PIC_FIRST_ENTRY_WORD3 0x5810c008
#define PLT_PIC_FIRST_ENTRY_WORD4 0x07f10000
#define PLT_FIRST_ENTRY_WORD0 0x5010f01c
#define PLT_FIRST_ENTRY_WORD1 0x0d105810
#define PLT_FIRST_ENTRY_WORD2 0x1012D203
#define PLT_FIRST_ENTRY_WORD3 0xf0181004
#define PLT_FIRST_ENTRY_WORD4 0x58101008
#define PLT_FIRST_ENTRY_WORD5 0x07f10000
/* The s390 linker needs to keep track of the number of relocs that it
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
decides to copy as dynamic relocs in check_relocs for each symbol.
This is so that it can later discard them if they are found to be
unnecessary. We store the information in a field extending the
regular ELF linker hash table. */
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_dyn_relocs
2001-02-10 00:58:38 +00:00
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_dyn_relocs *next;
/* The input section of the reloc. */
asection *sec;
/* Total number of relocs copied for the input section. */
2001-02-10 00:58:38 +00:00
bfd_size_type count;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Number of pc-relative relocs copied for the input section. */
bfd_size_type pc_count;
2001-02-10 00:58:38 +00:00
};
/* s390 ELF linker hash entry. */
struct elf_s390_link_hash_entry
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_link_hash_entry elf;
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Track dynamic relocs copied for this symbol. */
struct elf_s390_dyn_relocs *dyn_relocs;
/* Number of GOTPLT references for a function. */
bfd_signed_vma gotplt_refcount;
#define GOT_UNKNOWN 0
#define GOT_NORMAL 1
#define GOT_TLS_GD 2
#define GOT_TLS_IE 3
#define GOT_TLS_IE_NLT 4
unsigned char tls_type;
2001-02-10 00:58:38 +00:00
};
#define elf_s390_hash_entry(ent) \
((struct elf_s390_link_hash_entry *)(ent))
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
/* NOTE: Keep this structure in sync with
the one declared in elf64-s390.c. */
struct elf_s390_obj_tdata
{
struct elf_obj_tdata root;
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
/* TLS type for each local got entry. */
char *local_got_tls_type;
};
#define elf_s390_tdata(abfd) \
((struct elf_s390_obj_tdata *) (abfd)->tdata.any)
#define elf_s390_local_got_tls_type(abfd) \
(elf_s390_tdata (abfd)->local_got_tls_type)
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
#define is_s390_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
&& elf_object_id (bfd) == S390_ELF_TDATA)
static bfd_boolean
elf_s390_mkobject (bfd *abfd)
{
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
return bfd_elf_allocate_object (abfd, sizeof (struct elf_s390_obj_tdata),
S390_ELF_TDATA);
}
static bfd_boolean
elf_s390_object_p (abfd)
bfd *abfd;
{
/* Set the right machine number for an s390 elf32 file. */
return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_31);
}
2001-02-10 00:58:38 +00:00
/* s390 ELF linker hash table. */
struct elf_s390_link_hash_table
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_link_hash_table elf;
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Short-cuts to get to dynamic linker sections. */
asection *sgot;
asection *sgotplt;
asection *srelgot;
asection *splt;
asection *srelplt;
asection *sdynbss;
asection *srelbss;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
union {
bfd_signed_vma refcount;
bfd_vma offset;
} tls_ldm_got;
/* Small local sym cache. */
struct sym_cache sym_cache;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
};
2001-02-10 00:58:38 +00:00
/* Get the s390 ELF linker hash table from a link_info structure. */
#define elf_s390_hash_table(p) \
((struct elf_s390_link_hash_table *) ((p)->hash))
/* Create an entry in an s390 ELF linker hash table. */
static struct bfd_hash_entry *
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
link_hash_newfunc (entry, table, string)
2001-02-10 00:58:38 +00:00
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. */
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (entry == NULL)
{
entry = bfd_hash_allocate (table,
sizeof (struct elf_s390_link_hash_entry));
if (entry == NULL)
return entry;
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
/* Call the allocation method of the superclass. */
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
entry = _bfd_elf_link_hash_newfunc (entry, table, string);
if (entry != NULL)
2001-02-10 00:58:38 +00:00
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_link_hash_entry *eh;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
eh = (struct elf_s390_link_hash_entry *) entry;
eh->dyn_relocs = NULL;
eh->gotplt_refcount = 0;
eh->tls_type = GOT_UNKNOWN;
2001-02-10 00:58:38 +00:00
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
return entry;
2001-02-10 00:58:38 +00:00
}
/* Create an s390 ELF linker hash table. */
static struct bfd_link_hash_table *
elf_s390_link_hash_table_create (abfd)
bfd *abfd;
{
struct elf_s390_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_s390_link_hash_table);
2001-02-10 00:58:38 +00:00
2002-04-04 Daniel Jacobowitz <drow@mvista.com> * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define. * aout-target.h (MY_bfd_link_hash_table_free): Conditionally define. * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise. * bfd.c (bfd_link_hash_table_free): Define. * binary.c (binary_bfd_link_hash_table_free): Define. * bout.c (b_out_bfd_link_hash_table_free): Define. * coff-rs6000.c (rs6000coff_vec): Include _bfd_generic_link_hash_table_free. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define. * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally define. * i386msdos.c (msdos_bfd_link_hash_table_free): Define. * i386os9k.c (os9k_bfd_link_hash_table_free): Define. * ieee.c (ieee_bfd_link_hash_table_free): Define. * ihex.c (ihex_bfd_link_hash_table_free): Define. * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define. (_bfd_generic_link_hash_table_free): Add prototype. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype. * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define. * linker.c (_bfd_generic_link_hash_table_free): New function. * mmo.c (mmo_bfd_link_hash_table_free): Define. * nlm-target.h (nlm_bfd_link_hash_table_free): Define. * oasys.c (oasys_bfd_link_hash_table_free): Define. * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define. * som.c (som_bfd_link_hash_table_free): Define. * srec.c (srec_bfd_link_hash_table_free): Define. * tekhex.c (tekhex_bfd_link_hash_table_free): Define. * versados.c (versados_bfd_link_hash_table_free): Define. * vms.c (vms_bfd_link_hash_table_free): New function. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function. * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc instead of bfd_alloc. * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise. * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise. * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise. * cofflink.c (_bfd_coff_link_hash_table_create): Likewise. * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise. * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise. * elf.c (_bfd_elf_link_hash_table_create): Likewise. * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise. * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise. * elf32-i386.c (elf_i386_link_hash_table_create): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create): Likewise. * elf32-sh.c (sh_elf_link_hash_table_create): Likewise. * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create): Likewise. * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise. * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise. * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise. * linker.c (_bfd_generic_link_hash_table_create): Likewise. * m68klinux.c (linux_link_hash_table_create): Likewise. * sparclinux.c (linux_link_hash_table_create): Likewise. * sunos.c (sunos_link_hash_table_create): Likewise. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise. * targets.c: Add _bfd_link_hash_table_free to xvec. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2002-04-04 19:53:38 +00:00
ret = (struct elf_s390_link_hash_table *) bfd_malloc (amt);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (ret == NULL)
2001-02-10 00:58:38 +00:00
return 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 12:20:16 +00:00
if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
sizeof (struct elf_s390_link_hash_entry)))
2001-02-10 00:58:38 +00:00
{
2002-04-04 Daniel Jacobowitz <drow@mvista.com> * aout-adobe.c (aout_32_bfd_link_hash_table_free): Define. * aout-target.h (MY_bfd_link_hash_table_free): Conditionally define. * aout-tic30.c (MY_bfd_link_hash_table_free): Likewise. * bfd.c (bfd_link_hash_table_free): Define. * binary.c (binary_bfd_link_hash_table_free): Define. * bout.c (b_out_bfd_link_hash_table_free): Define. * coff-rs6000.c (rs6000coff_vec): Include _bfd_generic_link_hash_table_free. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Likewise. (aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_link_hash_table_free): Conditionally define. * elf-m10300.c (elf32_mn10300_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elf32-hppa.c (elf32_hppa_link_hash_table_free): New function. (bfd_elf32_bfd_link_hash_table_free): Define. * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_free): Conditionally define. * i386msdos.c (msdos_bfd_link_hash_table_free): Define. * i386os9k.c (os9k_bfd_link_hash_table_free): Define. * ieee.c (ieee_bfd_link_hash_table_free): Define. * ihex.c (ihex_bfd_link_hash_table_free): Define. * libbfd-in.h (_bfd_nolink_bfd_link_hash_table_free): Define. (_bfd_generic_link_hash_table_free): Add prototype. * libcoff-in.h (_bfd_xcoff_bfd_link_hash_table_free): Add prototype. * libecoff.h (_bfd_ecoff_bfd_link_hash_table_free): Define. * linker.c (_bfd_generic_link_hash_table_free): New function. * mmo.c (mmo_bfd_link_hash_table_free): Define. * nlm-target.h (nlm_bfd_link_hash_table_free): Define. * oasys.c (oasys_bfd_link_hash_table_free): Define. * ppcboot.c (ppcboot_bfd_link_hash_table_free): Define. * som.c (som_bfd_link_hash_table_free): Define. * srec.c (srec_bfd_link_hash_table_free): Define. * tekhex.c (tekhex_bfd_link_hash_table_free): Define. * versados.c (versados_bfd_link_hash_table_free): Define. * vms.c (vms_bfd_link_hash_table_free): New function. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_free): New function. * coff-arm.c (coff_arm_link_hash_table_create): Use bfd_malloc instead of bfd_alloc. * coff-h8300.c (h8300_coff_link_hash_table_create): Likewise. * coff-mcore.c (coff_mcore_link_hash_table_create): Likewise. * coff-ppc.c (ppc_coff_link_hash_table_create): Likewise. * cofflink.c (_bfd_coff_link_hash_table_create): Likewise. * ecoff.c (_bfd_ecoff_bfd_link_hash_table_create): Likewise. * elf-m10300.c (elf32_mn10300_link_hash_table_create): Likewise. * elf.c (_bfd_elf_link_hash_table_create): Likewise. * elf32-arm.h (elf32_arm_link_hash_table_create): Likewise. * elf32-cris.c (elf_cris_link_hash_table_create): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_table_create): Likewise. * elf32-i386.c (elf_i386_link_hash_table_create): Likewise. * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise. * elf32-s390.c (elf_s390_link_hash_table_create): Likewise. * elf32-sh.c (sh_elf_link_hash_table_create): Likewise. * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create): Likewise. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Likewise. * elf64-s390.c (elf_s390_link_hash_table_create): Likewise. * elf64-sh64.c (sh64_elf64_link_hash_table_create): Likewise. * elf64-sparc.c (sparc64_elf_bfd_link_hash_table_create): Likewise. * elf64-x86-64.c (elf64_x86_64_link_hash_table_create): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise. * linker.c (_bfd_generic_link_hash_table_create): Likewise. * m68klinux.c (linux_link_hash_table_create): Likewise. * sparclinux.c (linux_link_hash_table_create): Likewise. * sunos.c (sunos_link_hash_table_create): Likewise. * xcofflink.c (_bfd_xcoff_bfd_link_hash_table_create): Likewise. * targets.c: Add _bfd_link_hash_table_free to xvec. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
2002-04-04 19:53:38 +00:00
free (ret);
2001-02-10 00:58:38 +00:00
return NULL;
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
ret->sgot = NULL;
ret->sgotplt = NULL;
ret->srelgot = NULL;
ret->splt = NULL;
ret->srelplt = NULL;
ret->sdynbss = NULL;
ret->srelbss = NULL;
ret->tls_ldm_got.refcount = 0;
ret->sym_cache.abfd = NULL;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
return &ret->elf.root;
}
/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
shortcuts to them in our hash table. */
static bfd_boolean
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
create_got_section (dynobj, info)
bfd *dynobj;
struct bfd_link_info *info;
{
struct elf_s390_link_hash_table *htab;
if (! _bfd_elf_create_got_section (dynobj, info))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab = elf_s390_hash_table (info);
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
if (!htab->sgot || !htab->sgotplt || !htab->srelgot)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
abort ();
return TRUE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
.rela.bss sections in DYNOBJ, and set up shortcuts to them in our
hash table. */
static bfd_boolean
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
elf_s390_create_dynamic_sections (dynobj, info)
bfd *dynobj;
struct bfd_link_info *info;
{
struct elf_s390_link_hash_table *htab;
htab = elf_s390_hash_table (info);
if (!htab->sgot && !create_got_section (dynobj, info))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab->splt = bfd_get_section_by_name (dynobj, ".plt");
htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
if (!info->shared)
htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
if (!htab->splt || !htab->srelplt || !htab->sdynbss
|| (!info->shared && !htab->srelbss))
abort ();
return TRUE;
2001-02-10 00:58:38 +00:00
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
elf_s390_copy_indirect_symbol (info, dir, ind)
struct bfd_link_info *info;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_link_hash_entry *dir, *ind;
{
struct elf_s390_link_hash_entry *edir, *eind;
edir = (struct elf_s390_link_hash_entry *) dir;
eind = (struct elf_s390_link_hash_entry *) ind;
if (eind->dyn_relocs != NULL)
{
if (edir->dyn_relocs != NULL)
{
struct elf_s390_dyn_relocs **pp;
struct elf_s390_dyn_relocs *p;
/* Add reloc counts against the indirect sym to the direct sym
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
list. Merge any entries against the same section. */
for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
{
struct elf_s390_dyn_relocs *q;
for (q = edir->dyn_relocs; q != NULL; q = q->next)
if (q->sec == p->sec)
{
q->pc_count += p->pc_count;
q->count += p->count;
*pp = p->next;
break;
}
if (q == NULL)
pp = &p->next;
}
*pp = edir->dyn_relocs;
}
edir->dyn_relocs = eind->dyn_relocs;
eind->dyn_relocs = NULL;
}
if (ind->root.type == bfd_link_hash_indirect
&& dir->got.refcount <= 0)
{
edir->tls_type = eind->tls_type;
eind->tls_type = GOT_UNKNOWN;
}
if (ELIMINATE_COPY_RELOCS
&& ind->root.type != bfd_link_hash_indirect
2004-09-16 14:52:12 +00:00
&& dir->dynamic_adjusted)
{
/* If called to transfer flags for a weakdef during processing
of elf_adjust_dynamic_symbol, don't copy non_got_ref.
We clear it ourselves for ELIMINATE_COPY_RELOCS. */
dir->ref_dynamic |= ind->ref_dynamic;
dir->ref_regular |= ind->ref_regular;
dir->ref_regular_nonweak |= ind->ref_regular_nonweak;
dir->needs_plt |= ind->needs_plt;
}
else
_bfd_elf_link_hash_copy_indirect (info, dir, ind);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
2001-02-10 00:58:38 +00:00
static int
elf_s390_tls_transition (info, r_type, is_local)
struct bfd_link_info *info;
int r_type;
int is_local;
{
if (info->shared)
return r_type;
switch (r_type)
{
case R_390_TLS_GD32:
case R_390_TLS_IE32:
if (is_local)
return R_390_TLS_LE32;
return R_390_TLS_IE32;
case R_390_TLS_GOTIE32:
if (is_local)
return R_390_TLS_LE32;
return R_390_TLS_GOTIE32;
case R_390_TLS_LDM32:
return R_390_TLS_LE32;
}
return r_type;
}
2001-02-10 00:58:38 +00:00
/* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage
table. */
static bfd_boolean
2001-02-10 00:58:38 +00:00
elf_s390_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
asection *sec;
const Elf_Internal_Rela *relocs;
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_link_hash_table *htab;
2001-02-10 00:58:38 +00:00
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
asection *sreloc;
bfd_signed_vma *local_got_refcounts;
int tls_type, old_tls_type;
2001-02-10 00:58:38 +00:00
2003-06-25 06:40:27 +00:00
if (info->relocatable)
return TRUE;
2001-02-10 00:58:38 +00:00
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
BFD_ASSERT (is_s390_elf (abfd));
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab = elf_s390_hash_table (info);
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
symtab_hdr = &elf_symtab_hdr (abfd);
2001-02-10 00:58:38 +00:00
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
2001-02-10 00:58:38 +00:00
sreloc = NULL;
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
unsigned int r_type;
2001-02-10 00:58:38 +00:00
unsigned long r_symndx;
struct elf_link_hash_entry *h;
r_symndx = ELF32_R_SYM (rel->r_info);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
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 03:16:01 +00:00
(*_bfd_error_handler) (_("%B: bad symbol index: %d"),
abfd, r_symndx);
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
2001-02-10 00:58:38 +00:00
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
2005-06-20 18:12:11 +00:00
{
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
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;
}
2001-02-10 00:58:38 +00:00
/* Create got section and local_got_refcounts array if they
are needed. */
r_type = elf_s390_tls_transition (info,
ELF32_R_TYPE (rel->r_info),
h == NULL);
switch (r_type)
2001-02-10 00:58:38 +00:00
{
case R_390_GOT12:
case R_390_GOT16:
case R_390_GOT20:
2001-02-10 00:58:38 +00:00
case R_390_GOT32:
case R_390_GOTENT:
case R_390_GOTPLT12:
case R_390_GOTPLT16:
case R_390_GOTPLT20:
case R_390_GOTPLT32:
case R_390_GOTPLTENT:
case R_390_TLS_GD32:
case R_390_TLS_GOTIE12:
case R_390_TLS_GOTIE20:
case R_390_TLS_GOTIE32:
case R_390_TLS_IEENT:
case R_390_TLS_IE32:
case R_390_TLS_LDM32:
if (h == NULL
&& local_got_refcounts == NULL)
2001-02-10 00:58:38 +00:00
{
bfd_size_type size;
size = symtab_hdr->sh_info;
size *= (sizeof (bfd_signed_vma) + sizeof(char));
local_got_refcounts = ((bfd_signed_vma *)
bfd_zalloc (abfd, size));
2001-02-10 00:58:38 +00:00
if (local_got_refcounts == NULL)
return FALSE;
elf_local_got_refcounts (abfd) = local_got_refcounts;
elf_s390_local_got_tls_type (abfd)
= (char *) (local_got_refcounts + symtab_hdr->sh_info);
2001-02-10 00:58:38 +00:00
}
/* Fall through. */
case R_390_GOTOFF16:
case R_390_GOTOFF32:
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
case R_390_GOTPC:
case R_390_GOTPCDBL:
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (htab->sgot == NULL)
{
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
if (!create_got_section (htab->elf.dynobj, info))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
}
switch (r_type)
{
case R_390_GOTOFF16:
case R_390_GOTOFF32:
case R_390_GOTPC:
case R_390_GOTPCDBL:
/* Got is created, nothing to be done. */
2001-02-10 00:58:38 +00:00
break;
case R_390_PLT16DBL:
case R_390_PLT32DBL:
2001-02-10 00:58:38 +00:00
case R_390_PLT32:
case R_390_PLTOFF16:
case R_390_PLTOFF32:
2001-02-10 00:58:38 +00:00
/* This symbol requires a procedure linkage table entry. We
actually build the entry in adjust_dynamic_symbol,
because this might be a case of linking PIC code which is
never referenced by a dynamic object, in which case we
don't need to generate a procedure linkage table entry
after all. */
2001-02-10 00:58:38 +00:00
/* If this is a local symbol, we resolve it directly without
creating a procedure linkage table entry. */
if (h != NULL)
{
2004-09-16 14:52:12 +00:00
h->needs_plt = 1;
h->plt.refcount += 1;
}
break;
2001-02-10 00:58:38 +00:00
case R_390_GOTPLT12:
case R_390_GOTPLT16:
case R_390_GOTPLT20:
case R_390_GOTPLT32:
case R_390_GOTPLTENT:
/* This symbol requires either a procedure linkage table entry
or an entry in the local got. We actually build the entry
in adjust_dynamic_symbol because whether this is really a
global reference can change and with it the fact if we have
to create a plt entry or a local got entry. To be able to
make a once global symbol a local one we have to keep track
of the number of gotplt references that exist for this
symbol. */
if (h != NULL)
{
((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++;
2004-09-16 14:52:12 +00:00
h->needs_plt = 1;
h->plt.refcount += 1;
}
else
local_got_refcounts[r_symndx] += 1;
2001-02-10 00:58:38 +00:00
break;
case R_390_TLS_LDM32:
htab->tls_ldm_got.refcount += 1;
break;
case R_390_TLS_IE32:
case R_390_TLS_GOTIE12:
case R_390_TLS_GOTIE20:
case R_390_TLS_GOTIE32:
case R_390_TLS_IEENT:
if (info->shared)
info->flags |= DF_STATIC_TLS;
/* Fall through. */
case R_390_GOT12:
case R_390_GOT16:
case R_390_GOT20:
case R_390_GOT32:
case R_390_GOTENT:
case R_390_TLS_GD32:
/* This symbol requires a global offset table entry. */
switch (r_type)
{
default:
case R_390_GOT12:
case R_390_GOT16:
case R_390_GOT20:
case R_390_GOT32:
case R_390_GOTENT:
tls_type = GOT_NORMAL;
break;
case R_390_TLS_GD32:
tls_type = GOT_TLS_GD;
break;
case R_390_TLS_IE32:
case R_390_TLS_GOTIE32:
tls_type = GOT_TLS_IE;
break;
case R_390_TLS_GOTIE12:
case R_390_TLS_GOTIE20:
case R_390_TLS_IEENT:
tls_type = GOT_TLS_IE_NLT;
break;
}
if (h != NULL)
{
h->got.refcount += 1;
old_tls_type = elf_s390_hash_entry(h)->tls_type;
}
else
{
local_got_refcounts[r_symndx] += 1;
old_tls_type = elf_s390_local_got_tls_type (abfd) [r_symndx];
}
/* If a TLS symbol is accessed using IE at least once,
there is no point to use dynamic model for it. */
if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN)
{
if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL)
{
(*_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 03:16:01 +00:00
(_("%B: `%s' accessed both as normal and thread local symbol"),
abfd, h->root.root.string);
return FALSE;
}
if (old_tls_type > tls_type)
tls_type = old_tls_type;
}
if (old_tls_type != tls_type)
{
if (h != NULL)
elf_s390_hash_entry (h)->tls_type = tls_type;
else
elf_s390_local_got_tls_type (abfd) [r_symndx] = tls_type;
}
if (r_type != R_390_TLS_IE32)
break;
/* Fall through. */
case R_390_TLS_LE32:
if (!info->shared)
break;
info->flags |= DF_STATIC_TLS;
/* Fall through. */
case R_390_8:
case R_390_16:
2001-02-10 00:58:38 +00:00
case R_390_32:
case R_390_PC16:
case R_390_PC16DBL:
case R_390_PC32DBL:
2001-02-10 00:58:38 +00:00
case R_390_PC32:
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (h != NULL && !info->shared)
{
/* If this reloc is in a read-only section, we might
need a copy reloc. We can't check reliably at this
stage whether the section is read-only, as input
sections have not yet been mapped to output sections.
Tentatively set the flag for now, and correct in
adjust_dynamic_symbol. */
2004-09-16 14:52:12 +00:00
h->non_got_ref = 1;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
h->plt.refcount += 1;
}
2001-02-10 00:58:38 +00:00
/* If we are creating a shared library, and this is a reloc
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
against a global symbol, or a non PC relative reloc
against a local symbol, then we need to copy the reloc
into the shared library. However, if we are linking with
-Bsymbolic, we do not need to copy a reloc against a
global symbol which is defined in an object we are
including in the link (i.e., DEF_REGULAR is set). At
this point we have not seen all the input files, so it is
possible that DEF_REGULAR is not set now but will be set
later (it is never cleared). In case of a weak definition,
DEF_REGULAR may be cleared later by a strong definition in
a shared library. We account for that possibility below by
storing information in the relocs_copied field of the hash
table entry. A similar situation occurs when creating
shared libraries and symbol visibility changes render the
symbol local.
If on the other hand, we are creating an executable, we
may need to keep relocations for symbols satisfied by a
dynamic library if we manage to avoid copy relocs for the
symbol. */
if ((info->shared
&& (sec->flags & SEC_ALLOC) != 0
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
&& ((ELF32_R_TYPE (rel->r_info) != R_390_PC16
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
&& ELF32_R_TYPE (rel->r_info) != R_390_PC16DBL
&& ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
&& ELF32_R_TYPE (rel->r_info) != R_390_PC32)
|| (h != NULL
&& (! SYMBOLIC_BIND (info, h)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
|| h->root.type == bfd_link_hash_defweak
2004-09-16 14:52:12 +00:00
|| !h->def_regular))))
|| (ELIMINATE_COPY_RELOCS
&& !info->shared
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
2004-09-16 14:52:12 +00:00
|| !h->def_regular)))
2001-02-10 00:58:38 +00:00
{
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
struct elf_s390_dyn_relocs *p;
struct elf_s390_dyn_relocs **head;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* We must copy these reloc types into the output file.
Create a reloc section in dynobj and make room for
this reloc. */
2001-02-10 00:58:38 +00:00
if (sreloc == NULL)
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
2001-02-10 00:58:38 +00:00
* 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 13:03:56 +00:00
sreloc = _bfd_elf_make_dynamic_reloc_section
(sec, htab->elf.dynobj, 2, abfd, /*rela?*/ TRUE);
2001-02-10 00:58:38 +00:00
if (sreloc == 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 13:03:56 +00:00
return FALSE;
2001-02-10 00:58:38 +00:00
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* If this is a global symbol, we count the number of
relocations we need for this symbol. */
if (h != NULL)
2001-02-10 00:58:38 +00:00
{
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
head = &((struct elf_s390_link_hash_entry *) h)->dyn_relocs;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
else
{
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
/* Track dynamic relocs needed for local syms too.
We really need local syms available to do this
easily. Oh well. */
asection *s;
void *vpp;
Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache,
abfd, r_symndx);
if (isym == NULL)
return FALSE;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
s = bfd_section_from_elf_index (abfd, isym->st_shndx);
if (s == NULL)
s = sec;
vpp = &elf_section_data (s)->local_dynrel;
head = (struct elf_s390_dyn_relocs **) vpp;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
}
p = *head;
if (p == NULL || p->sec != sec)
{
bfd_size_type amt = sizeof *p;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
p = ((struct elf_s390_dyn_relocs *)
bfd_alloc (htab->elf.dynobj, amt));
if (p == NULL)
return FALSE;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
p->next = *head;
*head = p;
p->sec = sec;
p->count = 0;
p->pc_count = 0;
2001-02-10 00:58:38 +00:00
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
p->count += 1;
if (ELF32_R_TYPE (rel->r_info) == R_390_PC16
|| ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL
|| ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
|| ELF32_R_TYPE (rel->r_info) == R_390_PC32)
p->pc_count += 1;
2001-02-10 00:58:38 +00:00
}
break;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
case R_390_GNU_VTINHERIT:
* Makefile.am: Remove all mention of elflink.h. * Makefile.in: Regenerate. * bfd-in.h (bfd_elf_discard_info): Declare. (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. * bfd-in2.h: Regenerate. * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, bfd_elf32_link_record_dynamic_symbol, bfd_elf64_link_record_dynamic_symbol, _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, _bfd_elf32_link_record_local_dynamic_symbol, _bfd_elf64_link_record_local_dynamic_symbol, _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, _bfd_elf32_reloc_symbol_deleted_p, _bfd_elf64_reloc_symbol_deleted_p): Delete. (bfd_elf_link_record_dynamic_symbol, bfd_elf_link_record_local_dynamic_symbol, bfd_elf_final_link, bfd_elf_gc_sections, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, bfd_elf_reloc_symbol_deleted_p): Declare. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. * elf32-arm.h: Update for changed function names. Remove local WILL_CALL_FINISH_DYNAMIC_SECTION define. * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. (bfd_elfNN_print_symbol): Define. * elfcode.h: Don't include elflink.h. (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, elf_gc_record_vtinherit, elf_gc_record_vtentry, elf_link_record_local_dynamic_symbol): Don't define. * elflink.c: Update for changed function names. Move elflink.h code here. * elflink.h: Delete file. * po/SRC-POTFILES.in: Regenerate. * po/bfd.pot: Regenerate. doc/ * bfdint.texi: Remove all mention of elflink.h.
2004-03-27 10:58:09 +00:00
if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
return FALSE;
break;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_390_GNU_VTENTRY:
bfd/ 2007-09-26 Jan Beulich <jbeulich@novell.com> * elf32-i386.c (elf_i386_check_relocs): Revert NULL pointer check for R_386_GNU_VTINHERIT. * elf-m10300.c (mn10300_elf_check_relocs): Check for NULL pointer for R_xxx_GNU_VTENTRY. * elf32-arm.c (elf32_arm_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Likewise. (bfinfdpic_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-d10v.c (elf32_d10v_check_relocs): Likewise. * elf32-dlx.c (elf32_dlx_check_relocs): Likewise. * elf32-fr30.c (fr30_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-iq2000.c (iq2000_elf_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-mcore.c (mcore_elf_check_relocs): Likewise. * elf32-openrisc.c (openrisc_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_check_relocs): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-score.c (_bfd_score_elf_check_relocs): Likewise. * elf32-sh.c (sh_elf_check_relocs): Likewise. * elf32-v850.c (v850_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_check_relocs): Likewise. * elf64-mmix.c (mmix_elf_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-sh64.c (sh_elf64_check_relocs): Likewise. * elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
2007-09-26 13:45:32 +00:00
BFD_ASSERT (h != NULL);
if (h != NULL
&& !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return FALSE;
break;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
default:
break;
}
}
return TRUE;
2001-02-10 00:58:38 +00:00
}
/* Return the section that should be marked against GC for a given
relocation. */
static asection *
* 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 13:27:33 +00:00
elf_s390_gc_mark_hook (asection *sec,
struct bfd_link_info *info,
Elf_Internal_Rela *rel,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
2001-02-10 00:58:38 +00:00
{
if (h != NULL)
* 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 13:27:33 +00:00
switch (ELF32_R_TYPE (rel->r_info))
{
case R_390_GNU_VTINHERIT:
case R_390_GNU_VTENTRY:
return NULL;
}
return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
2001-02-10 00:58:38 +00:00
}
/* Update the got entry reference counts for the section being removed. */
static bfd_boolean
* 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 13:27:33 +00:00
elf_s390_gc_sweep_hook (bfd *abfd,
struct bfd_link_info *info,
asection *sec,
const Elf_Internal_Rela *relocs)
2001-02-10 00:58:38 +00:00
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel, *relend;
if (info->relocatable)
return TRUE;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
elf_section_data (sec)->local_dynrel = NULL;
2001-02-10 00:58:38 +00:00
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
symtab_hdr = &elf_symtab_hdr (abfd);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
2001-02-10 00:58:38 +00:00
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
{
unsigned long r_symndx;
unsigned int r_type;
struct elf_link_hash_entry *h = NULL;
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
{
struct elf_s390_link_hash_entry *eh;
struct elf_s390_dyn_relocs **pp;
struct elf_s390_dyn_relocs *p;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
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;
eh = (struct elf_s390_link_hash_entry *) h;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
if (p->sec == sec)
{
/* Everything must go for SEC. */
*pp = p->next;
break;
}
}
r_type = ELF32_R_TYPE (rel->r_info);
r_type = elf_s390_tls_transition (info, r_type, h != NULL);
switch (r_type)
{
case R_390_TLS_LDM32:
if (elf_s390_hash_table (info)->tls_ldm_got.refcount > 0)
elf_s390_hash_table (info)->tls_ldm_got.refcount -= 1;
break;
case R_390_TLS_GD32:
case R_390_TLS_IE32:
case R_390_TLS_GOTIE12:
case R_390_TLS_GOTIE20:
case R_390_TLS_GOTIE32:
case R_390_TLS_IEENT:
case R_390_GOT12:
case R_390_GOT16:
case R_390_GOT20:
case R_390_GOT32:
case R_390_GOTOFF16:
case R_390_GOTOFF32:
case R_390_GOTPC:
case R_390_GOTPCDBL:
case R_390_GOTENT:
if (h != NULL)
{
if (h->got.refcount > 0)
h->got.refcount -= 1;
}
else if (local_got_refcounts != NULL)
{
if (local_got_refcounts[r_symndx] > 0)
local_got_refcounts[r_symndx] -= 1;
}
break;
2001-02-10 00:58:38 +00:00
case R_390_8:
case R_390_12:
case R_390_16:
case R_390_20:
case R_390_32:
case R_390_PC16:
case R_390_PC16DBL:
case R_390_PC32DBL:
case R_390_PC32:
if (info->shared)
break;
/* Fall through. */
case R_390_PLT16DBL:
case R_390_PLT32DBL:
case R_390_PLT32:
case R_390_PLTOFF16:
case R_390_PLTOFF32:
if (h != NULL)
{
if (h->plt.refcount > 0)
h->plt.refcount -= 1;
}
break;
case R_390_GOTPLT12:
case R_390_GOTPLT16:
case R_390_GOTPLT20:
case R_390_GOTPLT32:
case R_390_GOTPLTENT:
if (h != NULL)
{
if (h->plt.refcount > 0)
{
((struct elf_s390_link_hash_entry *) h)->gotplt_refcount--;
h->plt.refcount -= 1;
}
}
else if (local_got_refcounts != NULL)
{
if (local_got_refcounts[r_symndx] > 0)
local_got_refcounts[r_symndx] -= 1;
}
break;
default:
break;
}
}
2001-02-10 00:58:38 +00:00
return TRUE;
2001-02-10 00:58:38 +00:00
}
/* Make sure we emit a GOT entry if the symbol was supposed to have a PLT
entry but we found we will not create any. Called when we find we will
not have any PLT for this symbol, by for example
elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link,
or elf_s390_size_dynamic_sections if no dynamic sections will be
created (we're only linking static objects). */
static void
elf_s390_adjust_gotplt (h)
struct elf_s390_link_hash_entry *h;
{
if (h->elf.root.type == bfd_link_hash_warning)
h = (struct elf_s390_link_hash_entry *) h->elf.root.u.i.link;
if (h->gotplt_refcount <= 0)
return;
/* We simply add the number of gotplt references to the number
* of got references for this symbol. */
h->elf.got.refcount += h->gotplt_refcount;
h->gotplt_refcount = -1;
}
2001-02-10 00:58:38 +00:00
/* Adjust a symbol defined by a dynamic object and referenced by a
regular object. The current definition is in some section of the
dynamic object, but we're not including those sections. We have to
change the definition to something the rest of the link can
understand. */
static bfd_boolean
2001-02-10 00:58:38 +00:00
elf_s390_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_link_hash_table *htab;
2001-02-10 00:58:38 +00:00
asection *s;
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later
(although we could actually do it here). */
2001-02-10 00:58:38 +00:00
if (h->type == STT_FUNC
2004-09-16 14:52:12 +00:00
|| h->needs_plt)
2001-02-10 00:58:38 +00:00
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (h->plt.refcount <= 0
|| SYMBOL_CALLS_LOCAL (info, h)
|| (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
&& h->root.type != bfd_link_hash_undefweak))
2001-02-10 00:58:38 +00:00
{
/* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic
object, or if all references were garbage collected. In
2001-02-10 00:58:38 +00:00
such a case, we don't actually need to build a procedure
linkage table, and we can just do a PC32 reloc instead. */
h->plt.offset = (bfd_vma) -1;
2004-09-16 14:52:12 +00:00
h->needs_plt = 0;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
2001-02-10 00:58:38 +00:00
}
return TRUE;
2001-02-10 00:58:38 +00:00
}
else
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* It's possible that we incorrectly decided a .plt reloc was
needed for an R_390_PC32 reloc to a non-function sym in
check_relocs. We can't decide accurately between function and
non-function syms in check-relocs; Objects loaded later in
the link may change h->type. So fix it now. */
h->plt.offset = (bfd_vma) -1;
2001-02-10 00:58:38 +00:00
/* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */
if (h->u.weakdef != NULL)
2001-02-10 00:58:38 +00:00
{
BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
|| h->u.weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->u.weakdef->root.u.def.section;
h->root.u.def.value = h->u.weakdef->root.u.def.value;
if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
h->non_got_ref = h->u.weakdef->non_got_ref;
return TRUE;
2001-02-10 00:58:38 +00:00
}
/* This is a reference to a symbol defined by a dynamic object which
is not a function. */
/* If we are creating a shared library, we must presume that the
only references to the symbol are via the global offset table.
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
if (info->shared)
return TRUE;
2001-02-10 00:58:38 +00:00
/* If there are no references to this symbol that do not use the
GOT, we don't need to generate a copy reloc. */
2004-09-16 14:52:12 +00:00
if (!h->non_got_ref)
return TRUE;
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* If -z nocopyreloc was given, we won't generate them either. */
if (info->nocopyreloc)
{
2004-09-16 14:52:12 +00:00
h->non_got_ref = 0;
return TRUE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
if (ELIMINATE_COPY_RELOCS)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
struct elf_s390_link_hash_entry * eh;
struct elf_s390_dyn_relocs *p;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
eh = (struct elf_s390_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{
s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
break;
}
/* If we didn't find any dynamic relocs in read-only sections, then
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (p == NULL)
{
2004-09-16 14:52:12 +00:00
h->non_got_ref = 0;
return TRUE;
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
if (h->size == 0)
{
(*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
h->root.root.string);
return TRUE;
}
2001-02-10 00:58:38 +00:00
/* We must allocate the symbol in our .dynbss section, which will
become part of the .bss section of the executable. There will be
an entry for this symbol in the .dynsym section. The dynamic
object will contain position independent code, so all references
from the dynamic object to this symbol will go through the global
offset table. The dynamic linker will use the .dynsym entry to
determine the address it must put in the global offset table, so
both the dynamic object and the regular object will refer to the
same memory location for the variable. */
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab = elf_s390_hash_table (info);
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* We must generate a R_390_COPY reloc to tell the dynamic linker to
copy the initial value out of the dynamic object and into the
runtime process image. */
2001-02-10 00:58:38 +00:00
if ((h->root.u.def.section->flags & SEC_ALLOC) != 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 04:46:28 +00:00
htab->srelbss->size += sizeof (Elf32_External_Rela);
2004-09-16 14:52:12 +00:00
h->needs_copy = 1;
2001-02-10 00:58:38 +00:00
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
s = htab->sdynbss;
2001-02-10 00:58:38 +00:00
return _bfd_elf_adjust_dynamic_copy (h, s);
2001-02-10 00:58:38 +00:00
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Allocate space in .plt, .got and associated reloc sections for
dynamic relocs. */
static bfd_boolean
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
allocate_dynrelocs (h, inf)
struct elf_link_hash_entry *h;
PTR inf;
{
struct bfd_link_info *info;
struct elf_s390_link_hash_table *htab;
struct elf_s390_link_hash_entry *eh;
struct elf_s390_dyn_relocs *p;
* linker.c (link_action): Ignore duplicate warning syms. (_bfd_generic_link_write_global_symbol): Follow warning symbol link. * elflink.h (elf_adjust_dynstr_offsets): Likewise. (elf_adjust_dynamic_symbol): Likewise. (elf_export_symbol): Likewise. (elf_link_find_version_dependencies): Likewise. (elf_link_assign_sym_version): Likewise. (elf_link_sec_merge_syms): Likewise. (elf_link_output_extsym): Likewise. (elf_gc_sweep_symbol): Likewise. (elf_gc_propagate_vtable_entries_used): Likewise. (elf_gc_smash_unused_vtentry_relocs): Likewise. (elf_gc_allocate_got_offsets): Likewise. (elf_collect_hash_codes): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise. * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise. (elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.h (elf32_arm_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise. (elf_cris_discard_excess_dso_dynamics): Likewise. * elf32-hppa.c (clobber_millicode_symbols): Likewise. (mark_PIC_calls): Likewise. (allocate_plt_static): Likewise. (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-i386.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-mips.c (mips_elf_output_extsym): Likewise. (mips_elf_sort_hash_table_f): Likewise. (mips_elf_check_mips16_stubs): Likewise. * elf32-s390.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-sh.c (sh_elf_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise. (xstormy16_relax_plt_realloc): Likewise. * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise. (elf64_alpha_output_extsym): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise. * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise. (mips_elf64_check_mips16_stubs): Likewise. (mips_elf64_output_extsym): Likewise. * elf64-ppc.c (func_desc_adjust): Likewise. (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf64-s390.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise. * aoutx.h (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_task_globals): Likewise. (_bfd_coff_write_global_sym): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_build_ldsyms): Likewise. (xcoff_write_global_symbol): Likewise. * cofflink.c (_bfd_coff_final_link): Formatting. * cpu-mips.c (mips_compatible): Make static, prototype. * elf32-i386.c (elf_i386_check_relocs): Formatting. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym): Likewise. * elf64-mips.c (mips_elf64_sort_hash_table): Likewise. (mips_elf64_final_link): Likewise. * elflink.h (elf_link_find_version_dependencies): Remove duplicate prototype.
2002-03-28 03:27:46 +00:00
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
* linker.c (link_action): Ignore duplicate warning syms. (_bfd_generic_link_write_global_symbol): Follow warning symbol link. * elflink.h (elf_adjust_dynstr_offsets): Likewise. (elf_adjust_dynamic_symbol): Likewise. (elf_export_symbol): Likewise. (elf_link_find_version_dependencies): Likewise. (elf_link_assign_sym_version): Likewise. (elf_link_sec_merge_syms): Likewise. (elf_link_output_extsym): Likewise. (elf_gc_sweep_symbol): Likewise. (elf_gc_propagate_vtable_entries_used): Likewise. (elf_gc_smash_unused_vtentry_relocs): Likewise. (elf_gc_allocate_got_offsets): Likewise. (elf_collect_hash_codes): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise. * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise. (elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.h (elf32_arm_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise. (elf_cris_discard_excess_dso_dynamics): Likewise. * elf32-hppa.c (clobber_millicode_symbols): Likewise. (mark_PIC_calls): Likewise. (allocate_plt_static): Likewise. (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-i386.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-mips.c (mips_elf_output_extsym): Likewise. (mips_elf_sort_hash_table_f): Likewise. (mips_elf_check_mips16_stubs): Likewise. * elf32-s390.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-sh.c (sh_elf_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise. (xstormy16_relax_plt_realloc): Likewise. * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise. (elf64_alpha_output_extsym): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise. * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise. (mips_elf64_check_mips16_stubs): Likewise. (mips_elf64_output_extsym): Likewise. * elf64-ppc.c (func_desc_adjust): Likewise. (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf64-s390.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise. * aoutx.h (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_task_globals): Likewise. (_bfd_coff_write_global_sym): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_build_ldsyms): Likewise. (xcoff_write_global_symbol): Likewise. * cofflink.c (_bfd_coff_final_link): Formatting. * cpu-mips.c (mips_compatible): Make static, prototype. * elf32-i386.c (elf_i386_check_relocs): Formatting. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym): Likewise. * elf64-mips.c (mips_elf64_sort_hash_table): Likewise. (mips_elf64_final_link): Likewise. * elflink.h (elf_link_find_version_dependencies): Remove duplicate prototype.
2002-03-28 03:27:46 +00:00
if (h->root.type == bfd_link_hash_warning)
/* When warning symbols are created, they **replace** the "real"
entry in the hash table, thus we never get to see the real
symbol in a hash traversal. So look at it now. */
* linker.c (link_action): Ignore duplicate warning syms. (_bfd_generic_link_write_global_symbol): Follow warning symbol link. * elflink.h (elf_adjust_dynstr_offsets): Likewise. (elf_adjust_dynamic_symbol): Likewise. (elf_export_symbol): Likewise. (elf_link_find_version_dependencies): Likewise. (elf_link_assign_sym_version): Likewise. (elf_link_sec_merge_syms): Likewise. (elf_link_output_extsym): Likewise. (elf_gc_sweep_symbol): Likewise. (elf_gc_propagate_vtable_entries_used): Likewise. (elf_gc_smash_unused_vtentry_relocs): Likewise. (elf_gc_allocate_got_offsets): Likewise. (elf_collect_hash_codes): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise. * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise. (elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.h (elf32_arm_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise. (elf_cris_discard_excess_dso_dynamics): Likewise. * elf32-hppa.c (clobber_millicode_symbols): Likewise. (mark_PIC_calls): Likewise. (allocate_plt_static): Likewise. (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-i386.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-mips.c (mips_elf_output_extsym): Likewise. (mips_elf_sort_hash_table_f): Likewise. (mips_elf_check_mips16_stubs): Likewise. * elf32-s390.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-sh.c (sh_elf_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise. (xstormy16_relax_plt_realloc): Likewise. * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise. (elf64_alpha_output_extsym): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise. * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise. (mips_elf64_check_mips16_stubs): Likewise. (mips_elf64_output_extsym): Likewise. * elf64-ppc.c (func_desc_adjust): Likewise. (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf64-s390.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise. * aoutx.h (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_task_globals): Likewise. (_bfd_coff_write_global_sym): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_build_ldsyms): Likewise. (xcoff_write_global_symbol): Likewise. * cofflink.c (_bfd_coff_final_link): Formatting. * cpu-mips.c (mips_compatible): Make static, prototype. * elf32-i386.c (elf_i386_check_relocs): Formatting. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym): Likewise. * elf64-mips.c (mips_elf64_sort_hash_table): Likewise. (mips_elf64_final_link): Likewise. * elflink.h (elf_link_find_version_dependencies): Remove duplicate prototype.
2002-03-28 03:27:46 +00:00
h = (struct elf_link_hash_entry *) h->root.u.i.link;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
info = (struct bfd_link_info *) inf;
htab = elf_s390_hash_table (info);
if (htab->elf.dynamic_sections_created
&& h->plt.refcount > 0)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
2004-09-16 14:52:12 +00:00
&& !h->forced_local)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00: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 10:58:09 +00:00
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
if (info->shared
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
asection *s = htab->splt;
/* If this is the first .plt entry, make room for the special
first entry. */
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
if (s->size == 0)
s->size += PLT_FIRST_ENTRY_SIZE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00: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 04:46:28 +00:00
h->plt.offset = s->size;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* If this symbol is not defined in a regular file, and we are
not generating a shared library, then set the symbol to this
location in the .plt. This is required to make function
pointers compare as equal between the normal executable and
the shared library. */
if (! info->shared
2004-09-16 14:52:12 +00:00
&& !h->def_regular)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
h->root.u.def.section = s;
h->root.u.def.value = h->plt.offset;
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Make room for this entry. */
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
s->size += PLT_ENTRY_SIZE;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
htab->sgotplt->size += GOT_ENTRY_SIZE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* We also need to make an entry in the .rela.plt section. */
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
htab->srelplt->size += sizeof (Elf32_External_Rela);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
else
{
h->plt.offset = (bfd_vma) -1;
2004-09-16 14:52:12 +00:00
h->needs_plt = 0;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
else
{
h->plt.offset = (bfd_vma) -1;
2004-09-16 14:52:12 +00:00
h->needs_plt = 0;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
}
/* If R_390_TLS_{IE32,GOTIE32,GOTIE12,IEENT} symbol is now local to
the binary, we can optimize a bit. IE32 and GOTIE32 get converted
to R_390_TLS_LE32 requiring no TLS entry. For GOTIE12 and IEENT
we can save the dynamic TLS relocation. */
if (h->got.refcount > 0
&& !info->shared
&& h->dynindx == -1
&& elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
if (elf_s390_hash_entry(h)->tls_type == GOT_TLS_IE_NLT)
/* For the GOTIE access without a literal pool entry the offset has
to be stored somewhere. The immediate value in the instruction
is not bit enough so the value is stored in the got. */
{
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
h->got.offset = htab->sgot->size;
htab->sgot->size += GOT_ENTRY_SIZE;
}
else
h->got.offset = (bfd_vma) -1;
}
else if (h->got.refcount > 0)
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
asection *s;
bfd_boolean dyn;
int tls_type = elf_s390_hash_entry(h)->tls_type;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
2004-09-16 14:52:12 +00:00
&& !h->forced_local)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00: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 10:58:09 +00:00
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
s = htab->sgot;
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
h->got.offset = s->size;
s->size += GOT_ENTRY_SIZE;
/* R_390_TLS_GD32 needs 2 consecutive GOT slots. */
if (tls_type == GOT_TLS_GD)
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
s->size += GOT_ENTRY_SIZE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
dyn = htab->elf.dynamic_sections_created;
/* R_390_TLS_IE32 needs one dynamic relocation,
R_390_TLS_GD32 needs one if local symbol and two if global. */
if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
|| tls_type >= GOT_TLS_IE)
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
htab->srelgot->size += sizeof (Elf32_External_Rela);
else if (tls_type == GOT_TLS_GD)
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)
&& (info->shared
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
htab->srelgot->size += sizeof (Elf32_External_Rela);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
else
h->got.offset = (bfd_vma) -1;
eh = (struct elf_s390_link_hash_entry *) h;
if (eh->dyn_relocs == NULL)
return TRUE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* In the shared -Bsymbolic case, discard space allocated for
dynamic pc-relative relocs against symbols which turn out to be
defined in regular objects. For the normal shared case, discard
space for pc-relative relocs that have become local due to symbol
visibility changes. */
if (info->shared)
{
if (SYMBOL_CALLS_LOCAL (info, h))
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
struct elf_s390_dyn_relocs **pp;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
{
p->count -= p->pc_count;
p->pc_count = 0;
if (p->count == 0)
*pp = p->next;
else
pp = &p->next;
}
}
/* Also discard relocs on undefined weak syms with non-default
visibility. */
if (eh->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefweak)
{
if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
eh->dyn_relocs = NULL;
/* Make sure undefined weak symbols are output as a dynamic
symbol in PIEs. */
else if (h->dynindx == -1
&& !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
}
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
else if (ELIMINATE_COPY_RELOCS)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
/* For the non-shared case, discard space for relocs against
symbols which turn out to need copy relocs or are not
dynamic. */
2004-09-16 14:52:12 +00:00
if (!h->non_got_ref
&& ((h->def_dynamic
&& !h->def_regular)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
|| (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined))))
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
2004-09-16 14:52:12 +00:00
&& !h->forced_local)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00: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 10:58:09 +00:00
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
/* If that succeeded, we know we'll be keeping all the
relocs. */
if (h->dynindx != -1)
goto keep;
}
eh->dyn_relocs = NULL;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
keep: ;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
/* Finally, allocate space. */
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{
asection *sreloc = elf_section_data (p->sec)->sreloc;
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
sreloc->size += p->count * sizeof (Elf32_External_Rela);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
return TRUE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
/* Find any dynamic relocs that apply to read-only sections. */
static bfd_boolean
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
readonly_dynrelocs (h, inf)
struct elf_link_hash_entry *h;
PTR inf;
{
struct elf_s390_link_hash_entry *eh;
struct elf_s390_dyn_relocs *p;
* linker.c (link_action): Ignore duplicate warning syms. (_bfd_generic_link_write_global_symbol): Follow warning symbol link. * elflink.h (elf_adjust_dynstr_offsets): Likewise. (elf_adjust_dynamic_symbol): Likewise. (elf_export_symbol): Likewise. (elf_link_find_version_dependencies): Likewise. (elf_link_assign_sym_version): Likewise. (elf_link_sec_merge_syms): Likewise. (elf_link_output_extsym): Likewise. (elf_gc_sweep_symbol): Likewise. (elf_gc_propagate_vtable_entries_used): Likewise. (elf_gc_smash_unused_vtentry_relocs): Likewise. (elf_gc_allocate_got_offsets): Likewise. (elf_collect_hash_codes): Likewise. * elflink.c (elf_link_renumber_hash_table_dynsyms): Likewise. * elf-hppa.h (elf_hppa_unmark_useless_dynamic_symbols): Likewise. (elf_hppa_remark_useless_dynamic_symbols): Likewise. * elf-m10300.c (elf32_mn10300_finish_hash_table_entry): Likewise. * elf32-arm.h (elf32_arm_discard_copies): Likewise. * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Likewise. (elf_cris_discard_excess_dso_dynamics): Likewise. * elf32-hppa.c (clobber_millicode_symbols): Likewise. (mark_PIC_calls): Likewise. (allocate_plt_static): Likewise. (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-i386.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-i370.c (i370_elf_adjust_dynindx): Likewise. * elf32-m68k.c (elf_m68k_discard_copies): Likewise. * elf32-mips.c (mips_elf_output_extsym): Likewise. (mips_elf_sort_hash_table_f): Likewise. (mips_elf_check_mips16_stubs): Likewise. * elf32-s390.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf32-sh.c (sh_elf_discard_copies): Likewise. * elf32-xstormy16.c (xstormy16_relax_plt_check): Likewise. (xstormy16_relax_plt_realloc): Likewise. * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Likewise. (elf64_alpha_output_extsym): Likewise. * elf64-hppa.c (elf64_hppa_mark_exported_functions): Likewise. * elf64-mips.c (mips_elf64_sort_hash_table_f): Likewise. (mips_elf64_check_mips16_stubs): Likewise. (mips_elf64_output_extsym): Likewise. * elf64-ppc.c (func_desc_adjust): Likewise. (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf64-s390.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elf64-sh64.c (sh64_elf64_discard_copies): Likewise. * elf64-x86-64.c (allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. * elfxx-ia64.c (elfNN_ia64_global_dyn_sym_thunk): Likewise. * aoutx.h (aout_link_write_other_symbol): Likewise. * cofflink.c (_bfd_coff_write_task_globals): Likewise. (_bfd_coff_write_global_sym): Likewise. * i386linux.c (linux_tally_symbols): Likewise. * m68klinux.c (linux_tally_symbols): Likewise. * sparclinux.c (linux_tally_symbols): Likewise. * pdp11.c (aout_link_write_other_symbol): Likewise. * sunos.c (sunos_scan_dynamic_symbol): Likewise. * xcofflink.c (xcoff_build_ldsyms): Likewise. (xcoff_write_global_symbol): Likewise. * cofflink.c (_bfd_coff_final_link): Formatting. * cpu-mips.c (mips_compatible): Make static, prototype. * elf32-i386.c (elf_i386_check_relocs): Formatting. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf64-alpha.c (elf64_alpha_output_extsym): Likewise. * elf64-mips.c (mips_elf64_sort_hash_table): Likewise. (mips_elf64_final_link): Likewise. * elflink.h (elf_link_find_version_dependencies): Remove duplicate prototype.
2002-03-28 03:27:46 +00:00
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
eh = (struct elf_s390_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
{
struct bfd_link_info *info = (struct bfd_link_info *) inf;
info->flags |= DF_TEXTREL;
/* Not an error, just cut short the traversal. */
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
}
return TRUE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
2001-02-10 00:58:38 +00:00
/* Set the sizes of the dynamic sections. */
static bfd_boolean
2001-02-10 00:58:38 +00:00
elf_s390_size_dynamic_sections (output_bfd, info)
bfd *output_bfd ATTRIBUTE_UNUSED;
2001-02-10 00:58:38 +00:00
struct bfd_link_info *info;
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_link_hash_table *htab;
2001-02-10 00:58:38 +00:00
bfd *dynobj;
asection *s;
bfd_boolean relocs;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd *ibfd;
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab = elf_s390_hash_table (info);
dynobj = htab->elf.dynobj;
if (dynobj == NULL)
abort ();
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (htab->elf.dynamic_sections_created)
2001-02-10 00:58:38 +00:00
{
/* Set the contents of the .interp section to the interpreter. */
bfd/ * elflink.h (elf_link_add_object_symbols): Use !info->executable instead of info->shared where appropriate. (bfd_elfNN_size_dynamic_sections, elf_link_output_extsym): Likewise. * elflink.c (_bfd_elf_create_got_section): Likewise. (_bfd_elf_link_create_dynamic_sections): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. * elf32-i386.c (elf_i386_size_dynamic_sections): Create .interp section and DT_DEBUG dynamic tag even for position independent executables. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. * elf32-s390.c (elf_s390_size_dynamic_sections: Likewise. * elf64-ppc.c (ppc64_elf_size_dynamic_sections: Likewise. * elf64-s390.c (elf_s390_size_dynamic_sections: Likewise. * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections: Likewise. * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections: Likewise. * elf32-sparc.c (elf32_sparc_size_dynamic_sections: Likewise. * elf64-alpha.c (elf64_alpha_size_dynamic_sections: Likewise. * elf64-sparc.c (sparc64_elf_size_dynamic_sections: Likewise. include/ * bfdlink.h (struct bfd_link_info): Add pie and executable bits. ld/ * lexsup.c (OPTION_PIE): Define. (ld_options): Add -pie and --pic-executable options. (parse_args): Handle OPTION_PIE. * ldmain.c (main): Initialize link_info.pie and link_info.executable. * genscripts.sh: Generate PIE scripts. * ld.texinfo: Document -pie and --pic-executable options. * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): (gld${EMULATION_NAME}_place_orphan): Likewise. (gld${EMULATION_NAME}_get_script): Include PIE scripts. * scripttempl/elf.sc: In PIE scripts set . the same way as in shared scripts. * emulparams/elf_i386.sh (GENERATE_PIE_SCRIPT): Set to yes. * emulparams/elf64_ia64.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf32ppc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64ppc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_x86_64.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_s390.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf32_sparc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64_sparc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64alpha.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64_s390.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_i386.sh (GENERATE_PIE_SCRIPT): Likewise.
2003-05-30 15:50:12 +00:00
if (info->executable)
2001-02-10 00:58:38 +00:00
{
s = bfd_get_section_by_name (dynobj, ".interp");
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (s == NULL)
abort ();
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
s->size = sizeof ELF_DYNAMIC_INTERPRETER;
2001-02-10 00:58:38 +00:00
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Set up .got offsets for local syms, and space for local dynamic
relocs. */
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
2001-02-10 00:58:38 +00:00
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_signed_vma *local_got;
bfd_signed_vma *end_local_got;
char *local_tls_type;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srela;
2001-02-10 00:58:38 +00:00
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
if (! is_s390_elf (ibfd))
2001-02-10 00:58:38 +00:00
continue;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
for (s = ibfd->sections; s != NULL; s = s->next)
2001-02-10 00:58:38 +00:00
{
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
struct elf_s390_dyn_relocs *p;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next)
2001-02-10 00:58:38 +00:00
{
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
if (!bfd_is_abs_section (p->sec)
&& bfd_is_abs_section (p->sec->output_section))
{
/* Input section has been discarded, either because
it is a copy of a linkonce section or due to
linker script /DISCARD/, so we'll be discarding
the relocs too. */
}
else if (p->count != 0)
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
{
srela = elf_section_data (p->sec)->sreloc;
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
srela->size += p->count * sizeof (Elf32_External_Rela);
if ((p->sec->output_section->flags & SEC_READONLY) != 0)
info->flags |= DF_TEXTREL;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
}
2001-02-10 00:58:38 +00:00
}
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
local_got = elf_local_got_refcounts (ibfd);
if (!local_got)
continue;
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
symtab_hdr = &elf_symtab_hdr (ibfd);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
local_tls_type = elf_s390_local_got_tls_type (ibfd);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
s = htab->sgot;
srela = htab->srelgot;
for (; local_got < end_local_got; ++local_got, ++local_tls_type)
2001-02-10 00:58:38 +00:00
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (*local_got > 0)
2001-02-10 00:58:38 +00: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 04:46:28 +00:00
*local_got = s->size;
s->size += GOT_ENTRY_SIZE;
if (*local_tls_type == GOT_TLS_GD)
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
s->size += GOT_ENTRY_SIZE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (info->shared)
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
srela->size += sizeof (Elf32_External_Rela);
2001-02-10 00:58:38 +00:00
}
else
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
*local_got = (bfd_vma) -1;
}
}
if (htab->tls_ldm_got.refcount > 0)
{
/* Allocate 2 got entries and 1 dynamic reloc for R_390_TLS_LDM32
relocs. */
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
htab->tls_ldm_got.offset = htab->sgot->size;
htab->sgot->size += 2 * GOT_ENTRY_SIZE;
htab->srelgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tls_ldm_got.offset = -1;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
/* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */
relocs = FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
for (s = dynobj->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
if (s == htab->splt
|| s == htab->sgot
* elf-hppa.h (elf_hppa_final_link): Use gp val of zero when none of the usual sections are found. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Tidy. Strip .dynbss if it is zero size. * elf32-arm.c (elf32_arm_size_dynamic_sections): Likewise. * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise. * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise, and .dynsbss. (i370_elf_finish_dynamic_sections): Don't attempt to write .got when it is zero size. * elf32-i386.c (elf_i386_size_dynamic_sections): Correct handling of .dynbss and zero size sections. * elf32-m32r.c (m32r_elf_size_dynamic_sections): Strip .dynbss if it is zero size. * elf32-m68k.c (elf_m68k_size_dynamic_sections): Tidy. Strip .dynbss if zero size. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise, .dynsbss too. * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise. * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Tidy. Strip .plt.* and .got.plt.* if zero size. * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Tidy. Strip .got* and .dynbss if zero size. * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Tidy. Strip * elf64-ppc.c (create_linkage_sections): Create branch lookup table in .data.rel.ro.brlt or .rodata.brlt, and similarly for associated reloc section. (create_got_section): Always create new .got and .rela.got sections. (ppc64_elf_size_dynamic_sections): Tidy. Strip .dynbss if zero size. * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Handle dynamic bss sections correctly. * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Tidy. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Tidy. Strip .dynbss if zero size.
2005-07-08 06:20:06 +00:00
|| s == htab->sgotplt
|| s == htab->sdynbss)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
/* Strip this section if we don't need it; see the
comment below. */
2001-02-10 00:58:38 +00:00
}
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00: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 04:46:28 +00:00
if (s->size != 0)
relocs = TRUE;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
s->reloc_count = 0;
}
else
2001-02-10 00:58:38 +00:00
{
/* It's not one of our sections, so don't allocate space. */
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 04:46:28 +00:00
if (s->size == 0)
2001-02-10 00:58:38 +00:00
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* If we don't need this section, strip it from the
output file. This is to handle .rela.bss and
.rela.plt. We must create it in
create_dynamic_sections, because it must be created
before the linker maps input sections to output
sections. The linker does that before
adjust_dynamic_symbol is called, and it is that
function which decides whether anything needs to go
into these sections. */
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 11:00:28 +00:00
s->flags |= SEC_EXCLUDE;
2001-02-10 00:58:38 +00:00
continue;
}
* elf-hppa.h (elf_hppa_final_link): Use gp val of zero when none of the usual sections are found. * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Tidy. Strip .dynbss if it is zero size. * elf32-arm.c (elf32_arm_size_dynamic_sections): Likewise. * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise. * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise, and .dynsbss. (i370_elf_finish_dynamic_sections): Don't attempt to write .got when it is zero size. * elf32-i386.c (elf_i386_size_dynamic_sections): Correct handling of .dynbss and zero size sections. * elf32-m32r.c (m32r_elf_size_dynamic_sections): Strip .dynbss if it is zero size. * elf32-m68k.c (elf_m68k_size_dynamic_sections): Tidy. Strip .dynbss if zero size. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise, .dynsbss too. * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise. * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Tidy. Strip .plt.* and .got.plt.* if zero size. * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Tidy. Strip .got* and .dynbss if zero size. * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Tidy. Strip * elf64-ppc.c (create_linkage_sections): Create branch lookup table in .data.rel.ro.brlt or .rodata.brlt, and similarly for associated reloc section. (create_got_section): Always create new .got and .rela.got sections. (ppc64_elf_size_dynamic_sections): Tidy. Strip .dynbss if zero size. * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Handle dynamic bss sections correctly. * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Tidy. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Tidy. Strip .dynbss if zero size.
2005-07-08 06:20:06 +00:00
if ((s->flags & SEC_HAS_CONTENTS) == 0)
continue;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Allocate memory for the section contents. We use bfd_zalloc
here in case unused entries are not reclaimed before the
section's contents are written out. This should not happen,
but this way if it does, we get a R_390_NONE reloc instead
of garbage. */
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (s->contents == NULL)
return FALSE;
2001-02-10 00:58:38 +00:00
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (htab->elf.dynamic_sections_created)
2001-02-10 00:58:38 +00:00
{
/* Add some entries to the .dynamic section. We fill in the
values later, in elf_s390_finish_dynamic_sections, but we
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
#define add_dynamic_entry(TAG, VAL) \
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 12:48:45 +00:00
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
bfd/ * elflink.h (elf_link_add_object_symbols): Use !info->executable instead of info->shared where appropriate. (bfd_elfNN_size_dynamic_sections, elf_link_output_extsym): Likewise. * elflink.c (_bfd_elf_create_got_section): Likewise. (_bfd_elf_link_create_dynamic_sections): Likewise. (_bfd_elf_link_assign_sym_version): Likewise. * elf32-i386.c (elf_i386_size_dynamic_sections): Create .interp section and DT_DEBUG dynamic tag even for position independent executables. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. * elf32-s390.c (elf_s390_size_dynamic_sections: Likewise. * elf64-ppc.c (ppc64_elf_size_dynamic_sections: Likewise. * elf64-s390.c (elf_s390_size_dynamic_sections: Likewise. * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections: Likewise. * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections: Likewise. * elf32-sparc.c (elf32_sparc_size_dynamic_sections: Likewise. * elf64-alpha.c (elf64_alpha_size_dynamic_sections: Likewise. * elf64-sparc.c (sparc64_elf_size_dynamic_sections: Likewise. include/ * bfdlink.h (struct bfd_link_info): Add pie and executable bits. ld/ * lexsup.c (OPTION_PIE): Define. (ld_options): Add -pie and --pic-executable options. (parse_args): Handle OPTION_PIE. * ldmain.c (main): Initialize link_info.pie and link_info.executable. * genscripts.sh: Generate PIE scripts. * ld.texinfo: Document -pie and --pic-executable options. * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): (gld${EMULATION_NAME}_place_orphan): Likewise. (gld${EMULATION_NAME}_get_script): Include PIE scripts. * scripttempl/elf.sc: In PIE scripts set . the same way as in shared scripts. * emulparams/elf_i386.sh (GENERATE_PIE_SCRIPT): Set to yes. * emulparams/elf64_ia64.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf32ppc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64ppc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_x86_64.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_s390.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf32_sparc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64_sparc.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64alpha.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf64_s390.sh (GENERATE_PIE_SCRIPT): Likewise. * emulparams/elf_i386.sh (GENERATE_PIE_SCRIPT): Likewise.
2003-05-30 15:50:12 +00:00
if (info->executable)
2001-02-10 00:58:38 +00:00
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
2001-02-10 00:58:38 +00:00
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00: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 04:46:28 +00:00
if (htab->splt->size != 0)
2001-02-10 00:58:38 +00:00
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
|| !add_dynamic_entry (DT_JMPREL, 0))
return FALSE;
2001-02-10 00:58:38 +00:00
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
if (relocs)
{
if (!add_dynamic_entry (DT_RELA, 0)
|| !add_dynamic_entry (DT_RELASZ, 0)
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
return FALSE;
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */
if ((info->flags & DF_TEXTREL) == 0)
elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
(PTR) info);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
}
2001-02-10 00:58:38 +00:00
}
}
#undef add_dynamic_entry
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
return TRUE;
2001-02-10 00:58:38 +00:00
}
/* Return the base VMA address which should be subtracted from real addresses
when resolving @dtpoff relocation.
This is PT_TLS segment p_vaddr. */
static bfd_vma
dtpoff_base (info)
struct bfd_link_info *info;
{
* 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 06:16:39 +00:00
/* If tls_sec is NULL, we should have signalled an error already. */
if (elf_hash_table (info)->tls_sec == NULL)
return 0;
* 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 06:16:39 +00:00
return elf_hash_table (info)->tls_sec->vma;
}
/* Return the relocation value for @tpoff relocation
if STT_TLS virtual address is ADDRESS. */
static bfd_vma
tpoff (info, address)
struct bfd_link_info *info;
bfd_vma address;
{
* 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 06:16:39 +00:00
struct elf_link_hash_table *htab = elf_hash_table (info);
* 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 06:16:39 +00:00
/* If tls_sec is NULL, we should have signalled an error already. */
if (htab->tls_sec == NULL)
return 0;
* 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 06:16:39 +00:00
return htab->tls_size + htab->tls_sec->vma - address;
}
/* Complain if TLS instruction relocation is against an invalid
instruction. */
static void
invalid_tls_insn (input_bfd, input_section, rel)
bfd *input_bfd;
asection *input_section;
Elf_Internal_Rela *rel;
{
reloc_howto_type *howto;
howto = elf_howto_table + ELF32_R_TYPE (rel->r_info);
(*_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 03:16:01 +00:00
(_("%B(%A+0x%lx): invalid instruction for TLS relocation %s"),
input_bfd,
input_section,
(long) rel->r_offset,
howto->name);
bfd_set_error (bfd_error_bad_value);
}
2001-02-10 00:58:38 +00:00
/* Relocate a 390 ELF section. */
static bfd_boolean
2001-02-10 00:58:38 +00:00
elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd;
struct bfd_link_info *info;
bfd *input_bfd;
asection *input_section;
bfd_byte *contents;
Elf_Internal_Rela *relocs;
Elf_Internal_Sym *local_syms;
asection **local_sections;
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_link_hash_table *htab;
2001-02-10 00:58:38 +00:00
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_vma *local_got_offsets;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
BFD_ASSERT (is_s390_elf (input_bfd));
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab = elf_s390_hash_table (info);
PR ld/5692 * elf-bfd.h (enum elf_object_id): New enum, used to identify target specific extensions to the elf_obj_tdata structure. (struct elf_obj_tdata): New field 'object_id'. (elf_object_id, elf_program_header_size, elf_symtab_hdr): New macros for accessing fields in the elf_obj_tdata structure. (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object. (bfd_elf_allocate_object): New function. * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object and implement by calling bfd_elf_allocate_object. (bfd_elf_allocate_object): New function: Allocates an elf_obj_tdata structure, possibly with a target specific extension. * elfxx-target.h (bfd_elfNN_mkobject): Use bfd_elf_make_generic_object as the default value. * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata for consistency with other, similar structures. (is_arm_elf): New macro. Checks a BFD to make sure that is an ARM ELF bfd. (elf32_arm_mkobject): Call bfd_elf_allocate_object. (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check the bfd being processed. (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise. (bfd_elf32_arm_set_target_relocs): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_copy_private_bfd_data): Likewise. (bfd_elf32_arm_merge_eabi_attributes): Likewise. (bfd_elf32_arm_merge_private_bfd_data): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_gc_mark_extra_sections): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr. (bfd_elf32_arm_init_maps): Likewise. (bfd_elf32_arm_final_link_relocate): Likewise. (bfd_elf32_arm_relocate_section): Likewise. (bfd_elf32_arm_gc_sweep_hook): Likewise. (bfd_elf32_arm_check_relocs): Likewise. (bfd_elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object. (is_i386_elf): New macro. Checks a BFD to make sure that is an x86 ELF bfd. (elf_i386_check_relocs): Use is_i386_elf macro to check the bfd being processed. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_check_relocs): Use elf_symtab_hdr. (elf_i386_gc_sweep_hook): Likewise. (elf_i386_size_dynamic_sections): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object. (elf_create_pointer_linker_section): Use is_ppc_elf_target to verify that the bfd before accessing target specific fields. (ppc_elf_check_relocs): Likewise. (elf_finish_pointer_linker_section): Likewise. (elf_create_pointer_linker_section): Use elf_symtab_hdr. (ppc_elf_check_relocs): Likewise. (ppc_elf_gc_sweep_hook): Likewise. (ppc_elf_tls_optimize): Likewise. (ppc_elf_size_dynamic_sections): Likewise. (ppc_elf_relax_section): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf64-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object. (is_sh_elf): New macro. Checks a BFD to make sure that is an SH ELF bfd. (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the bfd being processed. (sh_elf_relocate_section): Likewise. (sh_elf_check_relocs): Likewise. (sh_elf_copy_private_data): Likewise. (sh_elf_relax_section): Use elf_symtab_hdr. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_relocate_section): Likewise. (sh_elf_get_relocated_section_contents): Likewise. (sh_elf_gc_sweep_hook): Likewise. (sh_elf_check_relocs): Likewise. * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object. (is_alpha_elf): New macro. Checks a BFD to make sure that is an Alpha ELF bfd. (elf64_alpha_create_got_section): Use is_alpha_elf macro to check the bfd being processed. (elf64_alpha_create_dynamic_section): Likewise. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_size_got_sections): Likewise. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section): Likewise. (elf64_alpha_final_link): Likewise. (elf64_alpha_check_relocs): Use elf_symtab_hdr. (elf64_alpha_relax_section): Likewise. (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object. (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd being processed. (opd_entry_value): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. (ppc64_elf_check_relocs): Use elf_symtab_hdr. (opd_entry_value): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. (get_sym_h): Likewise. (ppc64_elf_edit_opd): Likewise. (ppc64_elf_tls_optimize): Likewise. (ppc64_elf_edit_toc): Likewise. (ppc64_elf_size_dynamic_sections): Likewise. (toc_adjusting_stub_needed): Likewise. (ppc64_elf_size_stubs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment reminding programmers to keep this structure in sync with the one defined in elf32-s390.c. (elf_s390_mkobject): Call bfd_elf_allocate_object. (is_s390_elf): New macro. Checks a BFD to make sure that is an s390 ELF bfd. (elf_s390_check_relocs): Use is_s390_elf macro to check the bfd being processed. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. (elf_s390_check_relocs): Use elf_symtab_hdr. (elf_s390_gc_sweep_hook): Likewise. (elf_s390_size_dynamic_sections): Likewise. (elf_s390_relocate_section): Likewise. * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object. (is_x86_64_elf): New macro. Checks a BFD to make sure that is an x86_64 ELF bfd. (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd being processed. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. (elf64_x86_64_check_relocs): Use elf_symtab_hdr. (elf64_x86_64_gc_sweep_hook): Likewise. (elf64_x86_64_size_dynamic_sections): Likewise. (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object. (is_sparc_elf): New macro. Checks a BFD to make sure that is a Sparc ELF bfd. (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the bfd being processed. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr. (_bfd_sparc_elf_gc_sweep_hook): Likewise. (_bfd_sparc_elf_size_dynamic_sections): Likewise. (_bfd_sparc_elf_relocate_section): Likewise.
2008-02-12 11:32:31 +00:00
symtab_hdr = &elf_symtab_hdr (input_bfd);
2001-02-10 00:58:38 +00:00
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
unsigned int r_type;
2001-02-10 00:58:38 +00:00
reloc_howto_type *howto;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_vma off;
2001-02-10 00:58:38 +00:00
bfd_vma relocation;
bfd_boolean unresolved_reloc;
2001-02-10 00:58:38 +00:00
bfd_reloc_status_type r;
int tls_type;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
r_type = ELF32_R_TYPE (rel->r_info);
if (r_type == (int) R_390_GNU_VTINHERIT
|| r_type == (int) R_390_GNU_VTENTRY)
continue;
if (r_type >= (int) R_390_max)
2001-02-10 00:58:38 +00:00
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
2001-02-10 00:58:38 +00:00
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf-bfd.h (struct elf_backend_data): Add rela_normal. * elfxx-target.h (elf_backend_rela_normal): Define. (elfNN_bed): Init rela_normal. * elflink.h (elf_link_input_bfd <emit_relocs>): Handle adjustment for section symbols here if rela_normal. Simplify abs section test. * elf-m10200.c (mn10200_elf_relocate_section): If relocatable, return immediately. Remove code handling relocatable linking. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mcore.c (mcore_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-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf-m10200.c (elf_backend_rela_normal): Define. * elf-m10300.c (elf_backend_rela_normal): Define. * elf32-fr30.c (elf_backend_rela_normal): Define. * elf32-i370.c (elf_backend_rela_normal): Define. * elf32-i860.c (elf_backend_rela_normal): Define. * elf32-m68k.c (elf_backend_rela_normal): Define. * elf32-mcore.c (elf_backend_rela_normal): Define. * elf32-openrisc.c (elf_backend_rela_normal): Define. * elf32-ppc.c (elf_backend_rela_normal): Define. * elf32-s390.c (elf_backend_rela_normal): Define. * elf32-xstormy16.c (elf_backend_rela_normal): Define. * elf64-ppc.c (elf_backend_rela_normal): Define. * elf64-s390.c (elf_backend_rela_normal): Define. * elf64-x86-64.c (elf_backend_rela_normal): Define. * elfxx-ia64.c (elf_backend_rela_normal): Define. * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL. * elf32-m32r.c (elf_backend_rela_normal): Likewise.
2002-05-07 00:16:53 +00:00
howto = elf_howto_table + r_type;
2001-02-10 00:58:38 +00:00
r_symndx = ELF32_R_SYM (rel->r_info);
2001-02-10 00:58:38 +00:00
h = NULL;
sym = NULL;
sec = NULL;
unresolved_reloc = FALSE;
2001-02-10 00:58:38 +00:00
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
* elf.c (_bfd_elf_rela_local_sym): Accept asection **, and return updated section in case of merged section. * elf-bfd.h (_bfd_elf_rela_local_sym): Update declaration. * elf-hppa.h (elf_hppa_relocate_section): Adjust call. * 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-cris.c (cris_elf_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-i860.c (elf32_i860_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_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. * elf32-xtensa.c (elf_xtensa_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. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Don't recalculate symbol section for reloc output. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf32-vax.c (elf_vax_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Don't recalculate everything for R_PPC_RELAX32 reloc. Don't bother checking ppc_elf_install_value return value. * elf64-ppc.c (ppc64_elf_relocate_section <R_PPC64_TOC>): Sanity check sec->id.
2003-11-05 13:17:09 +00:00
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
2001-02-10 00:58:38 +00:00
}
else
{
2003-08-20 08:37:19 +00:00
bfd_boolean warned ATTRIBUTE_UNUSED;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
unresolved_reloc, warned);
2001-02-10 00:58:38 +00:00
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
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 08:54:35 +00:00
if (sec != NULL && elf_discarded_section (sec))
{
/* For relocs against symbols from removed linkonce sections,
or sections discarded by a linker script, we just want the
section contents zeroed. Avoid any special processing. */
_bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
rel->r_info = 0;
rel->r_addend = 0;
continue;
}
if (info->relocatable)
continue;
2001-02-10 00:58:38 +00:00
switch (r_type)
{
case R_390_GOTPLT12:
case R_390_GOTPLT16:
case R_390_GOTPLT20:
case R_390_GOTPLT32:
case R_390_GOTPLTENT:
/* There are three cases for a GOTPLT relocation. 1) The
relocation is against the jump slot entry of a plt that
will get emitted to the output file. 2) The relocation
is against the jump slot of a plt entry that has been
removed. elf_s390_adjust_gotplt has created a GOT entry
as replacement. 3) The relocation is against a local symbol.
Cases 2) and 3) are the same as the GOT relocation code
so we just have to test for case 1 and fall through for
the other two. */
if (h != NULL && h->plt.offset != (bfd_vma) -1)
{
bfd_vma plt_index;
/* Calc. index no.
Current offset - size first entry / entry size. */
plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) /
PLT_ENTRY_SIZE;
/* Offset in GOT is PLT index plus GOT headers(3) times 4,
addr & GOT addr. */
relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
unresolved_reloc = FALSE;
if (r_type == R_390_GOTPLTENT)
relocation += htab->sgot->output_section->vma;
break;
}
/* Fall through. */
case R_390_GOT12:
case R_390_GOT16:
case R_390_GOT20:
case R_390_GOT32:
case R_390_GOTENT:
/* Relocation is to the entry for this symbol in the global
offset table. */
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (htab->sgot == NULL)
abort ();
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
if (h != NULL)
{
bfd_boolean dyn;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
off = h->got.offset;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
dyn = htab->elf.dynamic_sections_created;
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|| (info->shared
&& SYMBOL_REFERENCES_LOCAL (info, h))
|| (ELF_ST_VISIBILITY (h->other)
&& h->root.type == bfd_link_hash_undefweak))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
locally, or the symbol was forced to be local
because of a version file. We must initialize
this entry in the global offset table. Since the
offset must always be a multiple of 2, we use the
least significant bit to record whether we have
initialized it already.
When doing a dynamic link, we create a .rel.got
relocation entry to initialize the value. This
is done in the finish_dynamic_symbol routine. */
if ((off & 1) != 0)
off &= ~1;
else
{
2001-02-10 00:58:38 +00:00
bfd_put_32 (output_bfd, relocation,
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab->sgot->contents + off);
h->got.offset |= 1;
}
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
else
unresolved_reloc = FALSE;
}
else
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (local_got_offsets == NULL)
abort ();
2001-02-10 00:58:38 +00:00
off = local_got_offsets[r_symndx];
2001-02-10 00:58:38 +00:00
/* The offset must always be a multiple of 4. We use
the least significant bit to record whether we have
already generated the necessary reloc. */
if ((off & 1) != 0)
off &= ~1;
else
{
bfd_put_32 (output_bfd, relocation,
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab->sgot->contents + off);
2001-02-10 00:58:38 +00:00
if (info->shared)
{
asection *srelgot;
Elf_Internal_Rela outrel;
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
bfd_byte *loc;
2001-02-10 00:58:38 +00:00
srelgot = htab->srelgot;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (srelgot == NULL)
abort ();
2001-02-10 00:58:38 +00:00
outrel.r_offset = (htab->sgot->output_section->vma
+ htab->sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
2001-02-10 00:58:38 +00:00
outrel.r_addend = relocation;
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
loc = srelgot->contents;
loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
2001-02-10 00:58:38 +00:00
local_got_offsets[r_symndx] |= 1;
}
}
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (off >= (bfd_vma) -2)
abort ();
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
relocation = htab->sgot->output_offset + off;
/* For @GOTENT the relocation is against the offset between
the instruction and the symbols entry in the GOT and not
between the start of the GOT and the symbols entry. We
add the vma of the GOT to get the correct value. */
if ( r_type == R_390_GOTENT
|| r_type == R_390_GOTPLTENT)
relocation += htab->sgot->output_section->vma;
break;
case R_390_GOTOFF16:
case R_390_GOTOFF32:
/* Relocation is relative to the start of the global offset
table. */
/* Note that sgot->output_offset is not involved in this
calculation. We always want the start of .got. If we
defined _GLOBAL_OFFSET_TABLE in a different way, as is
permitted by the ABI, we might have to change this
calculation. */
relocation -= htab->sgot->output_section->vma;
break;
case R_390_GOTPC:
case R_390_GOTPCDBL:
/* Use global offset table as symbol value. */
relocation = htab->sgot->output_section->vma;
unresolved_reloc = FALSE;
break;
2001-02-10 00:58:38 +00:00
case R_390_PLT16DBL:
case R_390_PLT32DBL:
case R_390_PLT32:
/* Relocation is to the entry for this symbol in the
procedure linkage table. */
2001-02-10 00:58:38 +00:00
/* Resolve a PLT32 reloc against a local symbol directly,
without using the procedure linkage table. */
if (h == NULL)
break;
2001-02-10 00:58:38 +00:00
if (h->plt.offset == (bfd_vma) -1
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
|| htab->splt == NULL)
{
/* We didn't make a PLT entry for this symbol. This
happens when statically linking PIC code, or when
using -Bsymbolic. */
break;
}
relocation = (htab->splt->output_section->vma
+ htab->splt->output_offset
+ h->plt.offset);
unresolved_reloc = FALSE;
break;
2001-02-10 00:58:38 +00:00
case R_390_PLTOFF16:
case R_390_PLTOFF32:
/* Relocation is to the entry for this symbol in the
procedure linkage table relative to the start of the GOT. */
/* For local symbols or if we didn't make a PLT entry for
this symbol resolve the symbol directly. */
if ( h == NULL
|| h->plt.offset == (bfd_vma) -1
|| htab->splt == NULL)
{
relocation -= htab->sgot->output_section->vma;
break;
}
relocation = (htab->splt->output_section->vma
+ htab->splt->output_offset
+ h->plt.offset
- htab->sgot->output_section->vma);
unresolved_reloc = FALSE;
break;
case R_390_8:
case R_390_16:
case R_390_32:
case R_390_PC16:
case R_390_PC16DBL:
case R_390_PC32DBL:
case R_390_PC32:
if ((input_section->flags & SEC_ALLOC) == 0)
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
break;
if ((info->shared
&& (h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
&& ((r_type != R_390_PC16
&& r_type != R_390_PC16DBL
&& r_type != R_390_PC32DBL
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
&& r_type != R_390_PC32)
|| !SYMBOL_CALLS_LOCAL (info, h)))
|| (ELIMINATE_COPY_RELOCS
&& !info->shared
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
&& h != NULL
&& h->dynindx != -1
2004-09-16 14:52:12 +00:00
&& !h->non_got_ref
&& ((h->def_dynamic
&& !h->def_regular)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
Elf_Internal_Rela outrel;
bfd_boolean skip, relocate;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
asection *sreloc;
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
bfd_byte *loc;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
time. */
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
skip = FALSE;
relocate = FALSE;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
outrel.r_offset =
_bfd_elf_section_offset (output_bfd, info, input_section,
rel->r_offset);
if (outrel.r_offset == (bfd_vma) -1)
skip = TRUE;
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable absptr -> pcrel optimization for shared libs. Only create minimal .eh_frame_hdr if absptr FDE encoding in shared library cannot be converted to pcrel. (_bfd_elf_eh_frame_section_offset): Return -2 if making absptr relative. * elf32-i386.c (elf_i386_relocate_section): If _bfd_elf_section_offset returned -2, skip, but make sure the relocation is installed. * elf32-arm.h (elf32_arm_final_link_relocate): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i370.c (i370_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-sparc.c (elf32_sparc_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. * elf64-alpha.c (elf64_alpha_relocate_section): Handle _bfd_elf_section_offset returning -2 the same way as -1. * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise. * elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME and BFD_ASSERT. * elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise.
2002-02-19 12:40:32 +00:00
else if (outrel.r_offset == (bfd_vma) -2)
skip = TRUE, relocate = TRUE;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
if (skip)
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Enable absptr -> pcrel optimization for shared libs. Only create minimal .eh_frame_hdr if absptr FDE encoding in shared library cannot be converted to pcrel. (_bfd_elf_eh_frame_section_offset): Return -2 if making absptr relative. * elf32-i386.c (elf_i386_relocate_section): If _bfd_elf_section_offset returned -2, skip, but make sure the relocation is installed. * elf32-arm.h (elf32_arm_final_link_relocate): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i370.c (i370_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-sparc.c (elf32_sparc_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. * elf64-alpha.c (elf64_alpha_relocate_section): Handle _bfd_elf_section_offset returning -2 the same way as -1. * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise. * elf32-mips.c (mips_elf_create_dynamic_relocation): Add FIXME and BFD_ASSERT. * elf64-mips.c (mips_elf64_create_dynamic_relocation): Likewise.
2002-02-19 12:40:32 +00:00
memset (&outrel, 0, sizeof outrel);
else if (h != NULL
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
&& h->dynindx != -1
&& (r_type == R_390_PC16
|| r_type == R_390_PC16DBL
|| r_type == R_390_PC32DBL
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
|| r_type == R_390_PC32
|| !info->shared
|| !SYMBOLIC_BIND (info, h)
2004-09-16 14:52:12 +00:00
|| !h->def_regular))
{
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
}
else
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* This symbol is local, or marked to become local. */
outrel.r_addend = relocation + rel->r_addend;
if (r_type == R_390_32)
{
relocate = TRUE;
outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
}
else
{
long sindx;
if (bfd_is_abs_section (sec))
sindx = 0;
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error(bfd_error_bad_value);
return FALSE;
}
else
{
asection *osec;
osec = sec->output_section;
sindx = elf_section_data (osec)->dynindx;
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 13:41:49 +00:00
if (sindx == 0)
{
osec = htab->elf.text_index_section;
sindx = elf_section_data (osec)->dynindx;
}
BFD_ASSERT (sindx != 0);
/* We are turning this relocation into one
against a section symbol, so subtract out
the output section's address but not the
offset of the input section in the output
section. */
outrel.r_addend -= osec->vma;
}
outrel.r_info = ELF32_R_INFO (sindx, r_type);
}
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
loc = sreloc->contents;
loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
/* If this reloc is against an external symbol, we do
not want to fiddle with the addend. Otherwise, we
need to include the symbol value so that it becomes
an addend for the dynamic reloc. */
if (! relocate)
continue;
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
break;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
/* Relocations for tls literal pool entries. */
case R_390_TLS_IE32:
if (info->shared)
{
Elf_Internal_Rela outrel;
asection *sreloc;
bfd_byte *loc;
outrel.r_offset = rel->r_offset
+ input_section->output_section->vma
+ input_section->output_offset;
outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
loc = sreloc->contents;
loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
/* Fall through. */
case R_390_TLS_GD32:
case R_390_TLS_GOTIE32:
r_type = elf_s390_tls_transition (info, r_type, h == NULL);
tls_type = GOT_UNKNOWN;
if (h == NULL && local_got_offsets)
tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
else if (h != NULL)
{
tls_type = elf_s390_hash_entry(h)->tls_type;
if (!info->shared && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
r_type = R_390_TLS_LE32;
}
if (r_type == R_390_TLS_GD32 && tls_type >= GOT_TLS_IE)
r_type = R_390_TLS_IE32;
if (r_type == R_390_TLS_LE32)
{
/* This relocation gets optimized away by the local exec
access optimization. */
BFD_ASSERT (! unresolved_reloc);
bfd_put_32 (output_bfd, -tpoff (info, relocation),
contents + rel->r_offset);
continue;
}
if (htab->sgot == NULL)
abort ();
if (h != NULL)
off = h->got.offset;
else
{
if (local_got_offsets == NULL)
abort ();
off = local_got_offsets[r_symndx];
}
emit_tls_relocs:
if ((off & 1) != 0)
off &= ~1;
else
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
int dr_type, indx;
if (htab->srelgot == NULL)
abort ();
outrel.r_offset = (htab->sgot->output_section->vma
+ htab->sgot->output_offset + off);
indx = h && h->dynindx != -1 ? h->dynindx : 0;
if (r_type == R_390_TLS_GD32)
dr_type = R_390_TLS_DTPMOD;
else
dr_type = R_390_TLS_TPOFF;
if (dr_type == R_390_TLS_TPOFF && indx == 0)
outrel.r_addend = relocation - dtpoff_base (info);
else
outrel.r_addend = 0;
outrel.r_info = ELF32_R_INFO (indx, dr_type);
loc = htab->srelgot->contents;
loc += htab->srelgot->reloc_count++
* sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
if (r_type == R_390_TLS_GD32)
{
if (indx == 0)
{
BFD_ASSERT (! unresolved_reloc);
bfd_put_32 (output_bfd,
relocation - dtpoff_base (info),
htab->sgot->contents + off + GOT_ENTRY_SIZE);
}
else
{
outrel.r_info = ELF32_R_INFO (indx, R_390_TLS_DTPOFF);
outrel.r_offset += GOT_ENTRY_SIZE;
outrel.r_addend = 0;
htab->srelgot->reloc_count++;
loc += sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
}
if (h != NULL)
h->got.offset |= 1;
else
local_got_offsets[r_symndx] |= 1;
}
if (off >= (bfd_vma) -2)
abort ();
if (r_type == ELF32_R_TYPE (rel->r_info))
{
relocation = htab->sgot->output_offset + off;
if (r_type == R_390_TLS_IE32 || r_type == R_390_TLS_IEENT)
relocation += htab->sgot->output_section->vma;
unresolved_reloc = FALSE;
}
else
{
bfd_put_32 (output_bfd, htab->sgot->output_offset + off,
contents + rel->r_offset);
continue;
}
break;
case R_390_TLS_GOTIE12:
case R_390_TLS_GOTIE20:
case R_390_TLS_IEENT:
if (h == NULL)
{
if (local_got_offsets == NULL)
abort();
off = local_got_offsets[r_symndx];
if (info->shared)
goto emit_tls_relocs;
}
else
{
off = h->got.offset;
tls_type = elf_s390_hash_entry(h)->tls_type;
if (info->shared || h->dynindx != -1 || tls_type < GOT_TLS_IE)
goto emit_tls_relocs;
}
if (htab->sgot == NULL)
abort ();
BFD_ASSERT (! unresolved_reloc);
bfd_put_32 (output_bfd, -tpoff (info, relocation),
htab->sgot->contents + off);
relocation = htab->sgot->output_offset + off;
if (r_type == R_390_TLS_IEENT)
relocation += htab->sgot->output_section->vma;
unresolved_reloc = FALSE;
break;
case R_390_TLS_LDM32:
if (! info->shared)
/* The literal pool entry this relocation refers to gets ignored
by the optimized code of the local exec model. Do nothing
and the value will turn out zero. */
continue;
if (htab->sgot == NULL)
abort ();
off = htab->tls_ldm_got.offset;
if (off & 1)
off &= ~1;
else
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
if (htab->srelgot == NULL)
abort ();
outrel.r_offset = (htab->sgot->output_section->vma
+ htab->sgot->output_offset + off);
bfd_put_32 (output_bfd, 0,
htab->sgot->contents + off + GOT_ENTRY_SIZE);
outrel.r_info = ELF32_R_INFO (0, R_390_TLS_DTPMOD);
outrel.r_addend = 0;
loc = htab->srelgot->contents;
loc += htab->srelgot->reloc_count++
* sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
htab->tls_ldm_got.offset |= 1;
}
relocation = htab->sgot->output_offset + off;
unresolved_reloc = FALSE;
break;
case R_390_TLS_LE32:
if (info->shared)
{
/* Linking a shared library with non-fpic code requires
a R_390_TLS_TPOFF relocation. */
Elf_Internal_Rela outrel;
asection *sreloc;
bfd_byte *loc;
int indx;
outrel.r_offset = rel->r_offset
+ input_section->output_section->vma
+ input_section->output_offset;
if (h != NULL && h->dynindx != -1)
indx = h->dynindx;
else
indx = 0;
outrel.r_info = ELF32_R_INFO (indx, R_390_TLS_TPOFF);
if (indx == 0)
outrel.r_addend = relocation - dtpoff_base (info);
else
outrel.r_addend = 0;
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
loc = sreloc->contents;
loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
else
{
BFD_ASSERT (! unresolved_reloc);
bfd_put_32 (output_bfd, -tpoff (info, relocation),
contents + rel->r_offset);
}
continue;
case R_390_TLS_LDO32:
if (info->shared)
relocation -= dtpoff_base (info);
else
/* When converting LDO to LE, we must negate. */
relocation = -tpoff (info, relocation);
break;
/* Relocations for tls instructions. */
case R_390_TLS_LOAD:
case R_390_TLS_GDCALL:
case R_390_TLS_LDCALL:
tls_type = GOT_UNKNOWN;
if (h == NULL && local_got_offsets)
tls_type = elf_s390_local_got_tls_type (input_bfd) [r_symndx];
else if (h != NULL)
tls_type = elf_s390_hash_entry(h)->tls_type;
if (tls_type == GOT_TLS_GD)
continue;
if (r_type == R_390_TLS_LOAD)
{
if (!info->shared && (h == NULL || h->dynindx == -1))
{
/* IE->LE transition. Four valid cases:
l %rx,0(0,%ry) -> lr %rx,%ry + bcr 0,0
l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0
l %rx,0(%ry,%r12) -> lr %rx,%ry + bcr 0,0
l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
unsigned int insn, ry;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
ry = 0;
if ((insn & 0xff00f000) == 0x58000000)
/* l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x000f0000);
else if ((insn & 0xff0f0000) == 0x58000000)
/* l %rx,0(0,%ry) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x0000f000) << 4;
else if ((insn & 0xff00f000) == 0x5800c000)
/* l %rx,0(%ry,%r12) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x000f0000);
else if ((insn & 0xff0f0000) == 0x580c0000)
/* l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x0000f000) << 4;
else
invalid_tls_insn (input_bfd, input_section, rel);
insn = 0x18000700 | (insn & 0x00f00000) | ry;
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
}
else if (r_type == R_390_TLS_GDCALL)
{
unsigned int insn;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
if ((insn & 0xff000fff) != 0x4d000000 &&
(insn & 0xffff0000) != 0xc0e50000)
invalid_tls_insn (input_bfd, input_section, rel);
if (!info->shared && (h == NULL || h->dynindx == -1))
{
if ((insn & 0xff000000) == 0x4d000000)
{
/* GD->LE transition.
bas %r14,0(%rx,%r13) -> bc 0,0 */
insn = 0x47000000;
}
else
{
/* GD->LE transition.
brasl %r14,_tls_get_addr@plt -> brcl 0,. */
insn = 0xc0040000;
bfd_put_16 (output_bfd, 0x0000,
contents + rel->r_offset + 4);
}
}
else
{
if ((insn & 0xff000000) == 0x4d000000)
{
/* GD->IE transition.
bas %r14,0(%rx,%r13) -> l %r2,0(%r2,%r12) */
insn = 0x5822c000;
}
else
{
/* GD->IE transition.
brasl %r14,__tls_get_addr@plt ->
l %r2,0(%r2,%r12) ; bcr 0,0 */
insn = 0x5822c000;
bfd_put_16 (output_bfd, 0x0700,
contents + rel->r_offset + 4);
}
}
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
else if (r_type == R_390_TLS_LDCALL)
{
if (!info->shared)
{
unsigned int insn;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
if ((insn & 0xff000fff) != 0x4d000000 &&
(insn & 0xffff0000) != 0xc0e50000)
invalid_tls_insn (input_bfd, input_section, rel);
if ((insn & 0xff000000) == 0x4d000000)
{
/* LD->LE transition.
bas %r14,0(%rx,%r13) -> bc 0,0 */
insn = 0x47000000;
}
else
{
/* LD->LE transition.
brasl %r14,__tls_get_addr@plt -> brcl 0,. */
insn = 0xc0040000;
bfd_put_16 (output_bfd, 0x0000,
contents + rel->r_offset + 4);
}
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
}
continue;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
default:
break;
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
because such sections are not SEC_ALLOC and thus ld.so will
not process them. */
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
2004-09-16 14:52:12 +00:00
&& h->def_dynamic))
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
(*_bfd_error_handler)
(_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
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 03:16:01 +00:00
input_bfd,
input_section,
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
(long) rel->r_offset,
howto->name,
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
h->root.root.string);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
if (r_type == R_390_20
|| r_type == R_390_GOT20
|| r_type == R_390_GOTPLT20
|| r_type == R_390_TLS_GOTIE20)
{
relocation += rel->r_addend;
relocation = (relocation&0xfff) << 8 | (relocation&0xff000) >> 12;
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, 0);
}
else
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
if (r != bfd_reloc_ok)
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
const char *name;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (h != NULL)
name = h->root.root.string;
else
2001-02-10 00:58:38 +00:00
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
name = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link,
sym->st_name);
if (name == NULL)
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (*name == '\0')
name = bfd_section_name (input_bfd, sec);
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (r == bfd_reloc_overflow)
{
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
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 15:28:33 +00:00
(info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section,
rel->r_offset)))
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00: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 03:16:01 +00:00
(_("%B(%A+0x%lx): reloc against `%s': error %d"),
input_bfd, input_section,
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
(long) rel->r_offset, name, (int) r);
return FALSE;
2001-02-10 00:58:38 +00:00
}
}
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
return TRUE;
2001-02-10 00:58:38 +00:00
}
/* Finish up dynamic symbol handling. We set the contents of various
dynamic sections here. */
static bfd_boolean
2001-02-10 00:58:38 +00:00
elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *output_bfd;
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_link_hash_table *htab;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab = elf_s390_hash_table (info);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
if (h->plt.offset != (bfd_vma) -1)
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_vma plt_index;
bfd_vma got_offset;
2001-02-10 00:58:38 +00:00
Elf_Internal_Rela rela;
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
bfd_byte *loc;
2001-02-10 00:58:38 +00:00
bfd_vma relative_offset;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
/* This symbol has an entry in the procedure linkage table. Set
it up. */
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (h->dynindx == -1
|| htab->splt == NULL
|| htab->sgotplt == NULL
|| htab->srelplt == NULL)
abort ();
2001-02-10 00:58:38 +00:00
/* Calc. index no.
Current offset - size first entry / entry size. */
2001-02-10 00:58:38 +00:00
plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE;
/* Offset in GOT is PLT index plus GOT headers(3) times 4,
addr & GOT addr. */
2001-02-10 00:58:38 +00:00
got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
/* S390 uses halfwords for relative branch calc! */
relative_offset = - ((PLT_FIRST_ENTRY_SIZE +
(PLT_ENTRY_SIZE * plt_index) + 18) / 2);
2001-02-10 00:58:38 +00:00
/* If offset is > 32768, branch to a previous branch
390 can only handle +-64 K jumps. */
if ( -32768 > (int) relative_offset )
relative_offset
= -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2);
2001-02-10 00:58:38 +00:00
/* Fill in the entry in the procedure linkage table. */
if (!info->shared)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0,
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab->splt->contents + h->plt.offset);
bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD1,
htab->splt->contents + h->plt.offset + 4);
bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD2,
htab->splt->contents + h->plt.offset + 8);
bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD3,
htab->splt->contents + h->plt.offset + 12);
bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD4,
htab->splt->contents + h->plt.offset + 16);
bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16),
htab->splt->contents + h->plt.offset + 20);
bfd_put_32 (output_bfd,
(htab->sgotplt->output_section->vma
+ htab->sgotplt->output_offset
+ got_offset),
htab->splt->contents + h->plt.offset + 24);
}
2001-02-10 00:58:38 +00:00
else if (got_offset < 4096)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD0 + got_offset,
htab->splt->contents + h->plt.offset);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD1,
htab->splt->contents + h->plt.offset + 4);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD2,
htab->splt->contents + h->plt.offset + 8);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD3,
htab->splt->contents + h->plt.offset + 12);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC12_ENTRY_WORD4,
htab->splt->contents + h->plt.offset + 16);
bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16),
htab->splt->contents + h->plt.offset + 20);
bfd_put_32 (output_bfd, (bfd_vma) 0,
htab->splt->contents + h->plt.offset + 24);
}
2001-02-10 00:58:38 +00:00
else if (got_offset < 32768)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD0 + got_offset,
htab->splt->contents + h->plt.offset);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD1,
htab->splt->contents + h->plt.offset + 4);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD2,
htab->splt->contents + h->plt.offset + 8);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD3,
htab->splt->contents + h->plt.offset + 12);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC16_ENTRY_WORD4,
htab->splt->contents + h->plt.offset + 16);
bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16),
htab->splt->contents + h->plt.offset + 20);
bfd_put_32 (output_bfd, (bfd_vma) 0,
htab->splt->contents + h->plt.offset + 24);
}
2001-02-10 00:58:38 +00:00
else
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD0,
htab->splt->contents + h->plt.offset);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD1,
htab->splt->contents + h->plt.offset + 4);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD2,
htab->splt->contents + h->plt.offset + 8);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD3,
htab->splt->contents + h->plt.offset + 12);
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_ENTRY_WORD4,
htab->splt->contents + h->plt.offset + 16);
bfd_put_32 (output_bfd, (bfd_vma) 0+(relative_offset << 16),
htab->splt->contents + h->plt.offset + 20);
bfd_put_32 (output_bfd, got_offset,
htab->splt->contents + h->plt.offset + 24);
}
2001-02-10 00:58:38 +00:00
/* Insert offset into reloc. table here. */
bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
htab->splt->contents + h->plt.offset + 28);
2001-02-10 00:58:38 +00:00
/* Fill in the entry in the global offset table.
Points to instruction after GOT offset. */
2001-02-10 00:58:38 +00:00
bfd_put_32 (output_bfd,
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
(htab->splt->output_section->vma
+ htab->splt->output_offset
2001-02-10 00:58:38 +00:00
+ h->plt.offset
+ 12),
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab->sgotplt->contents + got_offset);
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Fill in the entry in the .rela.plt section. */
rela.r_offset = (htab->sgotplt->output_section->vma
+ htab->sgotplt->output_offset
+ got_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_JMP_SLOT);
rela.r_addend = 0;
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rela);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2004-09-16 14:52:12 +00:00
if (!h->def_regular)
2001-02-10 00:58:38 +00:00
{
/* Mark the symbol as undefined, rather than as defined in
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
the .plt section. Leave the value alone. This is a clue
for the dynamic linker, to make function pointer
comparisons work between an application and shared
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
library. */
2001-02-10 00:58:38 +00:00
sym->st_shndx = SHN_UNDEF;
}
}
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
if (h->got.offset != (bfd_vma) -1
&& elf_s390_hash_entry(h)->tls_type != GOT_TLS_GD
&& elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE
&& elf_s390_hash_entry(h)->tls_type != GOT_TLS_IE_NLT)
2001-02-10 00:58:38 +00:00
{
Elf_Internal_Rela rela;
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
bfd_byte *loc;
2001-02-10 00:58:38 +00:00
/* This symbol has an entry in the global offset table. Set it
up. */
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (htab->sgot == NULL || htab->srelgot == NULL)
abort ();
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
rela.r_offset = (htab->sgot->output_section->vma
+ htab->sgot->output_offset
+ (h->got.offset &~ (bfd_vma) 1));
2001-02-10 00:58:38 +00:00
/* If this is a static link, or it is a -Bsymbolic link and the
symbol is defined locally or was forced to be local because
of a version file, we just want to emit a RELATIVE reloc.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (info->shared
&& SYMBOL_REFERENCES_LOCAL (info, h))
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
if (!h->def_regular)
return FALSE;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
BFD_ASSERT((h->got.offset & 1) != 0);
rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
rela.r_addend = (h->root.u.def.value
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
}
2001-02-10 00:58:38 +00:00
else
{
BFD_ASSERT((h->got.offset & 1) == 0);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgot->contents + h->got.offset);
2001-02-10 00:58:38 +00:00
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_GLOB_DAT);
rela.r_addend = 0;
}
2001-02-10 00:58:38 +00:00
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
loc = htab->srelgot->contents;
loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
2001-02-10 00:58:38 +00:00
}
2004-09-16 14:52:12 +00:00
if (h->needs_copy)
2001-02-10 00:58:38 +00:00
{
Elf_Internal_Rela rela;
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
bfd_byte *loc;
2001-02-10 00:58:38 +00:00
/* This symbols needs a copy reloc. Set it up. */
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| htab->srelbss == NULL)
abort ();
2001-02-10 00:58:38 +00:00
rela.r_offset = (h->root.u.def.value
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
include/elf/ChangeLog * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr, elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr, Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr, elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr, Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym, Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note, elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel, elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela, elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela, elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn, Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef, elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed, elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux, elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef, Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux, Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux, Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym, Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete. (Elf_Internal_Rel): Delete. bfd/ChangeLog * elf-bfd.h: Replace occurrences of Elf32_Internal_* and Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel with Elf_Internal_Rela. * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h, elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c, elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c, elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c, elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c, elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c, elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto. * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr throughout instead. * elf.c (_bfd_elf_no_info_to_howto_rel): Delete. * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *. Remove INLINE keyword. (elf_swap_reloc_in): Likewise. Also clear r_addend. (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand as a bfd_byte *. (elf_write_relocs): Consolidate REL and RELA code. (elf_slurp_reloc_table_from_section): Simplify REL code. (NAME(_bfd_elf,size_info)): Populate reloc swap entries. * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define. * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and RELA code. (elf_link_adjust_relocs): Likewise. Don't malloc space for temp reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL. (elf_link_output_relocs): Likewise. (elf_reloc_link_order): Likewise. (elf_finish_pointer_linker_section): Likewise. (struct elf_link_sort_rela): Remove union. (elf_link_sort_cmp1): Update to suit. (elf_link_sort_cmp2): Here too. (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory over-allocation for int_rels_per_ext_rel != 1 case. * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls. * elf32-i386.c: Likewise. * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out. * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise. * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out. * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out. * elfxx-mips.c (sort_dynamic_relocs): Likewise for bfd_elf32_swap_reloc_in. * elf32-arm.h: Update elf32_arm_info_to_howto calls. * elf32-mips.c: Likewise for mips_info_to_howto_rel. (mips_elf64_swap_reloc_in): Zero r_addend. (mips_elf64_be_swap_reloc_in): Likewise. (mips_elf64_slurp_one_reloc_table): Simplify. * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries. * elf64-hppa.c (hppa64_elf_size_info): Likewise. * elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-11-28 11:55:43 +00:00
loc = htab->srelbss->contents;
loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rela);
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
2001-02-10 00:58:38 +00:00
}
/* Mark some specially defined symbols as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
|| h == htab->elf.hgot
|| h == htab->elf.hplt)
2001-02-10 00:58:38 +00:00
sym->st_shndx = SHN_ABS;
return TRUE;
2001-02-10 00:58:38 +00:00
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Used to decide how to sort relocs in an optimal manner for the
dynamic linker, before writing them out. */
static enum elf_reloc_type_class
elf_s390_reloc_type_class (rela)
const Elf_Internal_Rela *rela;
{
switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_390_RELATIVE:
return reloc_class_relative;
case R_390_JMP_SLOT:
return reloc_class_plt;
case R_390_COPY:
return reloc_class_copy;
default:
return reloc_class_normal;
}
}
2001-02-10 00:58:38 +00:00
/* Finish up the dynamic sections. */
static bfd_boolean
2001-02-10 00:58:38 +00:00
elf_s390_finish_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
struct elf_s390_link_hash_table *htab;
2001-02-10 00:58:38 +00:00
bfd *dynobj;
asection *sdyn;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
htab = elf_s390_hash_table (info);
dynobj = htab->elf.dynobj;
2001-02-10 00:58:38 +00:00
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (htab->elf.dynamic_sections_created)
2001-02-10 00:58:38 +00:00
{
Elf32_External_Dyn *dyncon, *dynconend;
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (sdyn == NULL || htab->sgot == NULL)
abort ();
2001-02-10 00:58:38 +00:00
dyncon = (Elf32_External_Dyn *) 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 04:46:28 +00:00
dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
2001-02-10 00:58:38 +00:00
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
asection *s;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
switch (dyn.d_tag)
{
default:
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
continue;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
case DT_PLTGOT:
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
dyn.d_un.d_ptr = htab->sgot->output_section->vma;
break;
* elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF relocs into shared libs. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf.c (bfd_section_from_r_symndx): New function. * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define. (struct sym_sec_cache): New. (bfd_section_from_r_symndx): Declare. (struct bfd_elf_section_data): Change local_dynrel type to PTR. * elflink.h (elf_link_input_bfd): Don't test for removed linkonce relocs when relocatable. Don't zero entire reloc, just zero the addend and sym. * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec. (elf_i386_link_hash_table_create): Init it. (elf_i386_check_relocs): Track dynamic relocs needed for local syms on a per-section basis as we do for globals. (elf_i386_gc_sweep_hook): Update for local_dynrel change. Remove dead code. (allocate_dynrelocs): Warning fix. (elf_i386_size_dynamic_sections): Don't allocate relocs when section has been discarded. (elf_i386_relocate_section): Don't copy STN_UNDEF relocs into shared libs. * elf32-hppa.c: Likewise. * elf32-s390.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise.
2001-11-10 00:23:35 +00:00
2001-02-10 00:58:38 +00:00
case DT_JMPREL:
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
dyn.d_un.d_ptr = htab->srelplt->output_section->vma;
2001-02-10 00:58:38 +00:00
break;
case DT_PLTRELSZ:
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
s = htab->srelplt->output_section;
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
dyn.d_un.d_val = s->size;
2001-02-10 00:58:38 +00:00
break;
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
2001-02-10 00:58:38 +00:00
}
/* Fill in the special first entry in the procedure linkage table. */
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
if (htab->splt && htab->splt->size > 0)
2001-02-10 00:58:38 +00:00
{
memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE);
if (info->shared)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD0,
htab->splt->contents );
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD1,
htab->splt->contents +4 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD2,
htab->splt->contents +8 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD3,
htab->splt->contents +12 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD4,
htab->splt->contents +16 );
}
else
{
bfd_put_32 (output_bfd, (bfd_vma)PLT_FIRST_ENTRY_WORD0,
htab->splt->contents );
bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1,
htab->splt->contents +4 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2,
htab->splt->contents +8 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3,
htab->splt->contents +12 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4,
htab->splt->contents +16 );
bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5,
htab->splt->contents +20 );
bfd_put_32 (output_bfd,
htab->sgotplt->output_section->vma
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
+ htab->sgotplt->output_offset,
htab->splt->contents + 24);
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
elf_section_data (htab->splt->output_section)
->this_hdr.sh_entsize = 4;
2001-02-10 00:58:38 +00:00
}
}
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
if (htab->sgotplt)
2001-02-10 00:58:38 +00:00
{
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
/* Fill in the first three entries in the global offset table. */
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
if (htab->sgotplt->size > 0)
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
{
bfd_put_32 (output_bfd,
(sdyn == NULL ? (bfd_vma) 0
: sdyn->output_section->vma + sdyn->output_offset),
htab->sgotplt->contents);
/* One entry for shared object struct ptr. */
bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 4);
/* One entry for _dl_runtime_resolve. */
bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 8);
}
2001-02-10 00:58:38 +00:00
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
elf_section_data (htab->sgotplt->output_section)
->this_hdr.sh_entsize = 4;
}
return TRUE;
2001-02-10 00:58:38 +00:00
}
static bfd_boolean
elf_s390_grok_prstatus (abfd, note)
bfd * abfd;
Elf_Internal_Note * note;
{
int 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 04:46:28 +00:00
unsigned int size;
switch (note->descsz)
{
default:
return FALSE;
case 224: /* S/390 Linux. */
/* pr_cursig */
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
/* pr_pid */
elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
/* pr_reg */
offset = 72;
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
size = 144;
break;
}
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
bfd/ * section.c (struct sec): Rename "_cooked_size" to "size". Rename "_raw_size" to "rawsize". (STD_SECTION): Adjust comments. (bfd_set_section_size, bfd_get_section_contents): Use size. (bfd_malloc_and_get_section): New function. * bfd-in.h (bfd_section_size, bfd_get_section_size): Use size. * coff-sh.c (sh_relax_section): Alloc coff_section_data struct early. Correctly free reloc and contents memory. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME and fake CIE now that we can shink section size to zero. (_bfd_elf_write_section_eh_frame): Likewise.. * elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents. * elf-m10300.c (mn10300_elf_final_link_relocate): Don't use _bfd_stab_section_offset. Use _bfd_elf_section_offset. * stabs.c (_bfd_stab_section_offset_): Remove unused args and unneeded indirection. * elf.c (_bfd_elf_section_offset): .. and update call. * libbfd-in.h (_bfd_stab_section_offset): Update prototype. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. Replace occurrences of "_raw_size" and "_cooked_size" in most places with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE sections. Use "rawsize", if non-zero, for bfd_get_section_contents calls if the section might be a stabs, eh_frame, or SEC_MERGE section. Similarly use "rawsize", if non-zero, in reloc functions to validate reloc addresses. Use new bfd_malloc_and_get_section in most places where bfd_get_section_contents was called. Expand all occurrences of bfd_section_size and bfd_get_section_size. Rename "raw_size" var in grok_prstatus and similar functions to "size". * aix386-core.c (aix386_core_file_p): .. * aix5ppc-core.c (xcoff64_core_p): .. * aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents, aout_adobe_set_section_contents): .. * aout-target.h (callback): .. * aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate, MY_bfd_final_link): .. * aoutf1.h (sunos4_core_file_p): .. * aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags, final_link, aout_link_input_section): .. * binary.c (binary_object_p, binary_canonicalize_symtab, binary_set_section_contents): .. * bout.c (b_out_callback, b_out_write_object_contents, b_out_set_section_contents, b_out_bfd_relax_section, b_out_bfd_get_relocated_section_contents): .. * cisco-core.c (cisco_core_file_validate): .. * coff-alpha.c (alpha_ecoff_object_p, alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): .. * coff-arm.c (coff_arm_relocate_section, bfd_arm_allocate_interworking_sections): .. * coff-h8300.c (h8300_reloc16_extra_cases, h8300_bfd_link_add_symbols): .. * coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): .. * coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section, ppc_bfd_coff_final_link): .. * coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): .. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_align_loads, sh_coff_get_relocated_section_contents): .. * coff64-rs6000.c (xcoff64_write_object_contents, xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): .. * coffcode.h (coff_compute_section_file_positions, coff_write_object_contents): .. * coffgen.c (make_a_section_from_file, coff_write_symbols, coff_section_symbol, build_debug_section): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_final_link, process_embedded_commands, _bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): .. * cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): .. * cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): .. * dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): .. * dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info, _bfd_dwarf2_find_nearest_line): .. * ecoff.c (bfd_debug_section, ecoff_set_symbol_info, ecoff_compute_section_file_positions, _bfd_ecoff_write_object_contents, ecoff_indirect_link_order): .. * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame, _bfd_elf_discard_section_eh_frame_hdr, _bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset, _bfd_elf_write_section_eh_frame, _bfd_elf_write_section_eh_frame_hdr): .. * elf-hppa.h (elf_hppa_sort_unwind): .. * elf-m10200.c (mn10200_elf_relax_section, mn10200_elf_relax_delete_bytes, mn10200_elf_get_relocated_section_contents): .. * elf-m10300.c (_bfd_mn10300_elf_create_got_section, mn10300_elf_check_relocs, mn10300_elf_relax_section, mn10300_elf_relax_delete_bytes, mn10300_elf_get_relocated_section_contents, _bfd_mn10300_elf_adjust_dynamic_symbol, _bfd_mn10300_elf_discard_copies, _bfd_mn10300_elf_size_dynamic_sections, _bfd_mn10300_elf_finish_dynamic_sections): .. * elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list, _bfd_elf_make_section_from_phdr, elf_fake_sections, bfd_elf_set_group_contents, map_sections_to_segments, elf_sort_sections, assign_file_positions_for_segments, SECTION_SIZE, copy_private_bfd_data, _bfd_elf_get_dynamic_reloc_upper_bound, _bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect, _bfd_elfcore_make_pseudosection, elfcore_grok_prstatus, elfcore_grok_lwpstatus, elfcore_grok_win32pstatus, elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs, _bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): .. * elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect, bfd_elf32_arm_process_before_allocation, elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs, elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections, elf32_arm_write_section): .. * elf32-cris.c (cris_elf_grok_prstatus, elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook, elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol, cris_elf_check_relocs, elf_cris_size_dynamic_sections, elf_cris_discard_excess_dso_dynamics, elf_cris_discard_excess_program_dynamics): .. * elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): .. * elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): .. * elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup, _frv_create_got_section, _frvfdpic_assign_plt_entries, elf32_frvfdpic_size_dynamic_sections, elf32_frvfdpic_modify_segment_map, elf32_frvfdpic_finish_dynamic_sections): .. * elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes, elf32_h8_get_relocated_section_contents): .. * elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub, elf32_hppa_adjust_dynamic_symbol, allocate_plt_static, allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections, elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs, elf32_hppa_finish_dynamic_sections): .. * elf32-i370.c (i370_elf_adjust_dynamic_symbol, i370_elf_size_dynamic_sections, i370_elf_check_relocs, i370_elf_finish_dynamic_sections): .. * elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol, allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section, elf_i386_finish_dynamic_sections): .. * elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc, i860_howto_highadj_reloc, i860_howto_splitn_reloc): .. * elf32-ip2k.c (ip2k_is_switch_table_128, ip2k_relax_switch_table_128, ip2k_is_switch_table_256, ip2k_relax_switch_table_256, ip2k_elf_relax_section, adjust_all_relocations, ip2k_elf_relax_delete_bytes): .. * elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc, m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol, allocate_dynrelocs, m32r_elf_size_dynamic_sections, m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections, m32r_elf_relax_section, m32r_elf_relax_delete_bytes, m32r_elf_get_relocated_section_contents): .. * elf32-m68hc11.c (m68hc11_elf_build_one_stub, m68hc11_elf_size_one_stub, m68hc11_elf_relax_section, m68hc11_elf_relax_delete_bytes): .. * elf32-m68hc12.c (m68hc12_elf_build_one_stub, m68hc12_elf_size_one_stub): .. * elf32-m68hc1x.c (elf32_m68hc11_size_stubs, elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): .. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook, elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections, elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): .. * elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elf32-or32.c (or32_elf_consth_reloc): .. * elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc, elf_create_pointer_linker_section, ppc_elf_create_linker_section, ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus, ppc_elf_final_write_processing): .. * elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): .. * elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_align_loads, sh_elf_adjust_dynamic_symbol, allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents, sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): .. * elf32-sh64-com.c (sh64_address_in_cranges, sh64_get_contents_type): .. * elf32-sh64.c (sh64_find_section_for_address, sh64_elf_final_write_processing): .. * elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol, allocate_dynrelocs, elf32_sparc_size_dynamic_sections, elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): .. * elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): .. * elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol, elf_vax_size_dynamic_sections, elf_vax_discard_copies, elf_vax_instantiate_got_entries, elf_vax_relocate_section, elf_vax_finish_dynamic_sections): .. * elf32-xstormy16.c (xstormy16_elf_24_reloc, xstormy16_elf_check_relocs, xstormy16_relax_plt_check, xstormy16_elf_relax_section, xstormy16_elf_always_size_sections, xstormy16_elf_finish_dynamic_sections): .. * elf32-xtensa.c (xtensa_read_table_entries, elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size, elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc, bfd_elf_xtensa_reloc, elf_xtensa_relocate_section, elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections, elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus, get_relocation_opcode, retrieve_contents, find_relaxable_sections, collect_source_relocs, is_resolvable_asm_expansion, remove_literals, relax_section, shrink_dynamic_reloc_sections, relax_property_section, xtensa_callback_required_dependence): .. * elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section, elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol, elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets, elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1, elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes, elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1, elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel, elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): .. * elf64-hppa.c (allocate_dynrel_entries, elf64_hppa_size_dynamic_sections, elf64_hppa_finish_dynamic_sections): .. * elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc, mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table, elf64_mips_grok_prstatus): .. * elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc, mmix_elf_relocate_section, mmix_elf_final_link, mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation, mmix_elf_relax_section, mmix_elf_get_section_contents): .. * elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus, ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust, ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd, allocate_dynrelocs, ppc64_elf_size_dynamic_sections, ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section, toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs, ppc64_elf_build_stubs, ppc64_elf_relocate_section, ppc64_elf_finish_dynamic_sections): .. * elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol, allocate_dynrelocs, elf_s390_size_dynamic_sections, elf_s390_finish_dynamic_sections): .. * elf64-sh64.c (sh_elf64_get_relocated_section_contents, sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol, sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections, sh64_elf64_finish_dynamic_sections): .. * elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc, sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol, sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section, sparc64_elf_finish_dynamic_symbol, sparc64_elf_finish_dynamic_sections): .. * elf64-x86-64.c (elf64_x86_64_grok_prstatus, elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs, elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section, elf64_x86_64_finish_dynamic_sections): .. * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): .. * elfcode.h (elf_slurp_reloc_table): .. * elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag, elf_finalize_dynstr, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_sort_relocs, elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): .. * elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc, elf32_mips_grok_prstatus): .. * elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries, elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc, elfNN_ia64_choose_gp, elfNN_ia64_final_link, elfNN_ia64_finish_dynamic_sections): .. * elfxx-mips.c (mips_elf_create_procedure_table, mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp, _bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc, mips_elf_global_got_index, mips_elf_multi_got, mips_elf_create_compact_rel_section, mips_elf_calculate_relocation, mips_elf_allocate_dynamic_relocations, mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections, _bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol, _bfd_mips_elf_always_size_sections, _bfd_mips_elf_size_dynamic_sections, _bfd_mips_elf_finish_dynamic_symbol, _bfd_mips_elf_finish_dynamic_sections, _bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info, _bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents, _bfd_elf_mips_get_relocated_section_contents, _bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): .. * hp300hpux.c (callback): .. * hppabsd-core.c (make_bfd_asection): .. * hpux-core.c (make_bfd_asection): .. * i386linux.c (linux_link_create_dynamic_sections, bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): .. * i386msdos.c (msdos_write_object_contents): .. * i386os9k.c (os9k_callback, os9k_write_object_contents, os9k_set_section_contents): .. * ieee.c (parse_expression, ieee_slurp_external_symbols, ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data, ieee_write_section_part, do_with_relocs, do_as_repeat, do_without_relocs, ieee_write_debug_part, init_for_output, ieee_set_section_contents): .. * ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): .. * irix-core.c (do_sections, make_bfd_asection): .. * libaout.h (aout_section_merge_with_text_p): .. * libbfd.c (_bfd_generic_get_section_contents, _bfd_generic_get_section_contents_in_window): .. * linker.c (default_indirect_link_order): .. * lynx-core.c (make_bfd_asection): .. * m68klinux.c (linux_link_create_dynamic_sections, bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): .. * mach-o.c (bfd_mach_o_make_bfd_section, bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib, bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab, bfd_mach_o_scan_read_segment): .. * merge.c (_bfd_add_merge_section, record_section, merge_strings, _bfd_merge_sections): .. * mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc, mmo_map_set_sizes, mmo_canonicalize_symtab, mmo_internal_write_section, mmo_write_object_contents): .. * netbsd-core.c (netbsd_core_file_p): .. * nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import, nlm_alpha_set_public_section): .. * nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): .. * nlm32-sparc.c (nlm_sparc_write_import): .. * nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in, nlm_compute_section_file_positions): .. * oasys.c (oasys_object_p, oasys_slurp_section_data, oasys_write_sections, oasys_write_data, oasys_set_section_contents): .. * opncls.c (get_debug_link_info): .. * osf-core.c (make_bfd_asection): .. * pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic, adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs, final_link, aout_link_input_section): .. * peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out, pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): .. * pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section, bfd_pef_scan_start_address, bfd_pef_parse_symbols): .. * ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): .. * ptrace-core.c (ptrace_unix_core_file_p): .. * reloc.c (bfd_perform_relocation, bfd_install_relocation, _bfd_final_link_relocate, bfd_generic_relax_section, bfd_generic_get_relocated_section_contents): .. * reloc16.c (bfd_coff_reloc16_relax_section, bfd_coff_reloc16_get_relocated_section_c): .. * riscix.c (riscix_some_aout_object_p): .. * rs6000-core.c (read_hdr, make_bfd_asection): .. * sco5-core.c (make_bfd_asection): .. * simple.c (bfd_simple_get_relocated_section_contents): .. * som.c (som_object_setup, setup_sections, som_prep_headers, som_write_fixups, som_begin_writing, bfd_section_from_som_symbol, som_set_reloc_info, som_get_section_contents, som_bfd_link_split_section): .. * sparclinux.c (linux_link_create_dynamic_sections, bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): .. * srec.c (srec_scan, srec_read_section, srec_get_section_contents): .. * stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs, _bfd_write_stab_strings, _bfd_stab_section_offset): .. * sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections, bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs, sunos_scan_ext_relocs, sunos_scan_dynamic_symbol, sunos_write_dynamic_symbol, sunos_check_dynamic_reloc, sunos_finish_dynamic_link): .. * syms.c (_bfd_stab_section_find_nearest_line): .. * tekhex.c (first_phase, tekhex_set_section_contents, tekhex_write_object_contents): .. * trad-core.c (trad_unix_core_file_p): .. * versados.c (process_esd, process_otr, process_otr): .. * vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): .. * vms-misc.c (add_new_contents): .. * vms-tir.c (check_section, new_section, _bfd_vms_write_tir): .. * vms.c (vms_set_section_contents): .. * xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols, xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms, _bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): .. * xsym.c (bfd_sym_scan): .. See above. binutils/ * objcopy.c (copy_section): Don't set _cooked_size. include/ * bfdlink.h (struct bfd_link_order): Update comment. ld/ * ldlang.c (print_output_section_statement): Don't print size before relaxation. (IGNORE_SECTION): Remove bfd arg. Update all callers. * ldexp.c (fold_name): .. See below. * ldlang.c (section_already_linked, print_output_section_statement, print_input_section, insert_pad, size_input_section, lang_check_section_addresses, lang_size_sections_1, lang_size_sections, lang_do_assignments_1, lang_set_startof, lang_one_common, lang_reset_memory_regions, lang_process, lang_abs_symbol_at_end_of, lang_do_version_exports_section): .. * ldwrite.c (build_link_order, clone_section, ds, split_sections): .. * pe-dll.c (process_def_file, generate_reloc): .. * emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment, gld${EMULATION_NAME}_before_allocation): .. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): .. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation, sh64_elf_${EMULATION_NAME}_after_allocation): .. * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): .. * emultempl/xtensaelf.em (ld_assign_relative_paged_dot, ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use "size" instead of "_raw_size" and "_cooked_size". Expand bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
size, note->descpos + offset);
}
bfd/ * bfd.c (bfd_get_synthetic_symtab): Define. * targets.c (BFD_JUMP_TABLE_DYNAMIC): Add NAME##_get_synthetic_symtab. (struct bfd_target): Add _bfd_get_synthetic_symtab. * libbfd-in.h (_bfd_nodynamic_get_synthetic_symtab): Define. * elf-bfd.h (struct elf_backend_data): Add plt_sym_val and relplt_name fields. (_bfd_elf_get_synthetic_symtab): New prototype. * elfcode.h (elf_get_synthetic_symtab): Define. * elf.c (_bfd_elf_get_synthetic_symtab): New function. * elfxx-target.h (bfd_elfNN_get_synthetic_symtab): Define. (elf_backend_plt_sym_val, elf_backend_relplt_name): Define. (elfNN_bed): Add elf_backend_plt_sym_val and elf_backend_relplt_name. * bfd-in2.h: Rebuilt. * libbfd.h: Rebuilt. * elf32-i386.c (elf_i386_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-x86-64.c (elf64_x86_64_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-s390.c (elf_s390_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-s390.c (elf_s390_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-sparc (elf32_sparc_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-sparc.c (sparc64_elf_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-ppc.c (ppc_elf_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * aout-target.h (MY_get_synthetic_symtab): Define. * aout-tic30.c (MY_get_synthetic_symtab): Define. * coff-rs6000.c (rs6000coff_vec): Add _bfd_nodynamic_get_synthetic_symtab. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Add _bfd_nodynamic_get_synthetic_symtab. (aix5coff64_vec): Likewise. * sunos.c (MY_get_synthetic_symtab): Define. * vms.c (vms_get_synthetic_symtab): Define. binutils/ * objdump.c (synthsyms, synthcount): New variables. (disassemble_data): Use dynsyms for stripped binaries or libraries. Add synthetized symbols. (dump_bfd): For disassemble, initialize dynsyms always and also synthsyms. Free synthsyms and clear {sym,dynsym,synth}count before returning.
2004-04-22 14:45:32 +00:00
/* Return address for Ith PLT stub in section PLT, for relocation REL
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
}
2001-02-10 00:58:38 +00:00
#define TARGET_BIG_SYM bfd_elf32_s390_vec
#define TARGET_BIG_NAME "elf32-s390"
#define ELF_ARCH bfd_arch_s390
#define ELF_MACHINE_CODE EM_S390
#define ELF_MACHINE_ALT1 EM_S390_OLD
#define ELF_MAXPAGESIZE 0x1000
#define elf_backend_can_gc_sections 1
* elf-bfd.h (struct elf_link_local_dynamic_entry): Add init_refcount. (struct elf_backend_data): Add can_refcount. * elf.c (_bfd_elf_link_hash_newfunc): Get rid of a few casts. Set got.refcount and plt.refcount from init_refcount. (_bfd_elf_link_hash_table_init): Set up init_refcount. (_bfd_elf_link_hash_copy_indirect): Reference got/plt.refcount rather than got/plt.offset, and test for <= 0 rather than -1. * elflink.h (size_dynamic_sections): Set init_refcount to -1. * elfxx-target.h (elf_backend_can_refcount): Define. (elfNN_bed): Init can_refcount. * linker.c (_bfd_link_hash_newfunc): Get rid of a few casts. (_bfd_generic_link_hash_newfunc): Likewise. * elf32-cris.c (cris_elf_check_relocs): Modify for refcounts starting from zero. (elf_backend_can_refcount): Define. * elf32-hppa.c (elf32_hppa_check_relocs): Modify for refcounts starting from zero. (elf32_hppa_copy_indirect_symbol): Make static to agree with prototype. (elf_backend_can_refcount): Define. * elf32-i386.c (elf_i386_check_relocs): Modify for refcounts starting from zero. (allocate_dynrelocs): Set plt/got.offset rather than *.refcount. (elf_i386_finish_dynamic_symbol): Expand SHN_UNDEF comment. (elf_i386_finish_dynamic_sections): Use local var so line < 80 chars. (elf_backend_can_refcount): Define. (elf_i386_copy_indirect_symbol): Make static to agree with prototype. Formatting fix. * elf32-m68k.c (elf_m68k_check_relocs): Modify for refcounts starting from zero. (elf_backend_can_refcount): Define. * elf32-ppc.c (ppc_elf_check_relocs): Modify for refcounts starting from zero. (elf_backend_can_refcount): Define. * elf32-s390.c (elf_s390_check_relocs): Modify for refcounts starting from zero. (elf_backend_can_refcount): Define. * elf64-s390.c (elf_s390_check_relocs): Modify for refcounts starting from zero. (elf_backend_can_refcount): Define. * elf64-x86-64.c (elf64_x86_64_check_relocs): Modify for refcounts starting from zero. (elf_backend_can_refcount): Define.
2001-09-29 06:21:59 +00:00
#define elf_backend_can_refcount 1
2001-02-10 00:58:38 +00:00
#define elf_backend_want_got_plt 1
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 12
* elf-bfd.h (struct elf_backend_data): Add rela_normal. * elfxx-target.h (elf_backend_rela_normal): Define. (elfNN_bed): Init rela_normal. * elflink.h (elf_link_input_bfd <emit_relocs>): Handle adjustment for section symbols here if rela_normal. Simplify abs section test. * elf-m10200.c (mn10200_elf_relocate_section): If relocatable, return immediately. Remove code handling relocatable linking. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mcore.c (mcore_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-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf-m10200.c (elf_backend_rela_normal): Define. * elf-m10300.c (elf_backend_rela_normal): Define. * elf32-fr30.c (elf_backend_rela_normal): Define. * elf32-i370.c (elf_backend_rela_normal): Define. * elf32-i860.c (elf_backend_rela_normal): Define. * elf32-m68k.c (elf_backend_rela_normal): Define. * elf32-mcore.c (elf_backend_rela_normal): Define. * elf32-openrisc.c (elf_backend_rela_normal): Define. * elf32-ppc.c (elf_backend_rela_normal): Define. * elf32-s390.c (elf_backend_rela_normal): Define. * elf32-xstormy16.c (elf_backend_rela_normal): Define. * elf64-ppc.c (elf_backend_rela_normal): Define. * elf64-s390.c (elf_backend_rela_normal): Define. * elf64-x86-64.c (elf_backend_rela_normal): Define. * elfxx-ia64.c (elf_backend_rela_normal): Define. * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL. * elf32-m32r.c (elf_backend_rela_normal): Likewise.
2002-05-07 00:16:53 +00:00
#define elf_backend_rela_normal 1
2001-02-10 00:58:38 +00:00
#define elf_info_to_howto elf_s390_info_to_howto
2001-02-10 00:58:38 +00:00
#define bfd_elf32_bfd_is_local_label_name elf_s390_is_local_label_name
#define bfd_elf32_bfd_link_hash_table_create elf_s390_link_hash_table_create
#define bfd_elf32_bfd_reloc_type_lookup elf_s390_reloc_type_lookup
* aout-adobe.c (aout_32_bfd_reloc_name_lookup): Define. * aout-arm.c (MY_bfd_reloc_name_lookup): Define. (MY (bfd_reloc_name_lookup)): New function. * aout-ns32k.c (MY (bfd_reloc_name_lookup)): New function. * aout-target.h (NAME (aout, reloc_name_lookup)): Declare. (MY_bfd_reloc_name_lookup): Define. * aout-tic30.c (tic30_aout_reloc_name_lookup): New function. (MY_bfd_reloc_name_lookup): Define. * aoutx.h (NAME (aout, reloc_type_lookup)): Don't declare. (NAME (aout, reloc_name_lookup)): New function. * bout.c (b_out_bfd_reloc_name_lookup): New function. * coff-alpha.c (alpha_bfd_reloc_name_lookup): New function. (_bfd_ecoff_bfd_reloc_name_lookup): Define. * coff-arm.c (coff_arm_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-i386.c (coff_bfd_reloc_name_lookup): Define. (coff_i386_reloc_name_lookup): New function. * coff-i860.c (coff_i860_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-i960.c (coff_i960_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-m68k.c (m68k_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-maxq.c (maxq_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-mcore.c (mcore_coff_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-mips.c (mips_bfd_reloc_name_lookup): New function. (_bfd_ecoff_bfd_reloc_name_lookup): Define. * coff-ppc.c (ppc_coff_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-rs6000.c (coff_bfd_reloc_name_lookup): Define. (_bfd_xcoff_reloc_name_lookup): New function. (rs6000coff_vec, pmac_xcoff_vec): Init new field. * coff-sh.c (coff_bfd_reloc_name_lookup): Define. (sh_coff_reloc_name_lookup): New function. * coff-sparc.c (coff_sparc_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-tic30.c (coff_bfd_reloc_name_lookup): Define. (tic30_coff_reloc_name_lookup): New function. * coff-tic4x.c (coff_bfd_reloc_name_lookup): Define. (tic4x_coff_reloc_name_lookup): New function. * coff-tic54x.c (coff_bfd_reloc_name_lookup): Define. (tic54x_coff_reloc_name_lookup): New function. * coff-x86_64.c (coff_bfd_reloc_name_lookup): Define. (coff_amd64_reloc_name_lookup): New function. * coff-z80.c (coff_z80_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff-z8k.c (coff_z8k_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * coff64-rs6000.c (coff_bfd_reloc_name_lookup): Define. (xcoff64_reloc_name_lookup): New function. (rs6000coff64_vec, aix5coff64_vec): Init new field. * coffcode.h (coff_bfd_reloc_name_lookup): Define. * elf-hppa.h (elf_hppa_reloc_name_lookup): New function. * elf-m10200.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf-m10300.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-arc.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-arm.c (elf32_arm_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-avr.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-bfin.c (bfin_bfd_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-cr16c.c (elf_cr16c_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-cris.c (cris_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-crx.c (elf_crx_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-d10v.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-d30v.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-dlx.c (elf32_dlx_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-fr30.c (fr30_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-frv.c (frv_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-gen.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-h8300.c (elf32_h8_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-hppa.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i370.c (i370_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i386.c (elf_i386_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i860.c (elf32_i860_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-i960.c (elf32_i960_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-ip2k.c (ip2k_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-iq2000.c (iq2000_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m32c.c (m32c_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m32r.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68hc11.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68hc12.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-m68k.c (reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-m88k.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mcore.c (mcore_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mep.c (mep_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. (mips_vxworks_bfd_reloc_name_lookup): Likewise. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-msp430.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-mt.c (mt_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-openrisc.c (openrisc_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-or32.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elf32-pj.c (pj_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-ppc.c (ppc_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-s390.c (elf_s390_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-score.c (elf32_score_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-sh.c (sh_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-sparc.c (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-spu.c (spu_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-v850.c (v850_elf_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-vax.c (reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xc16x.c (xc16x_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xstormy16.c (xstormy16_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf32-xtensa.c (elf_xtensa_reloc_name_lookup): New function. (bfd_elf32_bfd_reloc_name_lookup): Define. * elf64-alpha.c (elf64_alpha_bfd_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-gen.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-hppa.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-mips.c (bfd_elf64_bfd_reloc_name_lookup): New function. * elf64-mmix.c (bfd_elf64_bfd_reloc_name_lookup): New function. * elf64-ppc.c (ppc64_elf_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-s390.c (elf_s390_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-sh64.c (sh_elf64_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-sparc.c (bfd_elf64_bfd_reloc_name_lookup): Define. * elf64-x86-64.c (elf64_x86_64_reloc_name_lookup): New function. (bfd_elf64_bfd_reloc_name_lookup): Define. * elfn32-mips.c (bfd_elf32_bfd_reloc_name_lookup): New function. * elfxx-ia64.c (elfNN_ia64_reloc_name_lookup): New function. (bfd_elfNN_bfd_reloc_name_lookup): Define. * elfxx-sparc.c (_bfd_sparc_elf_reloc_name_lookup): New function. * elfxx-sparc.h (_bfd_sparc_elf_reloc_name_lookup): Declare. * i386msdos.c (msdos_bfd_reloc_name_lookup): Define. * i386os9k.c (aout_32_bfd_reloc_name_lookup): Define. * ieee.c (ieee_bfd_reloc_name_lookup): Define. * libaout.h (NAME (aout, reloc_name_lookup)): Declare. * libbfd-in.h (_bfd_norelocs_bfd_reloc_name_lookup): Declare. * mipsbsd.c (MY_bfd_reloc_name_lookup): Define. (MY(reloc_type_lookup)): Rename from MY(reloc_howto_type_lookup). (MY(reloc_name_lookup)): New function. * nlm-target.h (nlm_bfd_reloc_name_lookup): Define. * oasys.c (oasys_bfd_reloc_name_lookup): Define. * pdp11.c (NAME (aout, reloc_name_lookup)): New function. * pe-mips.c (coff_mips_reloc_name_lookup): New function. (coff_bfd_reloc_name_lookup): Define. * reloc.c (bfd_reloc_name_lookup): New function. * riscix.c (riscix_reloc_name_lookup): New function. (MY_bfd_reloc_name_lookup): Define. * som.c (som_bfd_reloc_name_lookup): New function. * targets.c (struct bfd_target): Add reloc_name_lookup. (BFD_JUMP_TABLE_RELOCS): Add NAME##_bfd_reloc_name_lookup. * versados.c (versados_bfd_reloc_name_lookup): Define. * vms.c (vms_bfd_reloc_name_lookup): New function. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2007-03-26 12:23:03 +00:00
#define bfd_elf32_bfd_reloc_name_lookup elf_s390_reloc_name_lookup
2001-02-10 00:58:38 +00:00
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_s390_check_relocs
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
#define elf_backend_copy_indirect_symbol elf_s390_copy_indirect_symbol
#define elf_backend_create_dynamic_sections elf_s390_create_dynamic_sections
2001-02-10 00:58:38 +00:00
#define elf_backend_finish_dynamic_sections elf_s390_finish_dynamic_sections
#define elf_backend_finish_dynamic_symbol elf_s390_finish_dynamic_symbol
#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook
#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook
* elf32-s390: Major rework that introduces all recent changes to the s390 backends. Get a closer match to elf32-i386. (elf_s390_relocate_section): Make use of dynamic section short-cuts. Localise vars, and delay setting. Better error reporting, replace BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined in the regular object file and tread the weak definition as the normal one. Don't discard relocs for undefweak or undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in test for avoided copy relocs. Reinstate fudge for unresolved relocs in debugging sections. (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy reloc processing for weakdefs. Remove redundant casts and aborts. Delay setting of vars until needed. Move creation of dynamic symbols and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace BFD_ASSERT with abort. Discard .plt entries for everything with plt.refcount <= 0. (elf_s390_check_relocs): Don't allocate space for dynamic relocs, .got or .relgot here but do it in allocate_dynrelocs. Reference count possible .plt and .got entries. Don't test input section SEC_READONLY here to try to avoid copy relocs, and keep dyn_relocs regardless of ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of variables until needed. Remove separate switch stmt for creating .got section. Initialise local_got_refcounts to 0. Cache pointer to "sreloc" section in elf_section_data. Tweak condition under which .got created. Report files with bad relocation section names. (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that have been forced local. Use same test to decide if we can use a relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF comment. Move expressions out of function calls. Replace BFD_ASSERT with abort. (elf_s390_finish_dynamic_sections): Migrate common code out of switch statement. Replace BFD_ASSERT with abort. (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i" to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag instead of looking up section names for DT_TEXTREL. Replace BFD_ASSERT with abort. Zero out the dynamic allocated content space. Add a comment to remind us that one day this ought to be fixed. (struct elf_s390_link_hash_entry): Rename "root" to "elf". (struct elf_s390_link_hash_table): Likewise. (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get rid of unnecessary casts. (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields. Remove "section" field. (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel. Reference count possible .plt entries. Don't deallocate .got and .relgot space here. (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs. Update comment. (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to dyn_relocs. (elf_s390_discard_copies): Delete. (elf_s390_link_hash_traverse): Delete. (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link rather than gc variety). (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields. (elf_s390_link_hash_table_create): Init them. (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. (allocate_dynrelocs): New function. (create_got_section): New function. (elf_backend_can_refcount): Define. (elf_backend_copy_indirect_symbol): Define. (elf_s390_copy_indirect_symbol): New function. (elf_s390_create_dynamic_sections): New function. (readonly_dynrelocs): New function. * elf64-s390x: Likewise.
2001-11-08 18:45:46 +00:00
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_relocate_section elf_s390_relocate_section
2001-02-10 00:58:38 +00:00
#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
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 13:41:49 +00:00
#define elf_backend_init_index_section _bfd_elf_init_1_index_section
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_grok_prstatus elf_s390_grok_prstatus
bfd/ * bfd.c (bfd_get_synthetic_symtab): Define. * targets.c (BFD_JUMP_TABLE_DYNAMIC): Add NAME##_get_synthetic_symtab. (struct bfd_target): Add _bfd_get_synthetic_symtab. * libbfd-in.h (_bfd_nodynamic_get_synthetic_symtab): Define. * elf-bfd.h (struct elf_backend_data): Add plt_sym_val and relplt_name fields. (_bfd_elf_get_synthetic_symtab): New prototype. * elfcode.h (elf_get_synthetic_symtab): Define. * elf.c (_bfd_elf_get_synthetic_symtab): New function. * elfxx-target.h (bfd_elfNN_get_synthetic_symtab): Define. (elf_backend_plt_sym_val, elf_backend_relplt_name): Define. (elfNN_bed): Add elf_backend_plt_sym_val and elf_backend_relplt_name. * bfd-in2.h: Rebuilt. * libbfd.h: Rebuilt. * elf32-i386.c (elf_i386_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-x86-64.c (elf64_x86_64_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-s390.c (elf_s390_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-s390.c (elf_s390_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-sparc (elf32_sparc_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf64-sparc.c (sparc64_elf_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * elf32-ppc.c (ppc_elf_plt_sym_val): New function. (elf_backend_plt_sym_val): Define. * aout-target.h (MY_get_synthetic_symtab): Define. * aout-tic30.c (MY_get_synthetic_symtab): Define. * coff-rs6000.c (rs6000coff_vec): Add _bfd_nodynamic_get_synthetic_symtab. (pmac_xcoff_vec): Likewise. * coff64-rs6000.c (rs6000coff64_vec): Add _bfd_nodynamic_get_synthetic_symtab. (aix5coff64_vec): Likewise. * sunos.c (MY_get_synthetic_symtab): Define. * vms.c (vms_get_synthetic_symtab): Define. binutils/ * objdump.c (synthsyms, synthcount): New variables. (disassemble_data): Use dynsyms for stripped binaries or libraries. Add synthetized symbols. (dump_bfd): For disassemble, initialize dynsyms always and also synthsyms. Free synthsyms and clear {sym,dynsym,synth}count before returning.
2004-04-22 14:45:32 +00:00
#define elf_backend_plt_sym_val elf_s390_plt_sym_val
2001-02-10 00:58:38 +00:00
#define bfd_elf32_mkobject elf_s390_mkobject
#define elf_backend_object_p elf_s390_object_p
2001-02-10 00:58:38 +00:00
#include "elf32-target.h"