Bug originally reported at https://bugs.gentoo.org/699180 by Émeric Maschino. Small reproducer: $ echo hi > hello.123 $ ia64-unknown-linux-gnu-ld -r -b binary hello.123 -o hello.o ia64-unknown-linux-gnu-ld: failed to merge target specific data of file hello.123 $ ia64-unknown-linux-gnu-ld -r -b binary hello.123 -o hello.o --no-warn-mismatch It works without problems on other targets. AFAIU glibc's inlent is to: 1. convert arbitrary binary into an ELF file 2. assign a symbol to it 3. refer from other source files It's a step 1 that fails. The target is ia64-unknown-linux-gnu.
AFAIU eary failure happens at input checking against ELF: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=bfd/elfnn-ia64.c;h=459d986c0350f5e5982c7738ea69273f2ae97f7a;hb=HEAD#l4744 4735 static bfd_boolean 4736 elfNN_ia64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) 4737 { ... 4743 /* Don't even pretend to support mixed-format linking. */ 4744 if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour ... 4746 return FALSE; Looks like many other targets have that check but see to work. Does ia64 port miss some earlier step to convert binary into an ELF?
Created attachment 12147 [details] binutils-2.32-ia64-allow-binary-merge.patch It looks like other targets (like mips and riscv64) just skip _private hook entirely. I did the same and got something that looks like an ia64 ELF. Will test a bit.
Sent for review as https://sourceware.org/ml/binutils/2019-12/msg00340.html
Was pushed as https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=b26a3d5827edcb942b3af5b921bf317bbc0c8e83
Fixed