Add SHF_GNU_COMPRESSED

H.J. Lu hjl.tools@gmail.com
Sun Jul 18 21:03:00 GMT 2010


On Sat, Jul 17, 2010 at 8:23 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Jul 16, 2010 at 4:15 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> Hi Cary,
>>
>> I updated the branch. Reading compress debug sections should work now.
>>
>> On Fri, Jul 16, 2010 at 3:19 PM, Cary Coutant <ccoutant@google.com> wrote:
>>>>> I was thinking the right way to do this would probably be to keep the
>>>>> section name unchanged, but change the section type from SHT_PROGBITS
>>>>> to SHT_GNU_COMPRESSED_BITS.
>>>>
>>>> Doing this may trigger more changes. In theory,  no one should
>>>> depend on section name. You can get the original section name
>>>> by checking the new decompressed bit.
>>>
>>> Sorry, I didn't finish the thought, and I don't think it was clear
>>> what I meant. I meant that, if I were doing this from scratch, instead
>>> of naming the compressed sections ".zdebug_info", etc., I'd have kept
>>> the names unchanged, but changed the section type from SHT_PROGBITS to
>>> SHT_GNU_COMPRESSED_BITS in the ELF section table, and readers would
>>> have known that decompression was necessary based on the section type
>>> instead of the section name (agreeing with your assertion that no one
>>> should depend on the section name). I'd have changed gas to output the
>>> new section type when compressing, and changed bfd and gold to
>>> decompress any SHT_GNU_COMPRESSED_BITS section.
>>
>> That sounds better if we don't have to worry about the older tools.
>>
>>> I think that would have been more elegant, but it would have probably
>>> been a more difficult transition, as older tools would not have
>>> gracefully ignored the compressed sections.
>>>
>>
>> That is true.
>>
>
> I am having a second though. I am leaning toward SHF_GNU_COMPRESSED
> instead of SHT_GNU_COMPRESSED_BITS since compressed sections are
> still SHT_PROGBITS.  We don't have to worry about the older tools since
> they can't process compressed section anyway. The difference is with
> SHF_GNU_COMPRESSED, the older tools may find garbage in compressed
> debug sections, instead of ignore them.  But it will make binutils much much
> nicer.  We can compress/decompress debug sections without changing
> section names.
>

Hi Cary,

I will implement SHF_GNU_COMPRESSED on hjl/gnu-compressed branch.
I will add

     --compress-debug-sections     Compress DWARF debug sections using zlib
     --decompress-debug-sections   Decompress DWARF debug sections using zlib

to objcopy. We can use it to decompress debug sections to help old tools.


-- 
H.J.



More information about the Binutils mailing list