public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* bfd_compress_section_contents access to elf_section_data
@ 2022-12-07  3:48 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-12-07  3:48 UTC (permalink / raw)
  To: binutils

When COFF/PE don't do that.

	* compress.c (bfd_compress_section_contents): Don't access
	elf_section_data for non-ELF.

diff --git a/bfd/compress.c b/bfd/compress.c
index 29434923543..6a30af5f8e6 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -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

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-07  3:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07  3:48 bfd_compress_section_contents access to elf_section_data Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).