[LLVMdev] [Clang] [lld] [llvm-link] Whole program / dead-code optimization

ed at modk.it ed at modk.it
Thu Jul 16 11:39:50 PDT 2015


Hi All,

After the initial learning curve, we're excited to have put together a
completely gcc/binutils-free toolchain based on LLVM.  Now that we have
things working, we desperately need to optimize the resulting binaries.
Our bin files are up to 10x their fully optimized gcc equivalent (1.5k vs
16k).  This is for a bare metal ARM based system so this is significant.

We're using lld for linking and the following dead code elimination
techniques seem to be dead ends:

1) whole program optimization on our most egregious space waster
(-fwhole-program not supported by clang)
2) link time optimization (looks like this is only supported by lld for the
COFF path not the ELF path)
3) using a linker plugin like gold (-fuse-linker-plugin doesn't seem to be
supported by clang)

We have control over the whole codebase and could essentially compile all
of our C/C++ code as single file if there was a way to tell clang that it
is seeing the whole program.

Any thoughts on how we could achieve this?  This slidedeck suggests using
llvm-link to accomplish this:
http://llvm.org/devmtg/2013-11/slides/Gao-LTO.pdf.  Is this the most
promising way forward?

Thanks,
Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150716/0b9f7e20/attachment.html>


More information about the llvm-dev mailing list