Skip to content

Commit

Permalink
FROMLIST: Makefile: lld: set -O2 linker flag when linking with LLD
Browse files Browse the repository at this point in the history
For arm64:
0.34% size improvement with lld -O2 over lld for vmlinux.
3.3% size improvement with lld -O2 over lld for Image.lz4-dtb.

(am from https://lkml.org/lkml/2019/2/11/1949)

Change-Id: Ibdc7ecc9861562305b49456d6d37274ce8075e22
Link: ClangBuiltLinux/linux#343
Suggested-by: Rui Ueyama <ruiu@google.com>
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Bug: 63740206
Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com>
Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
  • Loading branch information
nickdesaulniers authored and duhansysl committed Sep 30, 2024
1 parent 3da8deb commit 295a97a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,10 @@ KBUILD_CFLAGS += $(call cc-disable-warning, unused-function)
KBUILD_CFLAGS += $(call cc-disable-warning, implicit-function-declaration)
endif

ifeq ($(ld-name),lld)
KBUILD_LDFLAGS += -O2
endif

KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
Expand Down

0 comments on commit 295a97a

Please sign in to comment.