[LLVMdev] RFC: Using zlib to decompress debug info sections.
Nick Lewycky
nicholas at mxc.ca
Tue Apr 16 02:47:18 PDT 2013
On 04/16/2013 02:37 AM, Alexey Samsonov wrote:
> Hi!
>
> TL;DR WDYT of adding zlib decompression capabilities to LLVMObject library?
Yes, I want this.
> ld.gold from GNU binutils has --compress-debug-sections=zlib option,
> which uses zlib to compress .debug_xxx sections and renames them to
> .zdebug_xxx.
> binutils (and GDB) support this properly, while LLVM command line tools
> don't:
>
> $ ld --version
> GNU gold (GNU Binutils for Ubuntu 2.22) 1.11
> $ ./bin/clang++ -g a.cc -Wl,--compress-debug-sections=zlib
> $ objdump -h a.out | grep debug
> 26 .debug_info 00000066 0000000000000000 0000000000000000
> 00002010 2**0
> 27 .debug_abbrev 00000048 0000000000000000 0000000000000000
> 00002068 2**0
> 28 .debug_aranges 00000000 0000000000000000 0000000000000000
> 000020bb 2**0
> 29 .debug_macinfo 00000000 0000000000000000 0000000000000000
> 000020cf 2**0
> 30 .debug_line 00000053 0000000000000000 0000000000000000
> 000020e3 2**0
> 31 .debug_loc 00000000 0000000000000000 0000000000000000
> 0000213e 2**0
> 32 .debug_pubtypes 00000000 0000000000000000 0000000000000000
> 00002152 2**0
> 33 .debug_str 00000069 0000000000000000 0000000000000000
> 00002166 2**0
> 34 .debug_ranges 00000000 0000000000000000 0000000000000000
> 000021d9 2**0
> $ ./bin/llvm-objdump -h a.out | grep debug
> 27 .zdebug_info 00000058 0000000000000000
> 28 .zdebug_abbrev 00000053 0000000000000000
> 29 .zdebug_aranges 00000014 0000000000000000
> 30 .zdebug_macinfo 00000014 0000000000000000
> 31 .zdebug_line 0000005b 0000000000000000
> 32 .zdebug_loc 00000014 0000000000000000
> 33 .zdebug_pubtypes 00000014 0000000000000000
> 34 .zdebug_str 00000073 0000000000000000
> 35 .zdebug_ranges 00000014 0000000000000000
>
> Decompression and proper handling of debug info sections may be needed
> in llvm-dwarfdump and llvm-symbolizer tools. We can implement this by:
> 1) Checking if zlib is present in the system during configuration.
> 2) Adding zlib decompression to llvm::MemoryBuffer, and section
> decompression to LLVMObject (this would require optional linking with -lz).
> 3) Using the methods in LLVM tools where needed.
>
> Does this make sense to you?
Yes, exactly. I'm not certain that MemoryBuffer and LLVMObject are the
right places, but it doesn't sound wrong.
Nick
More information about the llvm-dev
mailing list