[llvm-dev] Combining install-distribution with binary stripping

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 28 12:22:40 PST 2017


Thanks for the suggestion. Unfortunately, that doesn't *quite* work, because
it doesn't perform a full strip (it does `strip -gx` instead of `strip -s`).
In my case the extra stripping is actually significant (e.g. it shaves 3 MB
off clang, and that 3 MB matters for my environment).

I'm wondering if performing a full strip for LLVM_EXTERNALIZE_DEBUGINFO would
be acceptable, since all the debug info is being split anyway.

On 11/27/17, 4:24 PM, "Justin Bogner" <justin at justinbogner.com on behalf of mail at justinbogner.com> wrote:

    Shoaib Meenai via llvm-dev <llvm-dev at lists.llvm.org> writes:
    > Hi all,
    >
    > I want to use the LLVM_DISTRIBUTION_COMPONENTS support to create an installed
    > toolchain image (via the install-distribution target). I'd also like the
    > installed binaries to be stripped.
    >
    > If you're invoking a cmake install script directly, you can pass
    > -DCMAKE_INSTALL_DO_STRIP=1 to cmake to request stripping. The install-*
    > targets set up by LLVM's build system don't seem to have any provision for
    > this though, as far as I can tell. I also can't figure out a way to pass cmake
    > this option apart from just putting it in the invocation (and the cmake
    > invocation here is controlled by the install-* target).
    >
    > I could go ahead and change the cmake invocation in all the install-* targets
    > to (conditionally) enable stripping, but the creation of the various install-*
    > targets is spread throughout the build system (a quick grep shows at least 20
    > of them spread around LLVM, clang, LLD, and libcxx), so it's a bit ugly. It's
    > obviously not hard to do (just tedious), and I'll put up some patches for that
    > if I can't figure out anything better, but I wanted to ask for suggestions
    > before embarking down that route.
    
    I was pretty sure this "Just Works", in that I use this and get stripped
    executables already. It turns out that's because I use
    -DLLVM_EXTERNALIZE_DEBUGINFO, which actually strips the binaries in the
    build's bin/ before install targets even happen. Could that work for you?
    
    > Other solutions I've considered:
    > * Strip the installed files manually after the installation. Also ugly.
    > * Abandon LLVM_DISTRIBUTION_COMPONENTS and just build the components
    >   individually and then invoke the installation scripts myself. The
    >   distribution component setup is much nicer though :(
    >
    > Thanks,
    > Shoaib
    



More information about the llvm-dev mailing list