Only compress debug sections if this saves space

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Fri May 10 13:39:00 GMT 2013


The Solaris toolchain currently gains support for compressed debug
sections, both for the current GNU format and the new format already
approved for the ELF gABI.  While working on gcc support starting at

	http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00679.html

I noticed elfdump complaining about some of the object files with
compressed debug sections, e.g. the gas testcase:

% elfdump -c  dw2-compress-1.o
[...]
Section Header[6]:  sh_name: .zdebug_abbrev
    sh_addr:      0               sh_flags:   0
    sh_size:      0x46            sh_type:    [ SHT_PROGBITS ]
    sh_offset:    0x8b            sh_entsize: 0
    sh_link:      0               sh_info:    0
    sh_addralign: 0x1       
    ch_size:      0x33            ch_type:    ZLIB (GNU format)
dw2-compress-1.o.orig: .zdebug_abbrev: compressed section is larger than original: size 0x46: uncompressed size 0x33
[...]

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.

Given that the testcase is from the gdb testsuite, that should be
adapted as well, but will need to account for both compressed and
uncompressed debug sections.

Ok for mainline?

Thanks.
	Rainer


2013-05-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gas:
	* write.c (compress_debug): Only compress if it saves space.

	gas/testsuite:
	* gas/i386/dw2-compress-1.d: .debug_info and .debug_abbrev aren't
	compressed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gas-compress-save.patch
Type: text/x-patch
Size: 1299 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20130510/39c3d4b0/attachment.bin>
-------------- next part --------------

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


More information about the Binutils mailing list