This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Mark section in a section group with SHF_GROUP
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sun, 20 May 2018 07:30:42 -0700
- Subject: [PATCH] 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.
OK for master?
H.J.
----
PR binutils/23199
* elf.c (setup_group): Mark section in a section group with
SHF_GROUP.
---
bfd/elf.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/bfd/elf.c b/bfd/elf.c
index 47d046fa83..6c66bbca02 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)
{
--
2.17.0