[CMake] cmake -gsplit-dwarf dwp and install step

David Blaikie dblaikie at gmail.com
Sat Dec 29 02:19:08 EST 2018


Hi there - I'm not a CMake person, but a Clang/LLVM developer who helped in
the implementation of Split DWARF in Clang/LLVM, so I know a bit about DWOs
and DWPs, etc & thought I'd offer a few extra details...

On Fri, Dec 21, 2018 at 3:39 AM David Jobet <djobet at tower-research.com>
wrote:

> Hello,
>
> in order to speed up our link step, I wanted to experiment with split
> dwarf.
> See http://www.productive-cpp.com/improving-cpp-builds-with-split-dwarf/
>
> Adding the compilation flag is easy, but I'm stumbling on the installation
> step.
> In our current mode, we redirect the STRIP step to extract the symbols
> and strip the binary.
>

When you say "symbols" - do you mean only debug info? Or other things (like
the ELF symbol table (.symtab section) - since they're no longer needed if
no one's calling into the binary (I guess maybe a symbol table that
contains the entry point - 'main' would be needed? - this is the part of
ELF I don't understand too well))


> With split dwarf, I want to use 'dwp' to collect all .dwo files and
> assemble a symbol file. No need to strip I guess since symbols are
> already put elsewhere.
>

Actually there's probably still a desire to strip the executable - Split
DWARF leaves some debug info in the .o/executable (& at least the GNU
extension form of Split DWARF available in DWARFv4 leaves quiet a bit in
the .o/executable, especially in an optimized build, unfortunately) that
you can benefit from stripping out - along with the non-debug-related
symbol table, if that's a thing you're stripping (see above).


> So I figure I would just use dwp as the strip command in my custom
> strip command.
>
> Problem is .dwo files are recorded in the .o files relative to the
> build directory and the strip command is executed on the installed
> directory.
>

I think this depends on your build system - and might be resolvable
relative to the comp_dir in the debug info remaining in the .o file? Though
I haven't looked/checked closely (but yeah, moving debug info around when
using Split DWARF is a bit tricky)


> As a result, 'dwp' complains it cannot find the .dwo files.
>
> I don't want to add a POST_BUILD step on each our binaries (we have
> lots of binaries), and anyway I'd rather prefer to have the 'dwp' step
> executed at install time so it's executed only when we want to
> deliver.
>
> Is there a way to either
> - pass the build_dir to the strip command ?
> - define a custom step of the install process that would execute on
> the build dir previous to the install step itself ? (for the same
> reason I don't want to manually define a POST_BUILD step on each
> binaries, I don't want to manually define a custom INSTALL step that
> would precede the INSTALL step of all our binaries)
> - or another option ?
>
> With regards
>
> David
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181229/75dff0bf/attachment.html>


More information about the CMake mailing list