diff options
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 551378d..99cc7be 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2646,8 +2646,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) imach = bfd_get_mach (ibfd); if (input_arch) { - if (bfd_get_arch_info (ibfd) == NULL - || bfd_get_arch_info (ibfd)->arch == bfd_arch_unknown) + if (iarch == bfd_arch_unknown) { iarch = input_arch->arch; imach = input_arch->mach; @@ -2656,6 +2655,14 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) non_fatal (_("Input file `%s' ignores binary architecture parameter."), bfd_get_archive_filename (ibfd)); } + if (iarch == bfd_arch_unknown + && bfd_get_flavour (ibfd) != bfd_target_elf_flavour + && bfd_get_flavour (obfd) == bfd_target_elf_flavour) + { + const struct elf_backend_data *bed = get_elf_backend_data (obfd); + iarch = bed->arch; + imach = 0; + } if (!bfd_set_arch_mach (obfd, iarch, imach) && (ibfd->target_defaulted || bfd_get_arch (ibfd) != bfd_get_arch (obfd))) |