[binutils-gdb] Fix ld/PR25316 for the ia64 target by refusing to support binary merging.

Nick Clifton nickc@sourceware.org
Fri Jan 3 11:22:00 GMT 2020


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

commit b26a3d5827edcb942b3af5b921bf317bbc0c8e83
Author: Sergei Trofimovich <siarheit@google.com>
Date:   Fri Jan 3 11:21:00 2020 +0000

    Fix ld/PR25316 for the ia64 target by refusing to support binary merging.
    
    	ld/PR25316
    	* elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
            on binary inputs ld/PR25316.
            (is_ia64_elf): new helper to filter on ia64 objects.

Diff:
---
 bfd/ChangeLog    |  6 ++++++
 bfd/elfnn-ia64.c | 11 +++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1880bd4..2b98866 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-03  Sergei Trofimovich  <siarheit@google.com>
+
+        * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
+        on binary inputs ld/PR25316.
+        (is_ia64_elf): new helper to filter on ia64 objects.
+
 2020-01-03  Jan Beulich  <jbeulich@suse.com>
 
 	* mach-o.c (cpusubtype, bfd_mach_o_header_p): Insert underscore
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index 7612d29..2ba9608 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -39,6 +39,10 @@
 #define	LOG_SECTION_ALIGN	2
 #endif
 
+#define is_ia64_elf(bfd)			   \
+  (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
+   && elf_object_id (bfd) == IA64_ELF_DATA)
+
 typedef struct bfd_hash_entry *(*new_hash_entry_func)
   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
 
@@ -4732,6 +4736,7 @@ elfNN_ia64_set_private_flags (bfd *abfd, flagword flags)
 
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
+
 static bfd_boolean
 elfNN_ia64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 {
@@ -4740,10 +4745,8 @@ elfNN_ia64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   flagword in_flags;
   bfd_boolean ok = TRUE;
 
-  /* Don't even pretend to support mixed-format linking.  */
-  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
-      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
-    return FALSE;
+  if (!is_ia64_elf (ibfd) || !is_ia64_elf (obfd))
+    return TRUE;
 
   in_flags  = elf_elfheader (ibfd)->e_flags;
   out_flags = elf_elfheader (obfd)->e_flags;



More information about the Binutils-cvs mailing list