mtd: Activate LTO compile option
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 27 Oct 2019 21:32:59 +0000 (22:32 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Fri, 8 Nov 2019 22:57:52 +0000 (23:57 +0100)
This decreases the size of the mtd application by 25% on MIPS BE.

old:
20,597 /sbin/mtd

new:
16,421 /sbin/mtd

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/system/mtd/Makefile

index 2347b8b..166bb33 100644 (file)
@@ -36,7 +36,8 @@ endef
 target=$(firstword $(subst -, ,$(BOARD)))
 
 MAKE_FLAGS += TARGET="$(target)"
-TARGET_CFLAGS := $(TARGET_CFLAGS) -Dtarget_$(target)=1 -Wall
+TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall -flto
+TARGET_LDFLAGS += -flto=jobserver
 
 ifdef CONFIG_MTD_REDBOOT_PARTS
   MAKE_FLAGS += FIS_SUPPORT=1