diff mbox series

[4/4] Makefile: lld: set -O2 linker flag when linking with LLD

Message ID 20190207220155.81351-4-ndesaulniers@google.com
State Superseded
Headers show
Series [1/4] init/Kconfig: add config support for detecting linker | expand

Commit Message

Nick Desaulniers Feb. 7, 2019, 10:01 p.m. UTC
-O2 enables tail merging of string table strings.

For arm64:
0.34% size improvement with lld -O2 over lld for vmlinux.
3.30% size improvement with lld -O2 over lld for Image.lz4-dtb.

Link: https://github.com/ClangBuiltLinux/linux/issues/343
Suggested-by: Rui Ueyama <ruiu@google.com>
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.20.1.791.gb4d0f1c61a-goog

Comments

Nathan Chancellor Feb. 8, 2019, 6:07 a.m. UTC | #1
On Thu, Feb 07, 2019 at 02:01:52PM -0800, ndesaulniers@google.com wrote:
> -O2 enables tail merging of string table strings.

> 

> For arm64:

> 0.34% size improvement with lld -O2 over lld for vmlinux.

> 3.30% size improvement with lld -O2 over lld for Image.lz4-dtb.

> 

> Link: https://github.com/ClangBuiltLinux/linux/issues/343

> Suggested-by: Rui Ueyama <ruiu@google.com>

> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>

> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>


Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

Tested-by: Nathan Chancellor <natechancellor@gmail.com>


> ---

>  Makefile | 4 ++++

>  1 file changed, 4 insertions(+)

> 

> diff --git a/Makefile b/Makefile

> index 6307c17259ea..c07208ec49d4 100644

> --- a/Makefile

> +++ b/Makefile

> @@ -718,6 +718,10 @@ else

>  KBUILD_CFLAGS += -Wno-unused-but-set-variable

>  endif

>  

> +ifdef CONFIG_LD_IS_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

> -- 

> 2.20.1.791.gb4d0f1c61a-goog

>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 6307c17259ea..c07208ec49d4 100644
--- a/Makefile
+++ b/Makefile
@@ -718,6 +718,10 @@  else
 KBUILD_CFLAGS += -Wno-unused-but-set-variable
 endif
 
+ifdef CONFIG_LD_IS_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