This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] PR22300, Abort in elf32_hppa_relocate_section building polyml


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c0e331c794d6bd75d9be9bea6145513074c33f39

commit c0e331c794d6bd75d9be9bea6145513074c33f39
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Oct 28 14:10:55 2017 +1030

    PR22300, Abort in elf32_hppa_relocate_section building polyml
    
    polyml produces object files with the wrong OS/ABI for hppa-linux.
    This, along with the fact that elf32-hppa.c is using the strictest
    backend relocs_compatible, results in wrong merging of ELF symbols.
    
    So, remove the relocs_compatible check in _bfd_elf_merge_symbol.
    _bfd_elf_merge_symbol is only called nowadays from within blocks
    protected by is_elf_hash_table, so "we are doing an ELF link" as the
    removed comment says, is true.
    
    Also relax relocs_compatible for hppa and powerpc.  relocs_compatible
    is used for more than just merging symbols, as the name suggests.
    This allows objects that are in fact reasonably compatible to be
    linked.
    
    	PR 22300
    	* elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check.
    	* elf32-hppa.c (elf_backend_relocs_compatible): Define.
    	* elf32-ppc.c (elf_backend_relocs_compatible): Define.
    	* elf64-ppc.c (elf_backend_relocs_compatible): Define.

Diff:
---
 bfd/ChangeLog    | 8 ++++++++
 bfd/elf32-hppa.c | 1 +
 bfd/elf32-ppc.c  | 1 +
 bfd/elf64-ppc.c  | 1 +
 bfd/elflink.c    | 5 -----
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ca780aa..07ad2b8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2017-10-28  Alan Modra  <amodra@gmail.com>
+
+	PR 22300
+	* elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check.
+	* elf32-hppa.c (elf_backend_relocs_compatible): Define.
+	* elf32-ppc.c (elf_backend_relocs_compatible): Define.
+	* elf64-ppc.c (elf_backend_relocs_compatible): Define.
+
 2017-10-25  Alan Modra  <amodra@gmail.com>
 
 	* archive.c (_bfd_compute_and_write_armap): Match "__gnu_lto_slim"
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 9d94603..97b6026 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -4498,6 +4498,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
 #define elf_backend_adjust_dynamic_symbol    elf32_hppa_adjust_dynamic_symbol
 #define elf_backend_copy_indirect_symbol     elf32_hppa_copy_indirect_symbol
 #define elf_backend_check_relocs	     elf32_hppa_check_relocs
+#define elf_backend_relocs_compatible	     _bfd_elf_relocs_compatible
 #define elf_backend_create_dynamic_sections  elf32_hppa_create_dynamic_sections
 #define elf_backend_fake_sections	     elf_hppa_fake_sections
 #define elf_backend_relocate_section	     elf32_hppa_relocate_section
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index bd29377..afd233f 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -10778,6 +10778,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
 #define elf_backend_relocate_section		ppc_elf_relocate_section
 #define elf_backend_create_dynamic_sections	ppc_elf_create_dynamic_sections
 #define elf_backend_check_relocs		ppc_elf_check_relocs
+#define elf_backend_relocs_compatible		_bfd_elf_relocs_compatible
 #define elf_backend_copy_indirect_symbol	ppc_elf_copy_indirect_symbol
 #define elf_backend_adjust_dynamic_symbol	ppc_elf_adjust_dynamic_symbol
 #define elf_backend_add_symbol_hook		ppc_elf_add_symbol_hook
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 10f895d..8c98fd5 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -101,6 +101,7 @@ static bfd_vma opd_entry_value
 #define elf_backend_notice_as_needed	      ppc64_elf_notice_as_needed
 #define elf_backend_archive_symbol_lookup     ppc64_elf_archive_symbol_lookup
 #define elf_backend_check_relocs	      ppc64_elf_check_relocs
+#define elf_backend_relocs_compatible	      _bfd_elf_relocs_compatible
 #define elf_backend_gc_keep		      ppc64_elf_gc_keep
 #define elf_backend_gc_mark_dynamic_ref       ppc64_elf_gc_mark_dynamic_ref
 #define elf_backend_gc_mark_hook	      ppc64_elf_gc_mark_hook
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 20057f5..9f2d63b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1162,11 +1162,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
   if (pold_weak)
     *pold_weak = oldweak;
 
-  /* This code is for coping with dynamic objects, and is only useful
-     if we are doing an ELF link.  */
-  if (!(*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
-    return TRUE;
-
   /* We have to check it for every instance since the first few may be
      references and not all compilers emit symbol type for undefined
      symbols.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]