diff --git a/Makefile b/Makefile index 5dacea0a8a41..011ca7762e47 100644 --- a/Makefile +++ b/Makefile @@ -755,6 +755,10 @@ endif # Use make W=1 to enable them (see scripts/Makefile.extrawarn) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) +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