This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add SHF_GNU_COMPRESSED


On Sun, Jul 18, 2010 at 2:02 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> 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.
>

Hi Cary,

objcopy.  --compress-debug-sections/--decompress-debug-sections

works on hjl/gnu-compressed branch:

[hjl@gnu-6 pr11819]$ ls -l ld-new
-rwxr-xr-x 1 hjl hjl 4524567 Jul 19 15:50 ld-new
[hjl@gnu-6 pr11819]$ ./objcopy --compress-debug-sections ld-new ld.gz
[hjl@gnu-6 pr11819]$ ls -l ld.gz
-rwxrwxr-x 1 hjl hjl 2862047 Jul 19 15:50 ld.gz
[hjl@gnu-6 pr11819]$ ./objcopy --decompress-debug-sections  ld.gz ld-old
[hjl@gnu-6 pr11819]$ cmp ld-new ld-old
[hjl@gnu-6 pr11819]$

Any comments?

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]