google / bloaty

Bloaty: a size profiler for binaries
Apache License 2.0
4.71k stars 340 forks source link

-d compileunits: zstd compressed debug sections #318

Open MaskRay opened 1 year ago

MaskRay commented 1 year ago

When llvm-project is built with LLVM_ENABLE_ZSTD [1], clang -fuse-ld=lld -gz=zstd a.o produces zstd compressed debug sections (ch_type=ELFCOMPRESS_ZSTD). -d compileunits seems to parse DWARF and currently doesn't support decompressing zstd.


[1]:

# Build zstd with cmake
git clone https://github.com/facebook/zstd
cd zstd
cmake -GNinja -Hbuild/cmake -Bout/release -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/opt/zstd
make -j 8 install

# Build clang and lld. See https://llvm.org/docs/GettingStarted.html
cmake -GNinja -Sllvm -Bout/release -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='clang;lld' -DLLVM_ENABLE_ZSTD=FORCE_ON -DCMAKE_PREFIX_PATH=/tmp/opt/zstd -DCLANG_ENABLE_ARCMT=off -DCLANG_ENABLE_STATIC_ANALYZER=off -DLLVM_TARGETS_TO_BUILD=host
ninja -C out/release llvm-objcopy clang lld