aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/coffgen.c3
-rw-r--r--bfd/elf.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 90fba3b..8eb69af 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -146,7 +146,8 @@ make_a_section_from_file (bfd *abfd,
/* Compress/decompress DWARF debug sections with names: .debug_* and
.zdebug_*, after the section flags is set. */
- if ((flags & SEC_DEBUGGING)
+ if ((flags & SEC_DEBUGGING) != 0
+ && (flags & SEC_HAS_CONTENTS) != 0
&& strlen (name) > 7
&& ((name[1] == 'd' && name[6] == '_')
|| (strlen (name) > 8 && name[1] == 'z' && name[7] == '_')))
diff --git a/bfd/elf.c b/bfd/elf.c
index bc433cf..16cea4f 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1201,7 +1201,8 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
/* Compress/decompress DWARF debug sections with names: .debug_* and
.zdebug_*, after the section flags is set. */
- if ((newsect->flags & SEC_DEBUGGING)
+ if ((newsect->flags & SEC_DEBUGGING) != 0
+ && (newsect->flags & SEC_HAS_CONTENTS) != 0
&& ((name[1] == 'd' && name[6] == '_')
|| (name[1] == 'z' && name[7] == '_')))
{