Also preserve the SHF_COMPRESSED bit
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 4 Apr 2015 15:01:54 +0000 (08:01 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 4 Apr 2015 15:01:54 +0000 (08:01 -0700)
For objcopy and relocatable link, we should also preserve the
SHF_COMPRESSED bit if not decompress.

* elf.c (_bfd_elf_init_private_section_data): Also preserve the
SHF_COMPRESSED bit if not decompress.

bfd/ChangeLog
bfd/elf.c

index 654408e2d8f41378d5d256ff65fac8fdea6af16e..4400a36b7bafad81465d7df7132fa9e2d16a1b3b 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-04  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf.c (_bfd_elf_init_private_section_data): Also preserve the
+       SHF_COMPRESSED bit if not decompress.
+
 2015-04-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        * compress.c (get_uncompressed_size): New.  Extracted from ...
index f3c90506591b23cd76ba3dff714d36679655a278..cbc0c918f8809bd0d75ef53b771c2c70dbd96511 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6680,6 +6680,11 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
          elf_next_in_group (osec) = elf_next_in_group (isec);
          elf_section_data (osec)->group = elf_section_data (isec)->group;
        }
+
+      /* If not decompress, preserve SHF_COMPRESSED.  */
+      if ((ibfd->flags & BFD_DECOMPRESS) == 0)
+       elf_section_flags (osec) |= (elf_section_flags (isec)
+                                    & SHF_COMPRESSED);
     }
 
   ihdr = &elf_section_data (isec)->this_hdr;