From 16fce1bddb03d493fdc17b2d33461f77f3b58499 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 7 Dec 2022 13:45:46 +1030 Subject: [PATCH] bfd_compress_section_contents access to elf_section_data * compress.c (bfd_compress_section_contents): Don't access elf_section_data for non-ELF. --- bfd/compress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.30.2