[PATCH] ia64: don't fail when converting binary into ELF
Alan Modra
amodra@gmail.com
Fri Dec 27 04:42:00 GMT 2019
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
More information about the Binutils
mailing list