From 47b42137ce1e931ae5871952b1f98438396f5e07 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 11 Jul 2018 19:28:54 +0200 Subject: [PATCH] dropbear: compile with LTO enabled Reduces size of the .ipk on MIPS from 87k to 84k Signed-off-by: Felix Fietkau --- package/network/services/dropbear/Makefile | 4 +-- .../dropbear/patches/160-lto-jobserver.patch | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 package/network/services/dropbear/patches/160-lto-jobserver.patch diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 742e538ff5..515434dc2f 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -86,8 +86,8 @@ CONFIGURE_ARGS += \ $(if $(CONFIG_DROPBEAR_ZLIB),,--disable-zlib) \ --enable-bundled-libtom -TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections +TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver define Build/Configure $(Build/Configure/Default) diff --git a/package/network/services/dropbear/patches/160-lto-jobserver.patch b/package/network/services/dropbear/patches/160-lto-jobserver.patch new file mode 100644 index 0000000000..bb94492833 --- /dev/null +++ b/package/network/services/dropbear/patches/160-lto-jobserver.patch @@ -0,0 +1,33 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -163,17 +163,17 @@ dropbearkey: $(dropbearkeyobjs) + dropbearconvert: $(dropbearconvertobjs) + + dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ + + dbclient: $(HEADERS) $(LIBTOM_DEPS) Makefile +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) + + dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) + + # scp doesn't use the libs so is special. + scp: $(SCPOBJS) $(HEADERS) Makefile +- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $(SCPOBJS) ++ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $(SCPOBJS) + + + # multi-binary compilation. +@@ -184,7 +184,7 @@ ifeq ($(MULTI),1) + endif + + dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile +- $(CC) $(LDFLAGS) -o $@ $(MULTIOBJS) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ ++ +$(CC) $(LDFLAGS) -o $@ $(MULTIOBJS) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ + + multibinary: dropbearmulti$(EXEEXT) + -- 2.30.2