This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: deleting relocs, objcopy and BFD
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: "Jose E. Marchesi" <jose dot marchesi at oracle dot com>
- Cc: <binutils at sourceware dot org>
- Date: Tue, 2 May 2017 11:15:36 +0100
- Subject: Re: deleting relocs, objcopy and BFD
- Authentication-results: sourceware.org; auth=none
- References: <878tmluaag.fsf@oracle.com>
On Thu, 27 Apr 2017, Jose E. Marchesi wrote:
> The recent commit
>
> commit 1d15e434f43bc41a07bc7b0648fcb7e6ccbe8dcc
> Author: Nick Clifton <nickc@redhat.com>
> Date: Thu Apr 13 14:50:56 2017 +0100
>
> Add note merging to strip and add code to merge stack size notes.
>
> * objcopy.c: Add --no-merge-notes option to disable note merging.
> Add --[no-]merge-notes option to strip, and enable it by default.
> (num_bytes): New function.
> (merge_gnu_build_notes): Add code to merge stack size notes.
> * binutils.texi: Update strip and objcopy documentation.
> * readelf.c (print_gnu_build_attribute_name): Use defined
> constants for note types.
>
> Introduced a regression in two ELF targets: elf64-sparc and elf64-mips:
>
> FAIL: merge notes section (64-bits)
[...]
> For example:
>
> 1. Build binutils with --target=mips64-unknown-openbsd
>
> 2. ./gas/as-new binutils/testsuite/binutils-all/note-2-64.s -o foo.o
>
> 3. ./binutils/objcopy --merge-notes foo.o bar.o will segfault.
>
> 4. Run the above command under GDB and check that:
>
> - At the beginning of `merge_gnu_build_notes' the
> .gnu_build_attributes section has 3 external relocations. This
> makes `bfd_canonicalize_reloc' to return a count of 3 * 3 = 9
> internal relocs.
>
> - The deletion logic in `merge_gnu_build_notes' then deletes two
> internal relocs, leaving 7. This sounds like a sequence of three
> internal relocs gets broken. I am not sure if this really a problem
> (don't know much of mips64) but it is worth a check.
Thanks for raising this issue. I actually noticed the regression, but
incorrectly attributed it to the usual test framework breakage (that I
mean to address in a systematic way sometime) for MIPS targets that
default to n64. I'll see what I can do about it unless Alan or Nick beat
me to it.
Maciej