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)

Bug: 63740206
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>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
  • Loading branch information
nickdesaulniers authored and losshye committed Oct 12, 2024
1 parent 0fca5b4 commit 01b2aeb
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 @@ -889,6 +889,10 @@ KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
# These result in bogus false positives
KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)

ifdef CONFIG_LD_IS_LLD
KBUILD_LDFLAGS += -O2
endif

ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
Expand Down

0 comments on commit 01b2aeb

Please sign in to comment.