mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 12:24:38 +08:00
6e5e9d58c1
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.
20 lines
499 B
Makefile
20 lines
499 B
Makefile
#name: copy removing non-reloc group member
|
|
#source: group-7.s
|
|
#PROG: objcopy
|
|
#DUMPPROG: readelf
|
|
#objcopy: --remove-section .data2.foo
|
|
#readelf: -Sg --wide
|
|
|
|
#...
|
|
\[[ 0-9]+\] \.group[ \t]+GROUP[ \t]+.*
|
|
#...
|
|
\[[ 0-9]+\] \.data\.foo[ \t]+PROGBITS[ \t0-9a-f]+WAG.*
|
|
#...
|
|
\[[ 0-9]+\] \.rela?\.data\.foo[ \t]+RELA?[ \t0-9a-f]+IG.*
|
|
#...
|
|
COMDAT group section \[[ 0-9]+\] `\.group' \[foo\] contains 2 sections:
|
|
\[Index\] Name
|
|
\[[ 0-9]+\] \.data\.foo
|
|
\[[ 0-9]+\] \.rela?\.data\.foo
|
|
#pass
|