[OpenWrt-Devel] [PATCH 2/4] mtd: Activate LTO compile option

Rosen Penev rosenp at gmail.com
Fri Nov 1 17:12:37 EDT 2019


On Fri, Nov 1, 2019 at 1:55 PM Hauke Mehrtens <hauke at hauke-m.de> wrote:
>
> 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 at hauke-m.de>
> ---
>  package/system/mtd/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/package/system/mtd/Makefile b/package/system/mtd/Makefile
> index 2347b8b723..166bb33281 100644
> --- a/package/system/mtd/Makefile
> +++ b/package/system/mtd/Makefile
> @@ -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
I don't think Wall is necessary here.
> +TARGET_LDFLAGS += -flto=jobserver
>
>  ifdef CONFIG_MTD_REDBOOT_PARTS
>    MAKE_FLAGS += FIS_SUPPORT=1
> --
> 2.20.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list