bfd_compress_section_contents access to elf_section_data
authorAlan Modra <amodra@gmail.com>
Wed, 7 Dec 2022 03:15:46 +0000 (13:45 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 7 Dec 2022 03:22:28 +0000 (13:52 +1030)
* compress.c (bfd_compress_section_contents): Don't access
elf_section_data for non-ELF.

bfd/compress.c

index 294349235439f77d39db2c2a0caf92b5be6468d2..6a30af5f8e6089934372a355eded47f6de257b0a 100644 (file)
@@ -682,7 +682,8 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec)
   if (compressed_size >= uncompressed_size)
     {
       memcpy (buffer, input_buffer, uncompressed_size);
-      elf_section_flags (sec) &= ~SHF_COMPRESSED;
+      if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+       elf_section_flags (sec) &= ~SHF_COMPRESSED;
       sec->compress_status = COMPRESS_SECTION_NONE;
     }
   else