This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR gas/12409: --compress-debug-sections doesn't work on empty DWARF sections
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 18 Jan 2011 15:54:32 -0800
- Subject: Re: PATCH: PR gas/12409: --compress-debug-sections doesn't work on empty DWARF sections
- References: <20110118185733.GA16609@intel.com>
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;