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: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 13 Dec 2013 07:38:47 -0800
- 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> <878uvorcza dot fsf at igel dot home>
On Fri, Dec 13, 2013 at 7:23 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> "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.
OK.
>> @@ -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.
OK.
>> 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?
I don't know it enough to tell.
>> 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.
>
OK.
--
H.J.