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 <a.heider@gmail.com>
This commit is contained in:
Andre Heider
2023-02-02 21:33:38 +01:00
committed by Christian Marangi
parent da3700988d
commit 07730ff346
23 changed files with 46 additions and 67 deletions

View File

@@ -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