[PATCH] D108120: [lld] Add CMake options to disable individual linkers

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 17 06:07:00 PDT 2021


arichardson added a comment.

In D108120#2949178 <https://reviews.llvm.org/D108120#2949178>, @thakis wrote:

> Is the motivation disk size? How much of a difference does this make?

For a release+asserts build it's about 3MB difference. Not huge but noticeable:

  $ ls -l bin/lld.*.s*
  -rwxrwxr-x 1 alr48 alr48 106799760 Aug 17 13:57 bin/lld.all.stripped
  -rwxrwxr-x 1 alr48 alr48 102797984 Aug 17 13:53 bin/lld.elf.stripped
  $ size bin/lld.*.s*
     text	   data	    bss	    dec	    hex	filename
  99852875	6934040	 500314	107287229	66512bd	bin/lld.all.stripped
  95985096	6805040	 474962	103265098	627b34a	bin/lld.elf.stripped

My main motivation was actually build time and looking for files that can easily be omitted.
Building all LLD flavours results in 156 ninja commands (after `rm -rf tools/lld`) whereas only building the ELF linker results in 54 build commands.
FreeBSD builds LLVM using a separate Makefile based system, so they only have a small downstream `#if 0` patch in `lld.cpp`. Therefore it's not a huge local diff that would be removed by this patch.

My real motivation is only building the ELF linker for our CHERI toolchain (and I think Arm might do the same for their Morello toolchain once our changes have been merged).
Right now we don't ship binaries, so we expect all our users to compile LLVM from source (possibly on laptops with only a few CPU cores), so not building approximately 100 source files could be a noticeable speedup.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108120/new/

https://reviews.llvm.org/D108120



More information about the llvm-commits mailing list