diff options
author | Felix Fietkau <nbd@nbd.name> | 2018-07-11 18:30:03 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-07-13 17:22:53 +0200 |
commit | 8c11133c9de632dca69c8464f911d8e2716effe2 (patch) | |
tree | 9ecec6c266d096ed5258f204e32166365359aec7 /package/utils/busybox/Makefile | |
parent | 4e56af5ab481918764a373cf73b39843916f801b (diff) | |
download | upstream-8c11133c9de632dca69c8464f911d8e2716effe2.tar.gz upstream-8c11133c9de632dca69c8464f911d8e2716effe2.tar.bz2 upstream-8c11133c9de632dca69c8464f911d8e2716effe2.zip |
busybox: compile with LTO enabled
In the default configuration on MIPS, it reduces the .ipk size
from 214k to 207k
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/utils/busybox/Makefile')
-rw-r--r-- | package/utils/busybox/Makefile | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index e8d71670af..315dd42f8d 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox PKG_VERSION:=1.28.4 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -20,7 +20,6 @@ PKG_HASH:=e3c14a3699dc7e82fed397392957afc78e37bdf25398ac38ead6e84621b2ae6a PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 PKG_CHECK_FORMAT_SECURITY:=0 -PKG_INSTALL:=1 #Busybox use it's own PIE config flag and LDFLAGS are used with ld, not gcc. PKG_ASLR_PIE:=0 @@ -75,7 +74,10 @@ endef export KCONFIG_NOTIMESTAMP=1 +ifndef CONFIG_USE_MUSL LDLIBS:=m crypt +endif + LDLIBS += $(call BUSYBOX_IF_ENABLED,PAM,pam pam_misc pthread) ifdef CONFIG_BUSYBOX_USE_LIBRPC LDLIBS += rpc @@ -84,24 +86,32 @@ ifeq ($(CONFIG_USE_GLIBC),y) LDLIBS += $(call BUSYBOX_IF_ENABLED,NSLOOKUP_OPENWRT,resolv) endif +TARGET_CFLAGS += -flto +TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin + MAKE_VARS := MAKE_FLAGS += \ EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \ LDLIBS="$(LDLIBS)" \ + LD="$(TARGET_CC)" \ SKIP_STRIP=y ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) MAKE_FLAGS += V=1 endif -MAKE_INSTALL_FLAGS += CONFIG_PREFIX="$(PKG_INSTALL_DIR)" - - define Build/Configure grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) oldconfig endef +define Build/Compile + $(call Build/Compile/Default, \ + CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \ + all install \ + ) +endef + define Package/busybox/install $(INSTALL_DIR) $(1)/etc/init.d $(CP) $(PKG_INSTALL_DIR)/* $(1)/ |