aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-09-23 09:04:52 +0930
committerAlan Modra <amodra@gmail.com>2022-09-23 11:55:47 +0930
commit4bea06d73c04cd4c78765fa8a9a5fe8346c5ed90 (patch)
tree0d293682904893e373c303bb3193292235428779 /bfd/elf.c
parent35cff32e9e048c9b97c57388f07a219ac26ca310 (diff)
downloadgdb-4bea06d73c04cd4c78765fa8a9a5fe8346c5ed90.zip
gdb-4bea06d73c04cd4c78765fa8a9a5fe8346c5ed90.tar.gz
gdb-4bea06d73c04cd4c78765fa8a9a5fe8346c5ed90.tar.bz2
Don't attempt to compress bss sections
It doesn't make sense to try to compress a section without contents since those sections take no space on disk. Compression can only increase the disk image size. * coffgen.c (make_a_section_from_file): Exclude !SEC_HAS_CONTENTS sections from compression and decompression. * elf.c (_bfd_elf_make_section_from_shdr): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c3
1 files changed, 2 insertions, 1 deletions
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] == '_')))
{