]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Mark section in a section group with SHF_GROUP
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 22 May 2018 02:25:19 +0000 (19:25 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 22 May 2018 10:44:04 +0000 (03:44 -0700)
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.

(cherry picked from commit bae363f1146378207e1dffe5f23845644a1d0b7a)

bfd/ChangeLog
bfd/elf.c

index c776c02eaf69c1b37ae9f9f59e6c66d39b98d781..e7193e72d08e8ff7ecf7d9612b6c9903e0596f56 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-22  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-21  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/23194
index f657ec456708df6095bd224b102cd73c9f7598d3..3f766404ab3d67f88a7af79abb193184ec696215 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -708,7 +708,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)
                        {