From 07730ff3465d3cede3026cdd1c17453930f055ce Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 2 Feb 2023 21:33:38 +0100 Subject: [PATCH] treewide: add support for "lto" in PKG_BUILD_FLAGS This reduces open coding and allows to easily add a knob to enable it treewide, where chosen packages can still opt-out via "no-lto". Some packages used LTO, but not the linker plugin. This unifies 'em all to attempt to produce better code. Quoting man gcc(1): "This improves the quality of optimization by exposing more code to the link-time optimizer." Also use -flto=auto instead of -flto=jobserver, as it's not guaranteed that every buildsystem uses +$(MAKE) correctly. Signed-off-by: Andre Heider --- include/package.mk | 7 ++++++- package/libs/jansson/Makefile | 5 ++--- package/libs/libevent2/Makefile | 6 +++--- package/libs/libnftnl/Makefile | 4 ++-- package/libs/wolfssl/Makefile | 5 +---- package/network/config/firewall/Makefile | 4 +--- package/network/config/netifd/Makefile | 7 +++---- package/network/config/swconfig/Makefile | 5 ++--- package/network/services/dnsmasq/Makefile | 4 +--- package/network/services/dropbear/Makefile | 5 ++--- package/network/services/hostapd/Makefile | 5 ++--- package/network/services/lldpd/Makefile | 4 ++-- package/network/services/ppp/Makefile | 5 +---- package/network/services/ustp/Makefile | 5 +++-- package/network/utils/iproute2/Makefile | 3 +-- package/network/utils/iw/Makefile | 7 +++---- package/network/utils/nftables/Makefile | 5 ++--- package/system/mtd/Makefile | 4 ++-- package/system/procd/Makefile | 4 +--- package/system/ubus/Makefile | 4 ++-- package/system/usign/Makefile | 5 +---- package/utils/busybox/Makefile | 4 +--- package/utils/e2fsprogs/Makefile | 6 ++---- 23 files changed, 46 insertions(+), 67 deletions(-) diff --git a/include/package.mk b/include/package.mk index 4d97cda00f..0fb947f035 100644 --- a/include/package.mk +++ b/include/package.mk @@ -30,7 +30,7 @@ ifneq ($(strip $(PKG_USE_MIPS16)),1) PKG_BUILD_FLAGS+=no-mips16 endif -__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections,$(PKG_BUILD_FLAGS)) +__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto,$(PKG_BUILD_FLAGS)) ifneq ($(__unknown_flags),) $(error unknown PKG_BUILD_FLAGS: $(__unknown_flags)) endif @@ -56,6 +56,11 @@ ifeq ($(call pkg_build_flag,gc-sections,0),1) TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections TARGET_LDFLAGS+= -Wl,--gc-sections endif +ifeq ($(call pkg_build_flag,lto,0),1) + TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects + TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects + TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin +endif include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/prereq.mk diff --git a/package/libs/jansson/Makefile b/package/libs/jansson/Makefile index d8567ed79a..e2b5206acb 100644 --- a/package/libs/jansson/Makefile +++ b/package/libs/jansson/Makefile @@ -19,6 +19,8 @@ PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:jansson_project:jansson +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -41,9 +43,6 @@ define Package/jansson/description Jansson is a C library for encoding, decoding and manipulating JSON data endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto - define Package/jansson/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson*so.* $(1)/usr/lib/ diff --git a/package/libs/libevent2/Makefile b/package/libs/libevent2/Makefile index 50dd19bf00..92602607ae 100644 --- a/package/libs/libevent2/Makefile +++ b/package/libs/libevent2/Makefile @@ -26,7 +26,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_libevent2-pthreads \ CONFIG_PACKAGE_libevent2-mbedtls -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -114,8 +114,8 @@ define Package/libevent2-pthreads/description threading & locking. endef -TARGET_CFLAGS += $(FPIC) -flto -TARGET_LDFLAGS += -Wl,--as-needed -flto +TARGET_CFLAGS += $(FPIC) +TARGET_LDFLAGS += -Wl,--as-needed CMAKE_OPTIONS += \ -DEVENT__DISABLE_BENCHMARK:BOOL=ON \ diff --git a/package/libs/libnftnl/Makefile b/package/libs/libnftnl/Makefile index f92fb91eea..8d8c8c25e3 100644 --- a/package/libs/libnftnl/Makefile +++ b/package/libs/libnftnl/Makefile @@ -22,6 +22,7 @@ PKG_LICENSE_FILES:=COPYING PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=lto include $(INCLUDE_DIR)/package.mk @@ -41,8 +42,7 @@ define Package/libnftnl/description programming interface (API) to the in-kernel nf_tables subsystem. endef -TARGET_CFLAGS += $(FPIC) -flto -TARGET_LDFLAGS += -flto +TARGET_CFLAGS += $(FPIC) CONFIGURE_ARGS += \ --enable-static \ diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 48e85b0bce..04d9d3ef66 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -17,7 +17,7 @@ PKG_HASH:=b7ee150e49def77c765bc02aac92ddeb0bebefd4cb12aa263d8f95e405221fb8 PKG_FIXUP:=libtool libtool-abiver PKG_INSTALL:=1 -PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_FLAGS:=no-mips16 lto PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=LICENSING COPYING @@ -118,12 +118,9 @@ endef TARGET_CFLAGS += \ $(FPIC) \ -fomit-frame-pointer \ - -flto \ -DFP_MAX_BITS=8192 \ $(if $(CONFIG_WOLFSSL_ALT_NAMES),-DWOLFSSL_ALT_NAMES) -TARGET_LDFLAGS += -flto - # --enable-stunnel needed for OpenSSL API compatibility bits CONFIGURE_ARGS += \ --enable-reproducible-build \ diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index 95e2ae4b67..0e00f38689 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -21,7 +21,7 @@ PKG_LICENSE:=ISC PKG_CONFIG_DEPENDS := CONFIG_IPV6 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -44,8 +44,6 @@ define Package/firewall/conffiles /etc/firewall.user endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto CMAKE_OPTIONS += $(if $(CONFIG_IPV6),,-DDISABLE_IPV6=1) define Package/firewall/install diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index d9d1bce26f..9b5fb08ab0 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -13,6 +13,8 @@ PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -30,10 +32,7 @@ endef TARGET_CFLAGS += \ -I$(STAGING_DIR)/usr/include/libnl-tiny \ - -I$(STAGING_DIR)/usr/include \ - -flto - -TARGET_LDFLAGS += -flto -fuse-linker-plugin + -I$(STAGING_DIR)/usr/include CMAKE_OPTIONS += \ -DLIBNL_LIBS=-lnl-tiny \ diff --git a/package/network/config/swconfig/Makefile b/package/network/config/swconfig/Makefile index 4d3e572d82..6549075e5c 100644 --- a/package/network/config/swconfig/Makefile +++ b/package/network/config/swconfig/Makefile @@ -13,6 +13,8 @@ PKG_RELEASE:=12 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/kernel.mk @@ -23,9 +25,6 @@ define Package/swconfig TITLE:=Switch configuration utility endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver - TARGET_CPPFLAGS := \ -D_GNU_SOURCE \ -I$(STAGING_DIR)/usr/include/libnl-tiny \ diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index f555712a7f..d8e2e29a87 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -24,6 +24,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_UPSTR PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=lto PKG_ASLR_PIE_REGULAR:=1 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcp \ CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6 \ @@ -133,9 +134,6 @@ endef Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles) Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles) -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver - COPTS = -DHAVE_UBUS -DHAVE_POLL_H \ $(if $(CONFIG_IPV6),,-DNO_IPV6) diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile index 1b3fdad067..f05248054e 100644 --- a/package/network/services/dropbear/Makefile +++ b/package/network/services/dropbear/Makefile @@ -23,7 +23,7 @@ PKG_CPE_ID:=cpe:/a:matt_johnston:dropbear_ssh_server PKG_BUILD_PARALLEL:=1 PKG_ASLR_PIE_REGULAR:=1 -PKG_BUILD_FLAGS:=no-mips16 gc-sections +PKG_BUILD_FLAGS:=no-mips16 gc-sections lto PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared @@ -142,8 +142,7 @@ DB_OPT_CONFIG = \ DROPBEAR_SVR_AGENTFWD|CONFIG_DROPBEAR_AGENTFORWARD|1|0 \ -TARGET_CFLAGS += -DARGTYPE=3 -flto -TARGET_LDFLAGS += -flto=jobserver +TARGET_CFLAGS += -DARGTYPE=3 db_opt_add =echo '\#define $(1) $(2)' >> $(PKG_BUILD_DIR)/localoptions.h db_opt_replace =$(ESED) 's,^(\#define $(1)) .*$$$$,\1 $(2),g' $(PKG_BUILD_DIR)/sysoptions.h diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index 1b077530e1..f184830be3 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -32,7 +32,7 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_DRIVER_11AX_SUPPORT \ CONFIG_WPA_ENABLE_WEP -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto EAPOL_TEST_PROVIDERS:=eapol-test eapol-test-openssl eapol-test-wolfssl @@ -587,8 +587,7 @@ TARGET_CPPFLAGS := \ -D_GNU_SOURCE \ $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY)) -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin -lubox -lubus +TARGET_LDFLAGS += -lubox -lubus ifdef CONFIG_PACKAGE_kmod-cfg80211 TARGET_LDFLAGS += -lm -lnl-tiny diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index a08626366f..c3753534a6 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -21,6 +21,7 @@ PKG_CPE_ID:=cpe:/a:lldpd_project:lldpd PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=lto PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk @@ -111,7 +112,6 @@ CONFIGURE_ARGS += \ $(if $(CONFIG_LLDPD_WITH_SNMP),--with-snmp,) \ $(if $(CONFIG_USE_GLIBC),,--without-libbsd) -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto -Wl,--gc-sections,--as-needed +TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed $(eval $(call BuildPackage,lldpd)) diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 48f2091a1f..80d5e46c34 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -26,7 +26,7 @@ PKG_VERSION:=$(PKG_RELEASE_VERSION).git-$(PKG_SOURCE_DATE) PKG_BUILD_DEPENDS:=libpcap PKG_ASLR_PIE_REGULAR:=1 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 @@ -193,9 +193,6 @@ $(call Build/Configure/Default,, \ $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto -fuse-linker-plugin - MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \ PRECOMPILED_FILTER=1 \ STAGING_DIR="$(STAGING_DIR)" diff --git a/package/network/services/ustp/Makefile b/package/network/services/ustp/Makefile index 88bc993bb6..2cdd033754 100644 --- a/package/network/services/ustp/Makefile +++ b/package/network/services/ustp/Makefile @@ -19,6 +19,8 @@ PKG_MIRROR_HASH:=0e96edc983cf437b95874e5715d743f30bb826d8757dc3771ff872ab9cf18f3 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -29,8 +31,7 @@ define Package/ustp DEPENDS:=+libubox +libubus endef -TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto -TARGET_LDFLAGS += -flto -fuse-linker-plugin +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include define Package/ustp/install $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index b3a809e0b5..2cd14fe83d 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -19,7 +19,7 @@ PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk @@ -173,7 +173,6 @@ define Build/Configure > $(PKG_BUILD_DIR)/include/SNAPSHOT.h endef -TARGET_CFLAGS += -flto TARGET_LDFLAGS += -Wl,--as-needed TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile index 1eb3cd721a..746c2c3c12 100644 --- a/package/network/utils/iw/Makefile +++ b/package/network/utils/iw/Makefile @@ -18,7 +18,7 @@ PKG_HASH:=f167bbe947dd53bb9ebc0c1dcef5db6ad73ac1d6084f2c6f9376c5c360cc4d4e PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/package.mk @@ -48,8 +48,7 @@ TARGET_CPPFLAGS:= \ -I$(STAGING_DIR)/usr/include/libnl-tiny \ $(TARGET_CPPFLAGS) \ -DCONFIG_LIBNL20 \ - -D_GNU_SOURCE \ - -flto + -D_GNU_SOURCE ifeq ($(BUILD_VARIANT),full) TARGET_CPPFLAGS += -DIW_FULL @@ -58,7 +57,7 @@ endif MAKE_FLAGS += \ CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ - LDFLAGS="$(TARGET_LDFLAGS) -flto" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ NL1FOUND="" NL2FOUND=Y \ NLLIBNAME="libnl-tiny" \ LIBS="-lm -lnl-tiny" \ diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index 9a180a0953..55a6a4bcf6 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -20,6 +20,8 @@ PKG_LICENSE_FILES:=COPYING PKG_FIXUP:=autoreconf PKG_INSTALL:=1 +PKG_BUILD_FLAGS:=lto + include $(INCLUDE_DIR)/package.mk DISABLE_NLS:= @@ -60,9 +62,6 @@ ifeq ($(BUILD_VARIANT),json) CONFIGURE_ARGS += --with-json endif -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/ diff --git a/package/system/mtd/Makefile b/package/system/mtd/Makefile index 1a70a64b7d..d45f06fc43 100644 --- a/package/system/mtd/Makefile +++ b/package/system/mtd/Makefile @@ -18,6 +18,7 @@ PKG_LICENSE:=GPL-2.0+ PKG_LICENSE_FILES:= PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=lto include $(INCLUDE_DIR)/package.mk @@ -36,8 +37,7 @@ endef target=$(firstword $(subst -, ,$(BOARD))) MAKE_FLAGS += TARGET="$(target)" -TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall -flto -TARGET_LDFLAGS += -flto=jobserver +TARGET_CFLAGS += -Dtarget_$(target)=1 -Wall ifdef CONFIG_MTD_REDBOOT_PARTS MAKE_FLAGS += FIS_SUPPORT=1 diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 56aa9e0b35..2d51b51ad7 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -22,6 +22,7 @@ PKG_LICENSE_FILES:= PKG_MAINTAINER:=John Crispin +PKG_BUILD_FLAGS:=lto PKG_ASLR_PIE_REGULAR:=1 PKG_CONFIG_DEPENDS:= \ CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP CONFIG_PROCD_SHOW_BOOT \ @@ -36,9 +37,6 @@ endif CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)" -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto - define Package/procd/Default SECTION:=base CATEGORY:=Base system diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 4c72780703..5a951ac249 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -15,6 +15,7 @@ PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= PKG_MAINTAINER:=Felix Fietkau +PKG_BUILD_FLAGS:=lto PKG_ASLR_PIE_REGULAR:=1 include $(INCLUDE_DIR)/package.mk @@ -50,8 +51,7 @@ define Package/libubus-lua TITLE:=Lua binding for the OpenWrt RPC client endef -TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto -TARGET_LDFLAGS += -flto +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include CMAKE_OPTIONS += \ -DLUAPATH=/usr/lib/lua \ diff --git a/package/system/usign/Makefile b/package/system/usign/Makefile index 0d2d07017c..3c28318028 100644 --- a/package/system/usign/Makefile +++ b/package/system/usign/Makefile @@ -10,7 +10,7 @@ PKG_SOURCE_VERSION:=f1f65026a94137c91b5466b149ef3ea3f20091e9 PKG_MIRROR_HASH:=3f6569a5e63fdfd032976ac0f79d736d3935101ac1b97fb370514b013c5e6bb6 CMAKE_INSTALL:=1 PKG_CHECK_FORMAT_SECURITY:=1 -PKG_BUILD_FLAGS:=no-mips16 +PKG_BUILD_FLAGS:=no-mips16 lto PKG_LICENSE:=ISC PKG_LICENSE_FILES:= @@ -30,9 +30,6 @@ define Package/usign TITLE:=OpenWrt signature verification utility endef -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver - CMAKE_OPTIONS += \ -DUSE_LIBUBOX=on diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 9573278945..d7ad8ca8fa 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -16,6 +16,7 @@ PKG_HASH:=542750c8af7cb2630e201780b4f99f3dcceeb06f505b479ec68241c1e6af61a5 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=lto PKG_CHECK_FORMAT_SECURITY:=0 PKG_LICENSE:=GPL-2.0 @@ -103,9 +104,6 @@ ifeq ($(BUILD_VARIANT),selinux) LDLIBS += selinux sepol endif -TARGET_CFLAGS += -flto -TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin - MAKE_VARS := MAKE_FLAGS += \ EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index cd9b10e175..9437947ab6 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -23,7 +23,7 @@ PKG_BUILD_DEPENDS:=util-linux e2fsprogs/host PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections lto include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk @@ -143,9 +143,7 @@ $(call Package/e2fsprogs) DEPENDS:= +e2fsprogs endef -TARGET_CFLAGS += $(FPIC) -flto - -TARGET_LDFLAGS += -flto +TARGET_CFLAGS += $(FPIC) CONFIGURE_ARGS += \ --disable-testio-debug \ -- 2.30.2