PATCH: PR gas/12409: --compress-debug-sections doesn't work on empty DWARF sections

H.J. Lu hjl.tools@gmail.com
Tue Jan 18 23:54:00 GMT 2011


On Tue, Jan 18, 2011 at 10:57 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> We shouldn't compress empty DWARF sections.  I checked in this patch as
> an obvious fix.
>
>
> H.J.
> ---
> gas/
>
> 2011-01-18  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR gas/12409
>        * write.c (compress_debug): Return if section size is 0.
>


Should I apply this patch? Since the compression header is 12 byte,
if the section is smaller than 12 bytes, compressed section will be
bigger.

H.J.
---
diff --git a/gas/write.c b/gas/write.c
index aabb96d..9e4d6f4 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -1359,7 +1359,7 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIB
UTE_UNUSED)
   flagword flags = bfd_get_section_flags (abfd, sec);

   if (seginfo == NULL
-      || sec->size == 0
+      || sec->size < 12
       || (flags & (SEC_ALLOC | SEC_HAS_CONTENTS)) == SEC_ALLOC)
     return;



More information about the Binutils mailing list