]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR22836, "-r -s" doesn't work with -g3 using GCC 7
authorAlan Modra <amodra@gmail.com>
Tue, 13 Feb 2018 03:39:48 +0000 (14:09 +1030)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 19 Mar 2018 15:05:16 +0000 (08:05 -0700)
commitd957f81cb38d7e82ae546cd03265ee3087ba8a85
treea2e5d2e0a042eb35bca4782674efa9707b9e626a
parent00a6bd6bc0350f64e2eba68d8f5a598a2724723a
PR22836, "-r -s" doesn't work with -g3 using GCC 7

This fixes the case where all of a group is removed with ld -r, the
situation in the PR, and failures where part of a group is removed
that contain relocs.

bfd/
PR 22836
* elf.c (_bfd_elf_fixup_group_sections): Account for removed
relocation sections.  If size reduces to just the flag word,
remove that too and mark with SEC_EXCLUDE.
* elflink.c (bfd_elf_final_link): Strip empty group sections.
binutils/
* testsuite/binutils-all/group-7.s,
* testsuite/binutils-all/group-7a.d,
* testsuite/binutils-all/group-7b.d,
* testsuite/binutils-all/group-7c.d: New tests.
* testsuite/binutils-all/objcopy.exp: Run them.
ld/
* testsuite/ld-elf/pr22836-2.d,
* testsuite/ld-elf/pr22836-2.s: New test.

(cherry picked from commit 6e5e9d58c1eeef5677c90886578a895cb8c164c5)
12 files changed:
bfd/ChangeLog
bfd/elf.c
bfd/elflink.c
binutils/ChangeLog
binutils/testsuite/binutils-all/group-7.s [new file with mode: 0644]
binutils/testsuite/binutils-all/group-7a.d [new file with mode: 0644]
binutils/testsuite/binutils-all/group-7b.d [new file with mode: 0644]
binutils/testsuite/binutils-all/group-7c.d [new file with mode: 0644]
binutils/testsuite/binutils-all/objcopy.exp
ld/ChangeLog
ld/testsuite/ld-elf/pr22836-2.d [new file with mode: 0644]
ld/testsuite/ld-elf/pr22836-2.s [new file with mode: 0644]