treewide: add support for "lto" in PKG_BUILD_FLAGS
authorAndre Heider <a.heider@gmail.com>
Thu, 2 Feb 2023 20:33:38 +0000 (21:33 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 21 Mar 2023 17:28:22 +0000 (18:28 +0100)
commit07730ff3465d3cede3026cdd1c17453930f055ce
tree71c8f06b42de3b1ff0d1c02c0068d718c3a08a62
parentda3700988d9e34e380bae21ee23d5458a7e972b4
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>
23 files changed:
include/package.mk
package/libs/jansson/Makefile
package/libs/libevent2/Makefile
package/libs/libnftnl/Makefile
package/libs/wolfssl/Makefile
package/network/config/firewall/Makefile
package/network/config/netifd/Makefile
package/network/config/swconfig/Makefile
package/network/services/dnsmasq/Makefile
package/network/services/dropbear/Makefile
package/network/services/hostapd/Makefile
package/network/services/lldpd/Makefile
package/network/services/ppp/Makefile
package/network/services/ustp/Makefile
package/network/utils/iproute2/Makefile
package/network/utils/iw/Makefile
package/network/utils/nftables/Makefile
package/system/mtd/Makefile
package/system/procd/Makefile
package/system/ubus/Makefile
package/system/usign/Makefile
package/utils/busybox/Makefile
package/utils/e2fsprogs/Makefile