Re: Update15.x/kcfi to LLVM 15.0.3 (ZSTD + DWARFv5)

From: Sedat Dilek
Date: Thu Oct 20 2022 - 14:07:39 EST


On Thu, Oct 20, 2022 at 7:59 PM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> On Thu, Oct 20, 2022 at 10:47 AM Sedat Dilek <sedat.dilek@xxxxxxxxx> wrote:
> >
> > On Thu, Oct 20, 2022 at 7:18 PM Nick Desaulniers
> > <ndesaulniers@xxxxxxxxxx> wrote:
> > >
> > > On Thu, Oct 20, 2022 at 9:56 AM Nick Desaulniers
> > > <ndesaulniers@xxxxxxxxxx> wrote:
> > > >
> > > > On Wed, Oct 19, 2022 at 10:44 PM Sedat Dilek (DHL Supply Chain)
> > > > <sedat.dilek@xxxxxxx> wrote:
> > > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
> > > > > Gesendet: Dienstag, 18. Oktober 2022 18:00
> > > > > An: Sedat Dilek (DHL Supply Chain) <sedat.dilek@xxxxxxx>
> > > > > Betreff: Re: Update15.x/kcfi to LLVM 15.0.3
> > > > >
> > > > > On Tue, Oct 18, 2022 at 4:54 AM Sedat Dilek (DHL Supply Chain) <sedat.dilek@xxxxxxx> wrote:
> > > > > >
> > > > > [ CC Nick + Fangrui ]
> > > > >
> > > > > You happen to know or use the ZSTD cmake-option (see [1] and [2]) - came in with changes post-15.0.2?
> > > > >
> > > > > AFAICS Fangrui Song had some patches to use ZSTD debug-compression with DWARFv5.
> > > > >
> > > > > Unsure, if that combination is now possible in v15.0.3 or is a feature of LLVM-16.
> > > > >
> > > > > [3] says:
> > > > >
> > > > > [ lib/Kconfig.debug ]
> > > > >
> > > > > config DEBUG_INFO_COMPRESSED
> > > > > bool "Compressed debugging information"
> > > > > depends on $(cc-option,-gz=zlib)
> > > > > depends on $(ld-option,--compress-debug-sections=zlib)
> > > > > help
> > > > > Compress the debug information using zlib. Requires GCC 5.0+ or Clang
> > > > > 5.0+, binutils 2.26+, and zlib.
> > > > >
> > > > > Users of dpkg-deb via scripts/package/builddeb may find an increase in
> > > > > size of their debug .deb packages with this config set, due to the
> > > > > debug info being compressed with zlib, then the object files being
> > > > > recompressed with a different compression scheme. But this is still
> > > > > preferable to setting $KDEB_COMPRESS to "none" which would be even
> > > > > larger.
> > > > >
> > > > > I am interested in the equivalent changes to cc-option/ld-option with ZSTD (usable with DWARFv5).
> > > >
> > > > Good idea. It looks like there's still a blocker to using -gz=zstd with clang:
> > > > $ clang -gz=zstd -x c - < /dev/null
> > > > clang-16: warning: cannot compress debug sections (zstd not enabled)
> > > > [-Wdebug-compression-unavailable]
> > >
> > > PEBKAC
> > > $ sudo apt install libzstd-dev
> > > <rebuild clang>
> > >
> >
> > Hi Nick,
> >
> > Hehe, yes you need the ZSTD *-dev package on Debian.
> >
> > Interesting:
> >
> > "libzstd-dev: cmake file is unavailable"
> > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020403
> >
> > Looks like Clang-16+ is needed as well.
> >
> > The WIP kernel patch looks promising.
> >
> > Please, let me know after your rebuild of clang if it works OK not
> > only compile-tested but also debug-info is OK.
>
> https://lore.kernel.org/lkml/20221020175655.1660864-1-ndesaulniers@xxxxxxxxxx/
>

Thanks for the numbers and link to Fangrui Song's blog from September
(my chromium had that link saved).

-Sedat-

> >
> > -Sedat-
> >
> > > >
> > > > https://github.com/facebook/zstd/issues/3271
> > > >
> > > > Attaching a WIP patch.
> > > >
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Best regards,
> > > > > -Sedat-
> > > > >
> > > > > [1] https://github.com/llvm/llvm-project/commit/6fba7854a2f0b6b3899bb156c1a0c4ae35c96e24
> > > > > [2] https://github.com/llvm/llvm-project/commit/b4840279846e1eea44c3dca575395a90c9d77ca0
> > > > > [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/Kconfig.debug#n315
> > > > > [4] https://metadata.ftp-master.debian.org/changelogs//main/l/llvm-toolchain-15/llvm-toolchain-15_15.0.3-1~exp1_changelog
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Thanks,
> > > > ~Nick Desaulniers
> > >
> > >
> > >
> > > --
> > > Thanks,
> > > ~Nick Desaulniers
>
>
>
> --
> Thanks,
> ~Nick Desaulniers