OSDN Git Service

UPSTREAM: kbuild: use -Oz instead of -Os when using clang
authorBehan Webster <behanw@converseincode.com>
Tue, 28 Mar 2017 01:19:09 +0000 (18:19 -0700)
committerGreg Hackmann <ghackmann@google.com>
Mon, 16 Oct 2017 22:30:37 +0000 (15:30 -0700)
This generates smaller resulting object code when compiled with clang.

Signed-off-by: Behan Webster <behanw@converseincode.com>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
(cherry picked from commit 6748cb3c299de1ffbe56733647b01dbcc398c419)

Makefile

index f048e29..cfb3289 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -639,7 +639,8 @@ KBUILD_CFLAGS       += $(call cc-option,-fdata-sections,)
 endif
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS  += -Os $(call cc-disable-warning,maybe-uninitialized,)
+KBUILD_CFLAGS  += $(call cc-option,-Oz,-Os)
+KBUILD_CFLAGS  += $(call cc-disable-warning,maybe-uninitialized,)
 else
 ifdef CONFIG_PROFILE_ALL_BRANCHES
 KBUILD_CFLAGS  += -O2 $(call cc-disable-warning,maybe-uninitialized,)