This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] ia64: don't fail when converting binary into ELF
- From: Alan Modra <amodra at gmail dot com>
- To: Sergei Trofimovich <slyfox at gentoo dot org>
- Cc: binutils at sourceware dot org, Jim Wilson <wilson at tuliptree dot org>
- Date: Fri, 27 Dec 2019 15:11:53 +1030
- Subject: Re: [PATCH] ia64: don't fail when converting binary into ELF
- References: <20191226104030.534282-1-slyfox@gentoo.org>
On Thu, Dec 26, 2019 at 10:40:30AM +0000, Sergei Trofimovich wrote:
> diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
> index 459d986c03..338fd5ff93 100644
> --- a/bfd/elfnn-ia64.c
> +++ b/bfd/elfnn-ia64.c
> @@ -4740,10 +4740,9 @@ 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;
> + return TRUE;
>
> in_flags = elf_elfheader (ibfd)->e_flags;
> out_flags = elf_elfheader (obfd)->e_flags;
This is OK as far as it goes, but there is another bug here too. The
function should only be looking at e_flags for objects known to be
ia64. See for example elf64-ppc.c ppc64_elf_merge_private_bfd_data
where the test is
if (!is_ppc64_elf (ibfd) || !is_ppc64_elf (obfd))
return TRUE;
with
#define is_ppc64_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_object_id (bfd) == PPC64_ELF_DATA)
Something similar should be done for IA64.
--
Alan Modra
Australia Development Lab, IBM