aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-09-29 14:10:30 +0200
committerAlan Modra <amodra@gmail.com>2022-10-04 18:36:40 +1030
commit7afbac7ddd7299491a88341149bc72b38173447a (patch)
tree3ed76f9bc2d432a288e26691f32646ad06913d3a /bfd/elf.c
parentbb996692bd9654d6f2345ab65742796d5fde6829 (diff)
downloadgdb-7afbac7ddd7299491a88341149bc72b38173447a.zip
gdb-7afbac7ddd7299491a88341149bc72b38173447a.tar.gz
gdb-7afbac7ddd7299491a88341149bc72b38173447a.tar.bz2
compress .gnu.debuglto_.debug_* sections if requested
Right now, when using LTO, the intermediate object files do contain debug info in sections starting with .gnu.debuglto_ prefix and are not compressed when --compress-debug-sections is used. It's a mistake and we can save quite some disk space. The following example comes from tramp3d when the corresponding LTO sections are compressed with zlib: $ bloaty tramp3d-v4-v2.o -- tramp3d-v4.o FILE SIZE VM SIZE -------------- -------------- +83% +10 [ = ] 0 [Unmapped] -68.0% -441 [ = ] 0 .gnu.debuglto_.debug_line -52.3% -759 [ = ] 0 .gnu.debuglto_.debug_line_str -62.4% -3.24Ki [ = ] 0 .gnu.debuglto_.debug_abbrev -64.8% -1.12Mi [ = ] 0 .gnu.debuglto_.debug_info -88.8% -4.58Mi [ = ] 0 .gnu.debuglto_.debug_str -27.7% -5.70Mi [ = ] 0 TOTAL bfd/ChangeLog: * elf.c (_bfd_elf_make_section_from_shdr): Compress all debug info sections. gas/ChangeLog: * write.c (compress_debug): Compress also ".gnu.debuglto_.debug_" if the compression algorithm is different from zlib-gnu.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index d496c1b..8cd257f 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1199,12 +1199,11 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
}
}
- /* Compress/decompress DWARF debug sections with names: .debug_* and
- .zdebug_*, after the section flags is set. */
+ /* Compress/decompress DWARF debug sections with names: .debug_*,
+ .zdebug_*, .gnu.debuglto_.debug_, after the section flags is set. */
if ((newsect->flags & SEC_DEBUGGING) != 0
&& (newsect->flags & SEC_HAS_CONTENTS) != 0
- && ((name[1] == 'd' && name[6] == '_')
- || (name[1] == 'z' && name[7] == '_')))
+ && (newsect->flags & SEC_ELF_OCTETS) != 0)
{
enum { nothing, compress, decompress } action = nothing;
int compression_header_size;