diff --git a/config/Config-build.in b/config/Config-build.in index df2d9101ca..5f9a1be858 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -159,6 +159,19 @@ menu "Global build settings" Adds LTO flags to the CFLAGS and LDFLAGS. Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-lto + config MOLD + depends on (aarch64 || arm || i386 || i686 || m68k || powerpc || powerpc64 || sh4 || x86_64) + depends on !GCC_USE_VERSION_11 + def_bool $(shell, ./config/check-hostcxx.sh 10 2 12) + + config USE_MOLD + bool + prompt "Use the mold linker for all packages" + depends on MOLD + help + Link packages with mold, a modern linker + Packages can opt-out via setting PKG_BUILD_FLAGS:=no-mold + config IPV6 def_bool y @@ -182,7 +195,6 @@ menu "Global build settings" help This will install binaries stripped using strip from binutils. - config USE_SSTRIP bool "sstrip" depends on !USE_GLIBC @@ -199,13 +211,12 @@ menu "Global build settings" help Specifies arguments passed to the strip command when stripping binaries. - config SSTRIP_ARGS - string - prompt "Sstrip arguments" - depends on USE_SSTRIP - default "-z" + config SSTRIP_DISCARD_TRAILING_ZEROES + bool "Strip trailing zero bytes" + depends on USE_SSTRIP && !USE_MOLD + default y help - Specifies arguments passed to the sstrip command when stripping binaries. + Use sstrip's -z option to discard trailing zero bytes config STRIP_KERNEL_EXPORTS bool "Strip unnecessary exports from the kernel image" diff --git a/config/Config-kernel.in b/config/Config-kernel.in index a8780ee970..e5a639cc4f 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1351,3 +1351,17 @@ config KERNEL_UBIFS_FS_SECURITY config KERNEL_JFFS2_FS_SECURITY bool "JFFS2 Security Labels" + +config KERNEL_WERROR + bool "Compile the kernel with warnings as errors" + help + A kernel build should not cause any compiler warnings, and this + enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags + to enforce that rule by default. Certain warnings from other tools + such as the linker may be upgraded to errors with this option as + well. + + However, if you have a new (or very old) compiler or linker with odd + and unusual warnings, or you have some architecture with problems, + you may need to disable this config option in order to + successfully build the kernel. diff --git a/config/check-hostcxx.sh b/config/check-hostcxx.sh new file mode 100755 index 0000000000..442f4cfb40 --- /dev/null +++ b/config/check-hostcxx.sh @@ -0,0 +1,12 @@ +cat << EOF | "$STAGING_DIR_HOST/bin/g++" -c -x c++ -o /dev/null - >/dev/null 2>&1 +#if __clang__ + #if __clang_major__ < $3 + #error "clang too old" + #endif +#else + #if __GNUC__ < $1 || (__GNUC__ == $1 && (__GNUC_MINOR__ < $2)) + #error "gcc too old" + #endif +#endif +EOF +[ $? -eq 0 ] && echo y || echo n diff --git a/include/kernel.mk b/include/kernel.mk index b1ae42534d..3012eb8993 100644 --- a/include/kernel.mk +++ b/include/kernel.mk @@ -236,7 +236,7 @@ $(call KernelPackage/$(1)/config) $(call KernelPackage/depends) $(call KernelPackage/hooks) - ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),) + ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(call version_filter,$(filter-out %=y %=n %=m,$(KCONFIG))),$($(c)))),.),) define Package/kmod-$(1)/install @for mod in $$(call version_filter,$$(FILES)); do \ if grep -q "$$$$$$$${mod##$(LINUX_DIR)/}" "$(LINUX_DIR)/modules.builtin"; then \ diff --git a/include/meson.mk b/include/meson.mk index 7d67dcf298..74c9d3dd7f 100644 --- a/include/meson.mk +++ b/include/meson.mk @@ -78,6 +78,7 @@ define Meson/CreateCrossFile $(STAGING_DIR_HOST)/bin/sed \ -e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \ -e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \ + -e "s|@LD@|$(foreach FLAG,$(TARGET_LINKER),'$(FLAG)',)|" \ -e "s|@AR@|$(TARGET_AR)|" \ -e "s|@STRIP@|$(TARGET_CROSS)strip|" \ -e "s|@NM@|$(TARGET_NM)|" \ diff --git a/include/package.mk b/include/package.mk index c391d320aa..61a26f0c43 100644 --- a/include/package.mk +++ b/include/package.mk @@ -24,7 +24,7 @@ PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1) endif PKG_BUILD_FLAGS?= -__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto,$(PKG_BUILD_FLAGS)) +__unknown_flags=$(filter-out no-iremap no-mips16 gc-sections no-gc-sections lto no-lto no-mold,$(PKG_BUILD_FLAGS)) ifneq ($(__unknown_flags),) $(error unknown PKG_BUILD_FLAGS: $(__unknown_flags)) endif @@ -55,6 +55,11 @@ ifeq ($(call pkg_build_flag,lto,$(if $(CONFIG_USE_LTO),1,0)),1) TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin endif +ifdef CONFIG_USE_MOLD + ifeq ($(call pkg_build_flag,mold,1),1) + TARGET_LINKER:=mold + endif +endif include $(INCLUDE_DIR)/hardening.mk include $(INCLUDE_DIR)/prereq.mk diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index 865feee9ad..44dafe1ef1 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -25,7 +25,7 @@ ifneq ($(BUILD_VARIANT),none) endif PKG_FLAGS:=nonshared -PKG_BUILD_FLAGS:=no-lto +PKG_BUILD_FLAGS:=no-lto no-mold include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 5701890cbc..e89e7002ad 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/version.mk PKG_NAME:=ipq-wifi -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git @@ -41,6 +41,7 @@ ALLWIFIBOARDS:= \ xiaomi_ax3600 \ xiaomi_ax9000 \ zte_mf269 \ + zte_mf289f \ zte_mf287plus \ zyxel_nbg7815 @@ -129,6 +130,7 @@ $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600)) $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) $(eval $(call generate-ipq-wifi-package,zte_mf269,ZTE MF269)) +$(eval $(call generate-ipq-wifi-package,zte_mf289f,ZTE MF289F)) $(eval $(call generate-ipq-wifi-package,zte_mf287plus,ZTE MF287Plus)) $(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815)) diff --git a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch new file mode 100644 index 0000000000..40f262464b --- /dev/null +++ b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch @@ -0,0 +1,28 @@ +From f7d6edafe4358e3880a26775cfde4cd5c71ba063 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Wed, 5 Jul 2023 01:30:29 +0200 +Subject: [PATCH] ath10k: always use mac80211 loss detection + +ath10k does not report excessive loss in case of broken block-ack +sessions. The loss is communicated to the host-os, but ath10k does not +trigger a low-ack events by itself. + +The mac80211 framework for loss detection however detects this +circumstance well in case of ath10k. So use it regardless of ath10k's +own loss detection mechanism. + +Signed-off-by: David Bauer +--- + ath10k-6.2/mac.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/ath10k-6.2/mac.c ++++ b/ath10k-6.2/mac.c +@@ -11306,7 +11306,6 @@ int ath10k_mac_register(struct ath10k *a + ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); + ieee80211_hw_set(ar->hw, QUEUE_CONTROL); + ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); +- ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); + + if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) + ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); diff --git a/package/kernel/lantiq/ltq-ifxos/Makefile b/package/kernel/lantiq/ltq-ifxos/Makefile index d941a9d56f..97f7ca78ce 100644 --- a/package/kernel/lantiq/ltq-ifxos/Makefile +++ b/package/kernel/lantiq/ltq-ifxos/Makefile @@ -23,6 +23,7 @@ PKG_LICENSE_FILES:=LICENSE PKG_EXTMOD_SUBDIRS:=src PKG_FIXUP:=autoreconf +PKG_BUILD_FLAGS:=no-mold include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile b/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile index f2dcf8db84..7b8a948179 100644 --- a/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-vr11-mei/Makefile @@ -25,6 +25,7 @@ PKG_EXTMOD_SUBDIRS:=src PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared +PKG_BUILD_FLAGS:=no-mold include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/lantiq/ltq-vdsl-vr11/Makefile b/package/kernel/lantiq/ltq-vdsl-vr11/Makefile index 8284cba9a7..11f96d744a 100644 --- a/package/kernel/lantiq/ltq-vdsl-vr11/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-vr11/Makefile @@ -23,6 +23,7 @@ PKG_LICENSE:=GPL-2.0 BSD-2-Clause PKG_LICENSE_FILES:=LICENSE PKG_FIXUP:=autoreconf +PKG_BUILD_FLAGS:=no-mold include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index 23e32655b2..5761c4bc6b 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -217,6 +217,21 @@ endef $(eval $(call KernelPackage,hwmon-it87)) +define KernelPackage/hwmon-jc42 + TITLE:=Jedec JC42.4 compliant temperature sensors support + KCONFIG:=CONFIG_SENSORS_JC42 + FILES:=$(LINUX_DIR)/drivers/hwmon/jc42.ko + AUTOLOAD:=$(call AutoProbe,jc42) + $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c) +endef + +define KernelPackage/hwmon-jc42/description + Kernel module for Jedec JC42.4 compliant temperature sensors +endef + +$(eval $(call KernelPackage,hwmon-jc42)) + + define KernelPackage/hwmon-lm63 TITLE:=LM63/64 monitoring support KCONFIG:=CONFIG_SENSORS_LM63 @@ -369,6 +384,21 @@ endef $(eval $(call KernelPackage,hwmon-max6642)) +define KernelPackage/hwmon-max6697 + TITLE:=MAX6697 monitoring support + KCONFIG:=CONFIG_SENSORS_MAX6697 + FILES:=$(LINUX_DIR)/drivers/hwmon/max6697.ko + AUTOLOAD:=$(call AutoProbe,max6697) + $(call AddDepends/hwmon,+kmod-i2c-core) +endef + +define KernelPackage/hwmon-max6697/description + Kernel module for Maxim MAX6697 temperature monitor +endef + +$(eval $(call KernelPackage,hwmon-max6697)) + + define KernelPackage/hwmon-mcp3021 TITLE:=MCP3021/3221 monitoring support KCONFIG:=CONFIG_SENSORS_MCP3021 diff --git a/package/kernel/linux/modules/i2c.mk b/package/kernel/linux/modules/i2c.mk index 1c65a26edc..7cd69dbb95 100644 --- a/package/kernel/linux/modules/i2c.mk +++ b/package/kernel/linux/modules/i2c.mk @@ -200,6 +200,22 @@ endef $(eval $(call KernelPackage,i2c-mux-gpio)) +I2C_MUX_REG_MODULES:= \ + CONFIG_I2C_MUX_REG:drivers/i2c/muxes/i2c-mux-reg + +define KernelPackage/i2c-mux-reg + $(call i2c_defaults,$(I2C_MUX_REG_MODULES),51) + TITLE:=Register-based I2C mux/switches + DEPENDS:=+kmod-i2c-mux +endef + +define KernelPackage/i2c-mux-reg/description + Kernel modules for register-based I2C bus mux/switching devices +endef + +$(eval $(call KernelPackage,i2c-mux-reg)) + + I2C_MUX_PCA9541_MODULES:= \ CONFIG_I2C_MUX_PCA9541:drivers/i2c/muxes/i2c-mux-pca9541 diff --git a/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch new file mode 100644 index 0000000000..f025fea63b --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/988-ath10k-always-use-mac80211-loss-detection.patch @@ -0,0 +1,28 @@ +From f7d6edafe4358e3880a26775cfde4cd5c71ba063 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Wed, 5 Jul 2023 01:30:29 +0200 +Subject: [PATCH] ath10k: always use mac80211 loss detection + +ath10k does not report excessive loss in case of broken block-ack +sessions. The loss is communicated to the host-os, but ath10k does not +trigger a low-ack events by itself. + +The mac80211 framework for loss detection however detects this +circumstance well in case of ath10k. So use it regardless of ath10k's +own loss detection mechanism. + +Signed-off-by: David Bauer +--- + drivers/net/wireless/ath/ath10k/mac.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -10080,7 +10080,6 @@ int ath10k_mac_register(struct ath10k *a + ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); + ieee80211_hw_set(ar->hw, QUEUE_CONTROL); + ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); +- ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); + + if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) + ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); diff --git a/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch b/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch deleted file mode 100644 index e084773fd9..0000000000 --- a/package/kernel/mac80211/patches/subsys/340-mac80211-always-use-mac80211-loss-detection.patch +++ /dev/null @@ -1,36 +0,0 @@ -From cdf461888f900c3a149b10a04d72b4a590ecdec3 Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Tue, 16 May 2023 23:11:32 +0200 -Subject: [PATCH] mac80211: always use mac80211 loss detection - -ath10k does not report excessive loss in case of broken block-ack -sessions. The loss is communicated to the host-os, but ath10k does not -trigger a low-ack events by itself. - -The mac80211 framework for loss detection however detects this -circumstance well in case of ath10k. So use it regardless of ath10k's -own loss detection mechanism. - -Patching this in mac80211 does allow this hack to be used with any -flavor of ath10k/ath11k. - -Signed-off-by: David Bauer ---- - net/mac80211/status.c | 6 ------ - 1 file changed, 6 deletions(-) - ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -794,12 +794,6 @@ static void ieee80211_lost_packet(struct - unsigned long pkt_time = STA_LOST_PKT_TIME; - unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD; - -- /* If driver relies on its own algorithm for station kickout, skip -- * mac80211 packet loss mechanism. -- */ -- if (ieee80211_hw_check(&sta->local->hw, REPORTS_LOW_ACK)) -- return; -- - /* This packet was aggregated but doesn't carry status info */ - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && - !(info->flags & IEEE80211_TX_STAT_AMPDU)) diff --git a/rules.mk b/rules.mk index 58c53705a2..ca27583d27 100644 --- a/rules.mk +++ b/rules.mk @@ -211,6 +211,10 @@ ifndef DUMP endif endif endif + +TARGET_LINKER?=bfd +TARGET_LDFLAGS+= -fuse-ld=$(TARGET_LINKER) + TARGET_PATH_PKG:=$(STAGING_DIR)/host/bin:$(STAGING_DIR_HOSTPKG)/bin:$(TARGET_PATH) ifeq ($(CONFIG_SOFT_FLOAT),y) @@ -252,6 +256,7 @@ TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib TARGET_NM:=$(TARGET_CROSS)gcc-nm TARGET_CC:=$(TARGET_CROSS)gcc TARGET_CXX:=$(TARGET_CROSS)g++ +TARGET_LD:=$(TARGET_CROSS)ld.$(TARGET_LINKER) KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh FILECMD:=$(STAGING_DIR_HOST)/bin/file SED:=$(STAGING_DIR_HOST)/bin/sed -i -e @@ -305,7 +310,7 @@ endif TARGET_CONFIGURE_OPTS = \ AR="$(TARGET_AR)" \ AS="$(TARGET_CC) -c $(TARGET_ASFLAGS)" \ - LD=$(TARGET_CROSS)ld \ + LD="$(TARGET_LD)" \ NM="$(TARGET_NM)" \ CC="$(TARGET_CC)" \ GCC="$(TARGET_CC)" \ @@ -325,7 +330,7 @@ else STRIP:=$(TARGET_CROSS)strip $(call qstrip,$(CONFIG_STRIP_ARGS)) else ifneq ($(CONFIG_USE_SSTRIP),) - STRIP:=$(STAGING_DIR_HOST)/bin/sstrip $(call qstrip,$(CONFIG_SSTRIP_ARGS)) + STRIP:=$(STAGING_DIR_HOST)/bin/sstrip $(if $(CONFIG_SSTRIP_DISCARD_TRAILING_ZEROES),-z) endif endif RSTRIP= \ diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index b9e9e478d9..f15463ae8c 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1169,7 +1169,7 @@ TARGET_DEVICES += zte_mf287plus define Device/zte_mf289f $(call Device/zte_mf28x_common) DEVICE_MODEL := MF289F - DEVICE_PACKAGES += ath10k-firmware-qca9984-ct + DEVICE_PACKAGES += ipq-wifi-zte_mf289f ath10k-firmware-qca9984-ct endef TARGET_DEVICES += zte_mf289f diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15 index d1ada5c2f5..d80706338b 100644 --- a/target/linux/x86/64/config-5.15 +++ b/target/linux/x86/64/config-5.15 @@ -334,7 +334,7 @@ CONFIG_NR_CPUS_DEFAULT=64 CONFIG_NR_CPUS_RANGE_BEGIN=2 CONFIG_NR_CPUS_RANGE_END=512 CONFIG_NVME_CORE=y -# CONFIG_NVME_HWMON is not set +CONFIG_NVME_HWMON=y CONFIG_NVME_MULTIPATH=y CONFIG_OUTPUT_FORMAT="elf64-x86-64" CONFIG_PADATA=y diff --git a/toolchain/Makefile b/toolchain/Makefile index c0046293c9..09c16f72a7 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -27,7 +27,7 @@ curdir:=toolchain # subdirectories to descend into -$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers) $(if $(CONFIG_NASM),nasm) +$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers) $(if $(CONFIG_NASM),nasm) $(if $(CONFIG_USE_MOLD),mold) # builddir dependencies ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) diff --git a/toolchain/mold/Makefile b/toolchain/mold/Makefile new file mode 100644 index 0000000000..a2acba89d3 --- /dev/null +++ b/toolchain/mold/Makefile @@ -0,0 +1,22 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/toolchain-build.mk + +define Host/Configure +endef + +define Host/Compile +endef + +define Host/Install + $(INSTALL_DIR) $(TOOLCHAIN_DIR)/bin + $(INSTALL_BIN) $(STAGING_DIR_HOST)/bin/mold $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-ld.mold +endef + +define Host/Clean +endef + +$(eval $(call HostBuild)) diff --git a/tools/Makefile b/tools/Makefile index c3a9f77747..7c231bd088 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -84,6 +84,7 @@ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_tegra),y) += cbootimage tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += kernel2minor tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_SPARSE),y) += sparse tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_MOLD),y) += mold # builddir dependencies $(curdir)/autoconf/compile := $(curdir)/m4/compile @@ -116,6 +117,7 @@ $(curdir)/meson/compile := $(curdir)/ninja/compile $(curdir)/missing-macros/compile := $(curdir)/autoconf/compile $(curdir)/mkimage/compile += $(curdir)/bison/compile $(curdir)/libressl/compile $(curdir)/mklibs/compile := $(curdir)/libtool/compile +$(curdir)/mold/compile := $(curdir)/cmake/compile $(curdir)/zlib/compile $(curdir)/zstd/compile $(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile $(curdir)/mpfr/compile := $(curdir)/gmp/compile $(curdir)/mtd-utils/compile := $(curdir)/libtool/compile $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile diff --git a/tools/meson/Makefile b/tools/meson/Makefile index b115e0802b..f957bfb49f 100644 --- a/tools/meson/Makefile +++ b/tools/meson/Makefile @@ -2,6 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=meson PKG_VERSION:=1.1.1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/mesonbuild/meson/releases/download/$(PKG_VERSION) diff --git a/tools/meson/files/openwrt-cross.txt.in b/tools/meson/files/openwrt-cross.txt.in index ec4b027f1b..ba11915069 100644 --- a/tools/meson/files/openwrt-cross.txt.in +++ b/tools/meson/files/openwrt-cross.txt.in @@ -1,6 +1,8 @@ [binaries] c = [@CC@] +c_ld = [@LD@] cpp = [@CXX@] +cpp_ld = [@LD@] ar = '@AR@' strip = '@STRIP@' nm = '@NM@' diff --git a/tools/mold/Makefile b/tools/mold/Makefile new file mode 100644 index 0000000000..e8fcecbfed --- /dev/null +++ b/tools/mold/Makefile @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0-only + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mold +PKG_VERSION:=1.11.0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL_FILE:=v$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/rui314/mold/archive/refs/tags +PKG_HASH:=99318eced81b09a77e4c657011076cc8ec3d4b6867bd324b8677974545bc4d6f + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_HOST_OPTIONS += \ + -DMOLD_LTO=ON \ + -DMOLD_MOSTLY_STATIC=ON \ + -DMOLD_USE_SYSTEM_MIMALLOC=OFF \ + -DMOLD_USE_SYSTEM_TBB=OFF + +$(eval $(call HostBuild))