[PATCH] Mark section in a section group with SHF_GROUP

H.J. Lu hjl.tools@gmail.com
Sun May 20 14:31:00 GMT 2018


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



More information about the Binutils mailing list