summaryrefslogtreecommitdiffstats
path: root/libelf/elf_compress_gnu.c
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/elf_compress_gnu.c')
-rw-r--r--libelf/elf_compress_gnu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libelf/elf_compress_gnu.c b/libelf/elf_compress_gnu.c
index c35dc395..dfa7c571 100644
--- a/libelf/elf_compress_gnu.c
+++ b/libelf/elf_compress_gnu.c
@@ -80,7 +80,9 @@ elf_compress_gnu (Elf_Scn *scn, int inflate, unsigned int flags)
sh_addralign = shdr->sh_addralign;
}
- if ((sh_flags & SHF_ALLOC) != 0)
+ /* Allocated sections, or sections that are already are compressed
+ cannot (also) be GNU compressed. */
+ if ((sh_flags & SHF_ALLOC) != 0 || (sh_flags & SHF_COMPRESSED))
{
__libelf_seterrno (ELF_E_INVALID_SECTION_FLAGS);
return -1;