This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR binutils/16318: Objcopy loses EI_OSABI
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 13 Dec 2013 16:23:53 +0100
- Subject: Re: PATCH: PR binutils/16318: Objcopy loses EI_OSABI
- Authentication-results: sourceware.org; auth=none
- References: <20131212224436 dot GA15572 at intel dot com> <20131212230633 dot GA15944 at intel dot com>
"H.J. Lu" <hongjiu.lu@intel.com> writes:
> -static bfd_boolean
> elf32_bfinfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
> {
> if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
> || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
> return TRUE;
>
> - if (! bfin_elf_copy_private_bfd_data (ibfd, obfd))
> + if (! _bfd_elf_copy_private_bfd_data (ibfd, obfd))
> return FALSE;
>
> if (! elf_tdata (ibfd) || ! elf_tdata (ibfd)->phdr
This is identical to _bfd_elf_copy_private_bfd_data.
> @@ -6361,6 +6340,8 @@ frv_elf_arch_extension_p (flagword base, flagword extension)
> return FALSE;
> }
>
> +/* Copy backend specific data from one object module to another. */
> +
> static bfd_boolean
> elf32_frvfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
Likewise.
> diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
> index e70887b..4f49820 100644
> --- a/bfd/elf64-sh64.c
> +++ b/bfd/elf64-sh64.c
> @@ -2268,6 +2268,9 @@ sh_elf64_copy_private_data_internal (bfd *ibfd, bfd *obfd)
> || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
> return TRUE;
>
> + if (! _bfd_elf_copy_private_bfd_data (ibfd, obfd))
> + return FALSE;
> +
> o_shdrp = elf_elfsections (obfd);
> for (osec = obfd->sections; osec; osec = osec->next)
> {
> @@ -2285,10 +2288,7 @@ sh_elf64_copy_private_data_internal (bfd *ibfd, bfd *obfd)
> }
> }
>
> - /* Copy object attributes. */
> - _bfd_elf_copy_obj_attributes (ibfd, obfd);
> -
> - return sh_elf64_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags);
> + return sh_elf64_set_mach_from_flags (obfd);
> }
What about the other caller of sh_elf64_copy_private_data_internal?
> diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
> index 6a42bc5..b4d92aa 100644
> --- a/bfd/elfnn-aarch64.c
> +++ b/bfd/elfnn-aarch64.c
> @@ -4543,24 +4543,10 @@ elfNN_aarch64_set_private_flags (bfd *abfd, flagword flags)
> static bfd_boolean
> elfNN_aarch64_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
> {
> - flagword in_flags;
> -
> if (!is_aarch64_elf (ibfd) || !is_aarch64_elf (obfd))
> return TRUE;
>
> - in_flags = elf_elfheader (ibfd)->e_flags;
> -
> - elf_elfheader (obfd)->e_flags = in_flags;
> - elf_flags_init (obfd) = TRUE;
> -
> - /* Also copy the EI_OSABI field. */
> - elf_elfheader (obfd)->e_ident[EI_OSABI] =
> - elf_elfheader (ibfd)->e_ident[EI_OSABI];
> -
> - /* Copy object attributes. */
> - _bfd_elf_copy_obj_attributes (ibfd, obfd);
> -
> - return TRUE;
> + return _bfd_elf_copy_private_bfd_data (ibfd, obfd);
> }
Same as _bfd_elf_copy_private_bfd_data.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."