PR22451, strip no longer works on older object files

H.J. Lu hjl.tools@gmail.com
Tue Nov 21 21:46:00 GMT 2017


On Mon, Nov 20, 2017 at 6:27 AM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Nov 20, 2017 at 05:50:04AM -0800, H.J. Lu wrote:
>> On Mon, Nov 20, 2017 at 5:40 AM, Alan Modra <amodra@gmail.com> wrote:
>> > Setting SHF_GROUP unconditionally on rel/rela sections associated with
>> > SHF_GROUP sections fails badly with objcopy/strip and ld -r if the
>> > input file SHT_GROUP section didn't specify the rel/rela sections.
>> > This patch rearranges where SHF_GROUP is set for rel/rela sections.
>> >
>> >         PR 22451
>> >         PR 22460
>> >         * elf.c (_bfd_elf_init_reloc_shdr): Delete "sec_hdr" parameter
>> >         and leave rel_hdr->sh_flags zero.  Update calls.
>> >         (bfd_elf_set_group_contents): Check input rel/rela SHF_GROUP
>> >         flag when !gas before adding rel/rela section to group.  Set
>> >         output rel/rela SHF_GROUP flags.
>> >
>>
>> Can we add an assembler command-line option to get  back the old
>> behavior?  It can be used to generate a testcase for this patch.   It
>> may be useful in other places.
>
> I don't see the need for a testcase.  Yes, we like to be backward
> compatible with older buggy object files, but it isn't something that
> we need to keep forever (which is what a testcase would imply).
> That's not to say backward compatibility in this case will be lost.
> My patch didn't add some hack that I or some future maintainer will
> want to remove:  It just moved where SHF_GROUP was set for rel/rela
> sections.

We need to be able to handle the older object files.   I checked
in this testcase.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-test-for-PR-binutils-22451.patch
Type: text/x-patch
Size: 4449 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20171121/f84f944b/attachment.bin>


More information about the Binutils mailing list