This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Default elf_backend_post_process_headers to set OSABI
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>, Binutils <binutils at sourceware dot org>
- Date: Tue, 17 Dec 2013 14:12:35 -0800
- Subject: Re: PATCH: Default elf_backend_post_process_headers to set OSABI
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOoq0e3E96d6UF0x-dATyou+1H1Zru_07_r-aT8=PZ89OQ at mail dot gmail dot com> <87d2l0rdd6 dot fsf at igel dot home> <CAMe9rOp-3h1ZUbRw++d4dYRGhm38HG9tTTELzhGbfYot9GLBKA at mail dot gmail dot com> <CAMe9rOov4+7_R_2KzvHSiJfaie0HDt9sf=iMd_KNQxK9VdoHEA at mail dot gmail dot com>
On Tue, Dec 17, 2013 at 1:42 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Dec 13, 2013 at 7:39 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Fri, Dec 13, 2013 at 7:15 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>>
>>>> On Thu, Dec 12, 2013 at 7:29 PM, Hans-Peter Nilsson
>>>> <hans-peter.nilsson@axis.com> wrote:
>>>>>> From: "H.J. Lu" <hongjiu.lu@intel.com>
>>>>>> Date: Fri, 13 Dec 2013 00:06:33 +0100
>>>>>
>>>>>> On Thu, Dec 12, 2013 at 02:44:36PM -0800, H.J. Lu wrote:
>>>>>> Here is a patch to call _bfd_elf_copy_private_bfd_data. But
>>>>>> there are 5 failures:
>>>>>>
>>>>>> build-alpha-linux/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
>>>>>> build-crisv32-linux/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
>>>>>> build-frv-linux/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
>>>>>> build-ia64-linux/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
>>>>>> build-m68k-linux/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
>>>>>
>>>>> My autotester sees failures for mipsisa32r2el-unknown-linux-gnu,
>>>>> cris-axis-linux-gnu, cris-axis-elf. While the last two would
>>>>> see the same as your "build-crisv32-linux" the first one seems
>>>>> missing from your list.
>>>>>
>>>>>> since those targets don't use _bfd_elf_set_osabi. Shouldn't
>>>>>> elf_backend_post_process_headers be set to _bfd_elf_set_osabi by
>>>>>> default?
>>>>>
>>>>> I'd guess yes?
>>>>>
>>>>> brgds, H-P
>>>>
>>>> Here is a patch to do that. OK to install?
>>>
>>> That's not enough, you also need to set has_gnu_symbols appropriately.
>>>
>>
>> Sure. One piece at a time. I can work on them after
>> this patch is checked in.
>>
>
> I checked it in. Now I got
>
> build-arm-linuxeabi/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
> build-arm-netbsdelf/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
Those 2 are caused by elf32_arm_post_process_headers
which sets i_ehdrp->e_ident[EI_OSABI]. ARM maintainers
should take a look to decide what to do.
> build-mips64-linux/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
> build-mipsel-linux-gnu/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
> build-mipsisa32el-linux/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
> build-mips-linux/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
> build-spu-elf/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
> build-tx39-elf/binutils/binutils.log:FAIL: strip on STB_GNU_UNIQUE
>
I checked in this patch to fix the above failures.
--
H.J.
---
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7315720..4b46b09 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2013-12-17 H.J. Lu <hongjiu.lu@intel.com>
+ * elf32-spu.c (spu_elf_post_process_headers): Call
+ _bfd_elf_post_process_headers.
+ * elfxx-mips.c (_bfd_mips_post_process_headers): Likewise.
+
+2013-12-17 H.J. Lu <hongjiu.lu@intel.com>
+
* elf-bfd.h (_bfd_elf_set_osabi): Renamed to ...
(_bfd_elf_post_process_headers): This.
* elf.c (_bfd_elf_compute_section_file_positions): Always
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 86fb33c..3b7f266 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -5146,8 +5146,7 @@ spu_elf_plugin (int val)
/* Set ELF header e_type for plugins. */
static void
-spu_elf_post_process_headers (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
+spu_elf_post_process_headers (bfd *abfd, struct bfd_link_info *info)
{
if (spu_plugin)
{
@@ -5155,6 +5154,8 @@ spu_elf_post_process_headers (bfd *abfd,
i_ehdrp->e_type = ET_DYN;
}
+
+ _bfd_elf_post_process_headers (abfd, info);
}
/* We may add an extra PT_LOAD segment for .toe. We also need extra
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 1c64ad3..d5f51a3 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -15348,4 +15348,6 @@ _bfd_mips_post_process_headers (bfd *abfd,
struct bfd_link_info *link_info)
if (htab->use_plts_and_copy_relocs && !htab->is_vxworks)
i_ehdrp->e_ident[EI_ABIVERSION] = 1;
}
+
+ _bfd_elf_post_process_headers (abfd, link_info);
}