Only compress debug sections if this saves space

H.J. Lu hjl.tools@gmail.com
Fri May 10 21:11:00 GMT 2013


On Fri, May 10, 2013 at 1:26 PM, Cary Coutant <ccoutant@google.com> wrote:
>> The warning is correct and easy to fix, as shown by the following
>> patch.  In the testcase above, only one out of three debug sections
>> shrinks when compressing.  I've chosen to adapt the .d file to account
>> for this and didn't try to create a larger testcase where all debug
>> sections do compress.
>
> My original rationale for always compressing was that (a) the
> compressed section would be larger than the uncompressed only for
> trivially-small sections to begin with, so the net savings of
> bothering to check is minimal; and (b) it makes testing more
> difficult, as a random unrelated change might cause the section to
> fall under the threshold and suddenly it's not compressed (as you've
> already noticed).
>
> HJ made a change so that it would only compress the section if it was
> larger than the size of the compression header, but I believe he made
> a deliberate decision not to make it conditional on the final size for
> the above reasons.

My change is a quick check for trivial cases.

> I'm not really opposed to this change -- I just want to consider the
> cost (it makes testing more fragile) vs. the benefit (which seems
> fairly minimal). If you go ahead, I'd argue that you probably should
> try to make the testcase large enough so that all the debug sections
> compress.
>
> -cary

I am not against saving a few bytes.  But I agree with Cary
on testcase changes.

--
H.J.



More information about the Binutils mailing list