This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]