How does clang implement compression during debugging?

How does clang implement compression of data section during debugging?


Will be worth reading the blog post by MaskRay on debug compression Compressed debug sections | MaskRay

Compression looks like in can happen in several places:

  • compiler output i.e. -gz=zlib
  • llvm-objcpy
  • LLD

Implementation is usually fairly straightforward. When it comes to writing out a section the data is passed to a compression library like zlib. For ELF the section containing the compressed data is given the SHF_COMPRESSED flag, along with a header that tells a consumer how to decompress the data, see Sections (search for SHF_COMPRESSED).

Hope that is something close to what you were intending with your question.