[PATCH] compress .gnu.debuglto_.debug_* sections if requested
Alan Modra
amodra@gmail.com
Fri Sep 30 00:20:46 GMT 2022
On Thu, Sep 29, 2022 at 03:35:15PM +0200, Martin Liška wrote:
> + /* 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] == '_')))
> + && (startswith (name, ".debug_")
> + || startswith (name, ".zdebug_")
> + || startswith (name, ".gnu.debuglto_.debug_")))
If you test "(newsect->flags & SEC_ELF_OCTETS) != 0" as well, I think
you could omit any name tests here. This would also compress
.gnu.linkonce.wi.* sections. (Not that they matter very much, I'm
just pointing out a code simplification.)
> --- a/gas/write.c
> +++ b/gas/write.c
> @@ -1481,7 +1481,8 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
> return;
>
> section_name = bfd_section_name (sec);
> - if (!startswith (section_name, ".debug_"))
> + if (!startswith (section_name, ".debug_")
> + && !startswith (section_name, ".gnu.debuglto_.debug_"))
> return;
>
> bool use_zstd = abfd->flags & BFD_COMPRESS_ZSTD;
Hmm, it looks to me like this function will transform
".gnu.debuglto_.debug_*" to ".zgnu.debuglto_.debug_*" if
--compress-debug-sections=zlib-gnu is used, which will break your
elf.c change. Please check --compress-debug-sections=zlib-gnu.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list