<div dir="ltr">Just in case - do we want to link with libz.so installed in the system, or be self-contained and copy sources to LLVM repo?<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 16, 2013 at 10:48 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Apr 16, 2013 at 9:37 AM, Alexey Samsonov <<a href="mailto:samsonov@google.com">samsonov@google.com</a>> wrote:<br>

><br>
> On Tue, Apr 16, 2013 at 8:31 PM, Michael Spencer <<a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On Tue, Apr 16, 2013 at 2:37 AM, Alexey Samsonov <<a href="mailto:samsonov@google.com">samsonov@google.com</a>><br>
>> wrote:<br>
>>><br>
>>> Hi!<br>
>>><br>
>>> TL;DR WDYT of adding zlib decompression capabilities to LLVMObject<br>
>>> library?<br>
>>><br>
>>><br>
>>> ld.gold from GNU binutils has --compress-debug-sections=zlib option,<br>
>>> which uses zlib to compress .debug_xxx sections and renames them to<br>
>>> .zdebug_xxx.<br>
>>> binutils (and GDB) support this properly, while LLVM command line tools<br>
>>> don't:<br>
>>><br>
>>> $ ld --version<br>
>>> GNU gold (GNU Binutils for Ubuntu 2.22) 1.11<br>
>>> $ ./bin/clang++ -g a.cc -Wl,--compress-debug-sections=zlib<br>
>>> $ objdump -h a.out | grep debug<br>
>>>  26 .debug_info   00000066  0000000000000000  0000000000000000  00002010<br>
>>> 2**0<br>
>>>  27 .debug_abbrev 00000048  0000000000000000  0000000000000000  00002068<br>
>>> 2**0<br>
>>>  28 .debug_aranges 00000000  0000000000000000  0000000000000000  000020bb<br>
>>> 2**0<br>
>>>  29 .debug_macinfo 00000000  0000000000000000  0000000000000000  000020cf<br>
>>> 2**0<br>
>>>  30 .debug_line   00000053  0000000000000000  0000000000000000  000020e3<br>
>>> 2**0<br>
>>>  31 .debug_loc    00000000  0000000000000000  0000000000000000  0000213e<br>
>>> 2**0<br>
>>>  32 .debug_pubtypes 00000000  0000000000000000  0000000000000000<br>
>>> 00002152  2**0<br>
>>>  33 .debug_str    00000069  0000000000000000  0000000000000000  00002166<br>
>>> 2**0<br>
>>>  34 .debug_ranges 00000000  0000000000000000  0000000000000000  000021d9<br>
>>> 2**0<br>
>>> $ ./bin/llvm-objdump -h a.out | grep debug<br>
>>>  27 .zdebug_info  00000058 0000000000000000<br>
>>>  28 .zdebug_abbrev 00000053 0000000000000000<br>
>>>  29 .zdebug_aranges 00000014 0000000000000000<br>
>>>  30 .zdebug_macinfo 00000014 0000000000000000<br>
>>>  31 .zdebug_line  0000005b 0000000000000000<br>
>>>  32 .zdebug_loc   00000014 0000000000000000<br>
>>>  33 .zdebug_pubtypes 00000014 0000000000000000<br>
>>>  34 .zdebug_str   00000073 0000000000000000<br>
>>>  35 .zdebug_ranges 00000014 0000000000000000<br>
>>><br>
>>> Decompression and proper handling of debug info sections may be needed<br>
>>> in llvm-dwarfdump and llvm-symbolizer tools. We can implement this by:<br>
>>> 1) Checking if zlib is present in the system during configuration.<br>
>>> 2) Adding zlib decompression to llvm::MemoryBuffer, and section<br>
>>> decompression to LLVMObject (this would require optional linking with -lz).<br>
>>> 3) Using the methods in LLVM tools where needed.<br>
>>><br>
>>> Does this make sense to you?<br>
>>><br>
>>> --<br>
>>> Alexey Samsonov, MSK<br>
>><br>
>><br>
>> I'm not sure MemoryBuffer is the right place to do this either. I'm also<br>
>> not sure if we want debug info decompression to be transparent in LLVMObject<br>
>> or not. I'm leaning towards no since it's not part of the standard yet,<br>
><br>
><br>
> Yeah, I also think that decompression should be explicitly requested by the<br>
> user of LLVMObject.<br>
><br>
>><br>
>> unless gold is actually using the SHF_COMPRESSED flag.<br>
>><br>
>><br>
>> I think it should be part of Object, but as an external API that is used<br>
>> when you find a section you know from external factors (the name matches<br>
>> some list) is compressed.<br>
>><br>
<br>
</div></div>Definitely want the feature :)<br>
<br>
I don't see SHF_COMPRESSED (unless readelf just isn't showing it to<br>
me), but it wouldn't be too hard to get binutils to mark them as such.<br>
Right now the convention is .z<foo> are compressed, but that's not as<br>
precise as we'd like it to be. There's been some talk on the binutils<br>
list about it, but it hasn't been implemented yet.<br>
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div></div>