Skip to content

Improve kernel LLD support

[email protected] linux-kbuild lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 8 repliesIn review
  2. v10 of 4 patches 0 repliesSuperseded

Changes in v2 from the cover letter

* collect reviewed-by, sugguested-by, tested-by tags.
* move where -fuse-ld=lld is added to CFLAGS.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4init/Kconfig: add config support for detecting linkerinit/Kconfig+9 -00 replies
2/4Makefile: clang: choose GCC_TOOLCHAIN_DIR not on LDMakefile+1 -11 reply
3/4Makefile: lld: tell clang to use lldMakefile+3 -015 replies
4/4Makefile: lld: set -O2 linker flag when linking with LLDMakefile+4 -02 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchKees CookNathan ChancellorSedat Dilek
1/4R-b R-b T-b
2/4R-b T-b
3/4R-b T-b R-b T-b R-b T-b R-b
4/4R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/4] Improve kernel LLD support

This patch cleans up a few places in the Makefile to make way for landing LLD support in the kernel. There are still a few arch specific fixes that need to get upstreamed, but this core set of patches should be arch independent.

Some very rough numbers: LLD is improving the overall build time of Google Pixel kernels by about 9%. The build is mostly dominated by compilation, but LLD is able to shave off quite a bit of time.

One of the included patches helps get LLD linked kernels to competitive binary size, but there still some bugs in LLD causing it not to discard certain sections. Once that's fixed, I estimate an LLD linked kernel to be just barely smaller than a BFD linked kernel (less than 1%).

Folks looking to test should use LLD built from source, as I recently fixed a bug in LLD that prevented LLD linked kernel modules from being loadable.

$ make LD=ld.lld

Nick Desaulniers (4):
init/Kconfig: add config support for detecting linker
Makefile: clang: choose GCC_TOOLCHAIN_DIR not on LD
Makefile: lld: tell clang to use lld
Makefile: lld: set -O2 linker flag when linking with LLD

Changes since v1:
* collect reviewed-by, sugguested-by, tested-by tags.
* move where -fuse-ld=lld is added to CFLAGS.

 Makefile     | 9 ++++++++-
 init/Kconfig | 9 +++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
Signature · 1 line
2.20.1.791.gb4d0f1c61a-goog