[lldb-dev] [LLD] How to get rid of debug info of sections deleted by garbage collector

Davide Italiano via lldb-dev lldb-dev at lists.llvm.org
Thu Sep 20 07:54:47 PDT 2018

On Wed, Sep 19, 2018 at 8:35 PM Venkata Ramanaiah Nalamothu via
lldb-dev <lldb-dev at lists.llvm.org> wrote:
> Hi,
> After compiling an example.cpp file with "-c -ffunction-sections" and linking with "--gc-sections" (used ld.lld), I am still seeing debug info for the sections deleted by garbage collector in the generated executable.
> Are there any compiler/linker options and/or other tools in LLVM to get rid of the above mentioned unneeded debug info?
> If such options does not exist, what needs to be changed in the linker (lld)?

It's not easy. It's also format dependent. I assume you're talking
about ELF here. In first approximation, the linker does not GC section
marked without SHF_ALLOC. At some point we did an analysis and in
practice it turns out most of them are debug info.
I seem to recall that Cary Coutant had a proposal for ld.gold on how
to reclaim them without breaking, but I can't find it easily (cc:ing
him directly).



More information about the lldb-dev mailing list