From c79d66855748c1539173c5a2d825f03f1a0b748c Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 1 Jul 2011 07:49:08 +0000 Subject: * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Don't look at dyn relocs when called to copy flags for a weak sym. * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise. (ppc64_elf_merge_private_bfd_data): Delete. (bfd_elf64_bfd_merge_private_bfd_data): Define as _bfd_generic_verify_endian_match. --- bfd/ChangeLog | 13 ++++++++-- bfd/elf32-ppc.c | 42 +++++++++++++++---------------- bfd/elf64-ppc.c | 77 ++++++++++++++++++--------------------------------------- 3 files changed, 56 insertions(+), 76 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index caa5483..32340ee 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2011-07-01 Alan Modra + + * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Don't look at + dyn relocs when called to copy flags for a weak sym. + * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise. + (ppc64_elf_merge_private_bfd_data): Delete. + (bfd_elf64_bfd_merge_private_bfd_data): Define as + _bfd_generic_verify_endian_match. + 2011-06-30 Bernd Schmidt * bfd/elf32-tic6x.c (elf32_tic6x_set_osabi): Also set it if @@ -85,8 +94,8 @@ 2011-06-22 Ramana Radhakrishnan - * elf32-arm.c (elf32_arm_final_link_relocate): Allow R_ARM_TLS_LE32 - for PIE. + * elf32-arm.c (elf32_arm_final_link_relocate): Allow R_ARM_TLS_LE32 + for PIE. 2011-06-22 Alan Modra diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index f05ddb2..4dd193a 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2957,6 +2957,27 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct ppc_elf_link_hash_entry *) dir; eind = (struct ppc_elf_link_hash_entry *) ind; + edir->tls_mask |= eind->tls_mask; + edir->has_sda_refs |= eind->has_sda_refs; + + /* 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. */ + if (!(ELIMINATE_COPY_RELOCS + && eind->elf.root.type != bfd_link_hash_indirect + && edir->elf.dynamic_adjusted)) + edir->elf.non_got_ref |= eind->elf.non_got_ref; + + edir->elf.ref_dynamic |= eind->elf.ref_dynamic; + edir->elf.ref_regular |= eind->elf.ref_regular; + edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak; + edir->elf.needs_plt |= eind->elf.needs_plt; + edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed; + + /* If we were called to copy over info for a weak sym, that's all. */ + if (eind->elf.root.type != bfd_link_hash_indirect) + return; + if (eind->dyn_relocs != NULL) { if (edir->dyn_relocs != NULL) @@ -2988,27 +3009,6 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info, eind->dyn_relocs = NULL; } - edir->tls_mask |= eind->tls_mask; - edir->has_sda_refs |= eind->has_sda_refs; - - /* 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. */ - if (!(ELIMINATE_COPY_RELOCS - && eind->elf.root.type != bfd_link_hash_indirect - && edir->elf.dynamic_adjusted)) - edir->elf.non_got_ref |= eind->elf.non_got_ref; - - edir->elf.ref_dynamic |= eind->elf.ref_dynamic; - edir->elf.ref_regular |= eind->elf.ref_regular; - edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak; - edir->elf.needs_plt |= eind->elf.needs_plt; - edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed; - - /* If we were called to copy over info for a weak sym, that's all. */ - if (eind->elf.root.type != bfd_link_hash_indirect) - return; - /* Copy over the GOT refcount entries that we may have already seen to the symbol which just became indirect. */ edir->elf.got.refcount += eind->elf.got.refcount; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 14fa20b..a49ef60 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -80,7 +80,7 @@ static bfd_vma opd_entry_value #define bfd_elf64_mkobject ppc64_elf_mkobject #define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup #define bfd_elf64_bfd_reloc_name_lookup ppc64_elf_reloc_name_lookup -#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data +#define bfd_elf64_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match #define bfd_elf64_new_section_hook ppc64_elf_new_section_hook #define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create #define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free @@ -2727,35 +2727,6 @@ ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, } } -/* Merge backend specific data from an object file to the output - object file when linking. */ - -static bfd_boolean -ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) -{ - /* Check if we have the same endianness. */ - if (ibfd->xvec->byteorder != obfd->xvec->byteorder - && ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN - && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN) - { - const char *msg; - - if (bfd_big_endian (ibfd)) - msg = _("%B: compiled for a big endian system " - "and target is little endian"); - else - msg = _("%B: compiled for a little endian system " - "and target is big endian"); - - (*_bfd_error_handler) (msg, ibfd); - - bfd_set_error (bfd_error_wrong_format); - return FALSE; - } - - return TRUE; -} - /* Add extra PPC sections. */ static const struct bfd_elf_special_section ppc64_elf_special_sections[]= @@ -4378,6 +4349,29 @@ ppc64_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct ppc_link_hash_entry *) dir; eind = (struct ppc_link_hash_entry *) ind; + edir->is_func |= eind->is_func; + edir->is_func_descriptor |= eind->is_func_descriptor; + edir->tls_mask |= eind->tls_mask; + if (eind->oh != NULL) + edir->oh = ppc_follow_link (eind->oh); + + /* 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. */ + if (!(ELIMINATE_COPY_RELOCS + && eind->elf.root.type != bfd_link_hash_indirect + && edir->elf.dynamic_adjusted)) + edir->elf.non_got_ref |= eind->elf.non_got_ref; + + edir->elf.ref_dynamic |= eind->elf.ref_dynamic; + edir->elf.ref_regular |= eind->elf.ref_regular; + edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak; + edir->elf.needs_plt |= eind->elf.needs_plt; + + /* If we were called to copy over info for a weak sym, that's all. */ + if (eind->elf.root.type != bfd_link_hash_indirect) + return; + /* Copy over any dynamic relocs we may have on the indirect sym. */ if (eind->dyn_relocs != NULL) { @@ -4410,29 +4404,6 @@ ppc64_elf_copy_indirect_symbol (struct bfd_link_info *info, eind->dyn_relocs = NULL; } - edir->is_func |= eind->is_func; - edir->is_func_descriptor |= eind->is_func_descriptor; - edir->tls_mask |= eind->tls_mask; - if (eind->oh != NULL) - edir->oh = ppc_follow_link (eind->oh); - - /* 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. */ - if (!(ELIMINATE_COPY_RELOCS - && eind->elf.root.type != bfd_link_hash_indirect - && edir->elf.dynamic_adjusted)) - edir->elf.non_got_ref |= eind->elf.non_got_ref; - - edir->elf.ref_dynamic |= eind->elf.ref_dynamic; - edir->elf.ref_regular |= eind->elf.ref_regular; - edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak; - edir->elf.needs_plt |= eind->elf.needs_plt; - - /* If we were called to copy over info for a weak sym, that's all. */ - if (eind->elf.root.type != bfd_link_hash_indirect) - return; - /* Copy over got entries that we may have already seen to the symbol which just became indirect. */ if (eind->elf.got.glist != NULL) -- cgit v1.1