aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-05-21 19:25:19 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-05-21 19:25:33 -0700
commitbae363f1146378207e1dffe5f23845644a1d0b7a (patch)
tree4a32506a3801bae0dd35fceb32fe51300d95b753 /bfd/elf.c
parent75d74ccace05f6166a45dbaa352abf753891d3be (diff)
downloadgdb-bae363f1146378207e1dffe5f23845644a1d0b7a.zip
gdb-bae363f1146378207e1dffe5f23845644a1d0b7a.tar.gz
gdb-bae363f1146378207e1dffe5f23845644a1d0b7a.tar.bz2
Mark section in a section group with SHF_GROUP
All sections in a section group should be marked with SHF_GROUP. But some tools generate broken objects without SHF_GROUP. This patch fixes them up for objcopy and strip. PR binutils/23199 * elf.c (setup_group): Mark section in a section group with SHF_GROUP.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 47d046f..6c66bbc 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -711,7 +711,15 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
break;
}
if (idx < shnum)
- dest->shdr = elf_elfsections (abfd)[idx];
+ {
+ dest->shdr = elf_elfsections (abfd)[idx];
+ /* PR binutils/23199: All sections in a
+ section group should be marked with
+ SHF_GROUP. But some tools generate
+ broken objects without SHF_GROUP. Fix
+ them up here. */
+ dest->shdr->sh_flags |= SHF_GROUP;
+ }
if (idx >= shnum
|| dest->shdr->sh_type == SHT_GROUP)
{