[binutils-gdb] Mark section in a section group with SHF_GROUP

H.J.Lu hjl@sourceware.org
Tue May 22 02:28:00 GMT 2018


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bae363f1146378207e1dffe5f23845644a1d0b7a

commit bae363f1146378207e1dffe5f23845644a1d0b7a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon May 21 19:25:19 2018 -0700

    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.

Diff:
---
 bfd/ChangeLog |  6 ++++++
 bfd/elf.c     | 10 +++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bab543b..7233851 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR binutils/23199
+	* elf.c (setup_group): Mark section in a section group with
+	SHF_GROUP.
+
 2018-05-18  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/23194
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)
 			{



More information about the Binutils-cvs mailing list