This is the mail archive of the 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]

Re: [PATCH] ia64: don't fail when converting binary into ELF

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;

#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

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