diff --git a/.devcontainer/ci-env/devcontainer.json b/.devcontainer/ci-env/devcontainer.json new file mode 100644 index 0000000000..23b0555e66 --- /dev/null +++ b/.devcontainer/ci-env/devcontainer.json @@ -0,0 +1,12 @@ +{ + "name": "CI build container", + "image": "ghcr.io/openwrt/buildbot/buildworker-v3.8.0:v9", + "features": { + }, + "remoteUser": "buildbot", + "customizations": { + "vscode": { + "extensions": ["ms-vscode.cpptools", "plorefice.devicetree"] + } + } +} diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index da24cbabac..cfc9d6e7a6 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -128,6 +128,7 @@ xiaomi,redmi-router-ac2100) zyxel,lte3301-plus) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x80000" ;; +zyxel,lte5398-m904|\ zyxel,nr7101) idx="$(find_mtd_index Config)" [ -n "$idx" ] && \ diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 055dca6818..face579472 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -1046,31 +1046,33 @@ define KernelPackage/zram/description endef define KernelPackage/zram/config - choice - prompt "ZRAM Default compressor" - default ZRAM_DEF_COMP_LZORLE + if PACKAGE_kmod-zram + choice + prompt "ZRAM Default compressor" + default ZRAM_DEF_COMP_LZORLE - config ZRAM_DEF_COMP_LZORLE + config ZRAM_DEF_COMP_LZORLE bool "lzo-rle" select PACKAGE_kmod-lib-lzo - config ZRAM_DEF_COMP_LZO + config ZRAM_DEF_COMP_LZO bool "lzo" select PACKAGE_kmod-lib-lzo - config ZRAM_DEF_COMP_LZ4 + config ZRAM_DEF_COMP_LZ4 bool "lz4" select PACKAGE_kmod-lib-lz4 - config ZRAM_DEF_COMP_LZ4HC + config ZRAM_DEF_COMP_LZ4HC bool "lz4-hc" select PACKAGE_kmod-lib-lz4hc - config ZRAM_DEF_COMP_ZSTD + config ZRAM_DEF_COMP_ZSTD bool "zstd" select PACKAGE_kmod-lib-zstd - endchoice + endchoice + endif endef $(eval $(call KernelPackage,zram)) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index c4d2214270..4e6d4c78cd 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -260,9 +260,14 @@ define KernelPackage/mt7986-firmware TITLE:=MediaTek MT7986 firmware endef -define KernelPackage/mt792x-firmware +define KernelPackage/mt7921-firmware $(KernelPackage/mt76-default) - TITLE:=MediaTek MT792x firmware + TITLE:=MediaTek MT7921 firmware +endef + +define KernelPackage/mt7922-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7922 firmware endef define KernelPackage/mt792x-common @@ -285,7 +290,7 @@ define KernelPackage/mt7921-common $(KernelPackage/mt76-default) TITLE:=MediaTek MT7921 wireless driver common code HIDDEN:=1 - DEPENDS+=+kmod-mt792x-common +kmod-mt792x-firmware +@DRIVER_11AX_SUPPORT +kmod-hwmon-core + DEPENDS+=+kmod-mt792x-common +kmod-mt7921-firmware +kmod-mt7922-firmware +@DRIVER_11AX_SUPPORT +kmod-hwmon-core FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921-common.ko endef @@ -592,11 +597,17 @@ define KernelPackage/mt7986-firmware/install $(1)/lib/firmware/mediatek endef -define KernelPackage/mt792x-firmware/install +define KernelPackage/mt7921-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/mediatek cp \ $(PKG_BUILD_DIR)/firmware/WIFI_MT7961_patch_mcu_1_2_hdr.bin \ $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7961_1.bin \ + $(1)/lib/firmware/mediatek +endef + +define KernelPackage/mt7922-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ $(PKG_BUILD_DIR)/firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin \ $(PKG_BUILD_DIR)/firmware/WIFI_RAM_CODE_MT7922_1.bin \ $(1)/lib/firmware/mediatek @@ -634,7 +645,8 @@ $(eval $(call KernelPackage,mt7915e)) $(eval $(call KernelPackage,mt7916-firmware)) $(eval $(call KernelPackage,mt7981-firmware)) $(eval $(call KernelPackage,mt7986-firmware)) -$(eval $(call KernelPackage,mt792x-firmware)) +$(eval $(call KernelPackage,mt7921-firmware)) +$(eval $(call KernelPackage,mt7922-firmware)) $(eval $(call KernelPackage,mt792x-common)) $(eval $(call KernelPackage,mt792x-usb)) $(eval $(call KernelPackage,mt7921-common)) diff --git a/package/libs/libselinux/Makefile b/package/libs/libselinux/Makefile index 816e09f30c..f90d4993c8 100644 --- a/package/libs/libselinux/Makefile +++ b/package/libs/libselinux/Makefile @@ -18,6 +18,8 @@ PKG_LICENSE_FILES:=LICENSE PKG_MAINTAINER:=Thomas Petazzoni PKG_CPE_ID:=cpe:/a:selinuxproject:libselinux +PKG_BUILD_FLAGS:=no-lto + HOST_BUILD_DEPENDS:=libsepol/host musl-fts/host pcre2/host include $(INCLUDE_DIR)/package.mk diff --git a/package/libs/libsepol/Makefile b/package/libs/libsepol/Makefile index 613d19388d..b1a34d293e 100644 --- a/package/libs/libsepol/Makefile +++ b/package/libs/libsepol/Makefile @@ -16,6 +16,8 @@ PKG_HASH:=78fdaf69924db780bac78546e43d9c44074bad798c2c415d0b9bb96d065ee8a2 PKG_MAINTAINER:=Thomas Petazzoni PKG_CPE_ID:=cpe:/a:selinuxproject:libsepol +PKG_BUILD_FLAGS:=no-lto + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 0d6d76fc08..aded1b7b1f 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -20,7 +20,7 @@ PKG_FIXUP:=autoreconf PKG_FLAGS:=nonshared PKG_INSTALL:=1 -PKG_BUILD_FLAGS:=gc-sections +PKG_BUILD_FLAGS:=gc-sections no-lto PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPL-2.0 PKG_CPE_ID:=cpe:/a:netfilter_core_team:iptables diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index e5add395ff..c6a14956fd 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -17,6 +17,8 @@ PKG_MIRROR_HASH:=5eddf584a1c3ed5637162d6bfc573ed1ce3691fcb38bdd55bf9f1e11e82ccc4 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 +PKG_BUILD_FLAGS:=no-lto + IWINFO_ABI_VERSION:=20230701 include $(INCLUDE_DIR)/package.mk diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile index 9496ffb366..46e7bb0dcd 100644 --- a/package/utils/lua/Makefile +++ b/package/utils/lua/Makefile @@ -21,6 +21,8 @@ PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYRIGHT PKG_CPE_ID:=cpe:/a:lua:lua +PKG_BUILD_FLAGS:=no-lto + HOST_PATCH_DIR := ./patches-host include $(INCLUDE_DIR)/package.mk diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts index b7ac902003..1b860dbf2d 100644 --- a/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts +++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7-v2.dts @@ -13,10 +13,11 @@ &keys { rfkill { + label = "rfkill"; gpios = <&gpio 23 GPIO_ACTIVE_LOW>; linux,code = ; linux,input-type = ; - debounce-interval = <60>; + debounce-interval = <1000>; }; }; diff --git a/target/linux/generic/hack-6.1/212-tools_portability.patch b/target/linux/generic/hack-6.1/212-tools_portability.patch index 4b1c6c4983..add281991e 100644 --- a/target/linux/generic/hack-6.1/212-tools_portability.patch +++ b/target/linux/generic/hack-6.1/212-tools_portability.patch @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau static inline uint16_t __get_unaligned_le16(const uint8_t *p) --- /dev/null +++ b/tools/include/tools/linux_types.h -@@ -0,0 +1,26 @@ +@@ -0,0 +1,18 @@ +#ifndef __LINUX_TYPES_H +#define __LINUX_TYPES_H + @@ -47,23 +47,15 @@ Signed-off-by: Felix Fietkau + +typedef int8_t __s8; +typedef uint8_t __u8; -+typedef uint8_t __be8; -+typedef uint8_t __le8; + +typedef int16_t __s16; +typedef uint16_t __u16; -+typedef uint16_t __be16; -+typedef uint16_t __le16; + +typedef int32_t __s32; +typedef uint32_t __u32; -+typedef uint32_t __be32; -+typedef uint32_t __le32; + +typedef int64_t __s64; +typedef uint64_t __u64; -+typedef uint64_t __be64; -+typedef uint64_t __le64; + +#endif --- a/tools/include/linux/types.h @@ -81,6 +73,16 @@ Signed-off-by: Felix Fietkau struct page; struct kmem_cache; +@@ -51,7 +55,9 @@ typedef __s8 s8; + #define __force + #define __user + #define __must_check ++#ifndef __cold + #define __cold ++#endif + + typedef __u16 __bitwise __le16; + typedef __u16 __bitwise __be16; --- a/tools/perf/pmu-events/jevents.py +++ b/tools/perf/pmu-events/jevents.py @@ -684,6 +684,7 @@ def main() -> None: @@ -91,3 +93,250 @@ Signed-off-by: Felix Fietkau #include struct compact_pmu_event { +--- a/tools/arch/x86/include/asm/insn.h ++++ b/tools/arch/x86/include/asm/insn.h +@@ -7,8 +7,8 @@ + * Copyright (C) IBM Corporation, 2009 + */ + +-#include + /* insn_attr_t is defined in inat.h */ ++#include + #include "inat.h" /* __ignore_sync_check__ */ + + #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) +--- a/tools/arch/x86/include/asm/orc_types.h ++++ b/tools/arch/x86/include/asm/orc_types.h +@@ -40,7 +40,6 @@ + #define ORC_REG_MAX 15 + + #ifndef __ASSEMBLY__ +-#include + + /* + * This struct is more or less a vastly simplified version of the DWARF Call +@@ -53,12 +52,12 @@ + struct orc_entry { + s16 sp_offset; + s16 bp_offset; +-#if defined(__LITTLE_ENDIAN_BITFIELD) ++#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned sp_reg:4; + unsigned bp_reg:4; + unsigned type:2; + unsigned end:1; +-#elif defined(__BIG_ENDIAN_BITFIELD) ++#elif __BYTE_ORDER == __BIG_ENDIAN + unsigned bp_reg:4; + unsigned sp_reg:4; + unsigned unused:5; +--- a/tools/arch/x86/lib/insn.c ++++ b/tools/arch/x86/lib/insn.c +@@ -15,7 +15,11 @@ + #include "../include/asm/insn.h" /* __ignore_sync_check__ */ + #include "../include/asm-generic/unaligned.h" /* __ignore_sync_check__ */ + ++#ifdef __KERNEL__ + #include ++#else ++#include ++#endif + #include + + #include "../include/asm/emulate_prefix.h" /* __ignore_sync_check__ */ +--- a/tools/include/asm-generic/bitops/fls.h ++++ b/tools/include/asm-generic/bitops/fls.h +@@ -2,6 +2,8 @@ + #ifndef _ASM_GENERIC_BITOPS_FLS_H_ + #define _ASM_GENERIC_BITOPS_FLS_H_ + ++#include ++ + /** + * fls - find last (most-significant) bit set + * @x: the word to search +@@ -10,7 +12,7 @@ + * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. + */ + +-static __always_inline int fls(unsigned int x) ++static __always_inline int __generic_fls(unsigned int x) + { + int r = 32; + +@@ -38,5 +40,6 @@ static __always_inline int fls(unsigned + } + return r; + } ++#define fls __generic_fls + + #endif /* _ASM_GENERIC_BITOPS_FLS_H_ */ +--- a/tools/include/asm-generic/bitsperlong.h ++++ b/tools/include/asm-generic/bitsperlong.h +@@ -4,11 +4,13 @@ + + #include + ++#ifndef BITS_PER_LONG + #ifdef __SIZEOF_LONG__ + #define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__) + #else + #define BITS_PER_LONG __WORDSIZE + #endif ++#endif + + #if BITS_PER_LONG != __BITS_PER_LONG + #error Inconsistent word size. Check asm/bitsperlong.h +--- a/tools/include/linux/rbtree.h ++++ b/tools/include/linux/rbtree.h +@@ -18,7 +18,6 @@ + #define __TOOLS_LINUX_PERF_RBTREE_H + + #include +-#include + + struct rb_node { + unsigned long __rb_parent_color; +--- a/tools/objtool/Makefile ++++ b/tools/objtool/Makefile +@@ -4,7 +4,7 @@ include ../scripts/Makefile.arch + + # always use the host compiler + AR = $(HOSTAR) +-CC = $(HOSTCC) ++CC = $(HOSTCC) $(HOST_EXTRACFLAGS) + LD = $(HOSTLD) + + ifeq ($(srctree),) +@@ -43,6 +43,7 @@ BUILD_ORC := n + + ifeq ($(SRCARCH),x86) + BUILD_ORC := y ++ CFLAGS += -DBUILD_ORC + endif + + export BUILD_ORC +--- a/tools/objtool/check.c ++++ b/tools/objtool/check.c +@@ -1164,11 +1164,12 @@ static int add_ignore_alternatives(struc + return 0; + } + ++#ifndef BUILD_ORC + /* + * Symbols that replace INSN_CALL_DYNAMIC, every (tail) call to such a symbol + * will be added to the .retpoline_sites section. + */ +-__weak bool arch_is_retpoline(struct symbol *sym) ++bool arch_is_retpoline(struct symbol *sym) + { + return false; + } +@@ -1177,7 +1178,7 @@ __weak bool arch_is_retpoline(struct sym + * Symbols that replace INSN_RETURN, every (tail) call to such a symbol + * will be added to the .return_sites section. + */ +-__weak bool arch_is_rethunk(struct symbol *sym) ++bool arch_is_rethunk(struct symbol *sym) + { + return false; + } +@@ -1186,10 +1187,11 @@ __weak bool arch_is_rethunk(struct symbo + * Symbols that are embedded inside other instructions, because sometimes crazy + * code exists. These are mostly ignored for validation purposes. + */ +-__weak bool arch_is_embedded_insn(struct symbol *sym) ++bool arch_is_embedded_insn(struct symbol *sym) + { + return false; + } ++#endif + + #define NEGATIVE_RELOC ((void *)-1L) + +--- a/tools/objtool/include/objtool/objtool.h ++++ b/tools/objtool/include/objtool/objtool.h +@@ -12,7 +12,9 @@ + + #include + ++#ifndef __weak + #define __weak __attribute__((weak)) ++#endif + + struct pv_state { + bool clean; +--- a/tools/objtool/orc_dump.c ++++ b/tools/objtool/orc_dump.c +@@ -5,10 +5,10 @@ + + #include + #include +-#include + #include + #include + #include ++#include + + static const char *reg_name(unsigned int reg) + { +--- a/tools/objtool/orc_gen.c ++++ b/tools/objtool/orc_gen.c +@@ -7,11 +7,11 @@ + #include + + #include +-#include + + #include + #include + #include ++#include + + static int init_orc_entry(struct orc_entry *orc, struct cfi_state *cfi, + struct instruction *insn) +--- a/tools/objtool/special.c ++++ b/tools/objtool/special.c +@@ -54,9 +54,11 @@ struct special_entry entries[] = { + {}, + }; + +-void __weak arch_handle_alternative(unsigned short feature, struct special_alt *alt) ++#ifndef BUILD_ORC ++void arch_handle_alternative(unsigned short feature, struct special_alt *alt) + { + } ++#endif + + static void reloc_to_sec_off(struct reloc *reloc, struct section **sec, + unsigned long *off) +--- a/tools/objtool/weak.c ++++ b/tools/objtool/weak.c +@@ -15,12 +15,14 @@ + return ENOSYS; \ + }) + +-int __weak orc_dump(const char *_objname) ++#ifndef BUILD_ORC ++int orc_dump(const char *_objname) + { + UNSUPPORTED("ORC"); + } + +-int __weak orc_create(struct objtool_file *file) ++int orc_create(struct objtool_file *file) + { + UNSUPPORTED("ORC"); + } ++#endif +--- a/tools/scripts/Makefile.include ++++ b/tools/scripts/Makefile.include +@@ -92,7 +92,7 @@ LLVM_OBJCOPY ?= llvm-objcopy + LLVM_STRIP ?= llvm-strip + + ifeq ($(CC_NO_CLANG), 1) +-EXTRA_WARNINGS += -Wstrict-aliasing=3 ++# EXTRA_WARNINGS += -Wstrict-aliasing=3 + + else ifneq ($(CROSS_COMPILE),) + # Allow userspace to override CLANG_CROSS_FLAGS to specify their own diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts index ef22a6639d..3f3ed3313f 100644 --- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts +++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts @@ -70,7 +70,7 @@ ðernet { pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins &mdio_pins>; + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; nvmem-cells = <&macaddr_factory_4>; nvmem-cell-names = "mac-address"; @@ -93,6 +93,10 @@ }; }; +&gsw { + mediatek,ephy-base = /bits/ 8 <12>; +}; + &pcie { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts new file mode 100644 index 0000000000..d6f00d9edc --- /dev/null +++ b/target/linux/ramips/dts/mt7621_zyxel_lte5398-m904.dts @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "zyxel,lte5398-m904", "mediatek,mt7621-soc"; + model = "ZyXEL LTE5398-M904"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_power_green; + led-failsafe = &led_power_green; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "green:power"; + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + }; + + power_blue { + label = "blue:power"; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "usbport"; + trigger-sources = <&ehci_port2>; + }; + + internet { + label = "green:internet"; + gpios = <&gpio 23 GPIO_ACTIVE_HIGH>; + }; + + wifi { + label = "green:wifi"; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + voice { + label = "green:voice"; + gpios = <&gpio 25 GPIO_ACTIVE_HIGH>; + }; + + lte_green { + label = "green:lte"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + + lte_orange { + label = "orange:lte"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + + lte_red { + label = "red:lte"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + lte_power { + gpio-export,name = "lte_power"; + gpio-export,output = <0>; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + + usb_power { + gpio-export,name = "usb_power"; + gpio-export,output = <1>; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "Config"; + reg = <0x80000 0x80000>; + }; + + factory: partition@100000 { + compatible = "nvmem-cells"; + label = "Factory"; + reg = <0x100000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; + read-only; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x400>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x4da8>; + }; + + macaddr_factory_fe6e: macaddr@fe6e { + reg = <0xfe6e 0x6>; + }; + }; + + partition@140000 { + label = "Kernel"; + reg = <0x140000 0x1ec0000>; + }; + + partition@540000 { + label = "ubi"; + reg = <0x540000 0x1ac0000>; + }; + + partition@2140000 { + label = "Kernel2"; + reg = <0x2140000 0x1ec0000>; + }; + + partition@4000000 { + label = "wwan"; + reg = <0x4000000 0x100000>; + }; + + partition@4100000 { + label = "data"; + reg = <0x4100000 0x1000000>; + }; + + partition@5100000 { + label = "rom-d"; + reg = <0x5100000 0x100000>; + read-only; + }; + + partition@5200000 { + label = "reserve"; + reg = <0x5200000 0x80000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&state_default { + gpio { + groups = "i2c", "rgmii2", "uart3", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_fe6e>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + port@2 { + status = "okay"; + label = "lan2"; + }; + }; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom_factory_8000>; + nvmem-cell-names = "eeprom"; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 58e07c3a47..0b245a080e 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -587,7 +587,7 @@ define Device/hiwifi_hc5861 DEVICE_VENDOR := HiWiFi DEVICE_MODEL := HC5861 DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci kmod-sdhci-mt7620 \ - kmod-usb-ledtrig-usbport + kmod-phy-realtek kmod-usb-ledtrig-usbport SUPPORTED_DEVICES += hc5861 endef TARGET_DEVICES += hiwifi_hc5861 diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 039483308b..8326205b56 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -3012,6 +3012,21 @@ define Device/zyxel_lte3301-plus endef TARGET_DEVICES += zyxel_lte3301-plus +define Device/zyxel_lte5398-m904 + $(Device/nand) + DEVICE_VENDOR := ZyXEL + DEVICE_MODEL := LTE5398-M904 + KERNEL_SIZE := 31488k + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 uqmi \ + kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb-ledtrig-usbport + KERNEL := $(KERNEL_DTB) | uImage lzma | \ + zytrx-header $$(DEVICE_MODEL) $$(VERSION_DIST)-$$(REVISION) + KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma | \ + zytrx-header $$(DEVICE_MODEL) 9.99(ABQU.1)$$(VERSION_DIST)-recovery + KERNEL_INITRAMFS_SUFFIX := -recovery.bin +endef +TARGET_DEVICES += zyxel_lte5398-m904 + define Device/zyxel_nr7101 $(Device/nand) DEVICE_VENDOR := ZyXEL diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 1018228ac9..402a04eb79 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -252,6 +252,9 @@ zte,e8820s) zyxel,lte3301-plus) ucidef_set_led_netdev "internet" "internet" "white:internet" "wwan0" ;; +zyxel,lte5398-m904) + ucidef_set_led_netdev "internet" "LTE/3G Internet Activity" "green:internet" "wwan0" "rx tx" + ;; esac board_config_flush diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 4ffe1d8127..4596c53b07 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -150,6 +150,10 @@ ramips_setup_interfaces() ubnt,usw-flex) ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5" ;; + zyxel,lte5398-m904) + ucidef_set_interface_lan "lan1 lan2" + ucidef_set_interface "wan" device "/dev/cdc-wdm0" protocol "qmi" + ;; zyxel,wap6805) ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches index aebb416371..22cf272429 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches @@ -29,7 +29,8 @@ ubnt,edgerouter-x-sfp) ucidef_add_gpio_switch "poe_power_port3" "PoE Power Port3" "403" ucidef_add_gpio_switch "poe_power_port4" "PoE Power Port4" "404" ;; -zyxel,lte3301-plus) +zyxel,lte3301-plus|\ +zyxel,lte5398-m904) ucidef_add_gpio_switch "usb_power" "Power USB Port" "usb_power" "1" ucidef_add_gpio_switch "lte_power" "Power LTE modem" "lte_power" "1" ;; diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index 9db700bff5..c558247341 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -34,6 +34,7 @@ boot() { [ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1 [ $(printf %d $(fw_printenv -n Image1Try)) -gt 0 ] && fw_setenv Image1Try 0 ;; + zyxel,lte5398-m904|\ zyxel,nr7101) [ $(printf %d $(fw_printenv -n DebugFlag)) -gt 0 ] || fw_setenv DebugFlag 0x1 [ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1 diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 3629e64851..636fc41637 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -150,6 +150,7 @@ platform_do_upgrade() { platform_upgrade_ubnt_erx "$1" ;; zyxel,lte3301-plus|\ + zyxel,lte5398-m904|\ zyxel,nr7101) fw_setenv CheckBypass 0 fw_setenv Image1Stable 0 diff --git a/tools/Makefile b/tools/Makefile index 7c231bd088..84e3502cba 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -39,6 +39,7 @@ tools-y += cmake tools-y += cpio tools-y += dosfstools tools-y += e2fsprogs +tools-y += elfutils tools-y += expat tools-y += fakeroot tools-y += findutils @@ -96,6 +97,7 @@ $(curdir)/cbootimage/compile += $(curdir)/automake/compile $(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(curdir)/expat/compile $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile $(curdir)/dosfstools/compile := $(curdir)/automake/compile $(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile +$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile $(curdir)/gnulib/compile $(curdir)/libtool/compile $(curdir)/fakeroot/compile := $(curdir)/libtool/compile $(curdir)/findutils/compile := $(curdir)/bison/compile $(curdir)/firmware-utils/compile += $(curdir)/cmake/compile @@ -139,9 +141,7 @@ ifeq ($(HOST_OS),Darwin) tools-y += bash else $(curdir)/dwarves/compile += $(curdir)/elfutils/compile - $(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_DWARVES),y) += dwarves - tools-y += elfutils endif ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),) diff --git a/tools/elfutils/Makefile b/tools/elfutils/Makefile index f9c6272719..2605bc61cb 100644 --- a/tools/elfutils/Makefile +++ b/tools/elfutils/Makefile @@ -19,16 +19,32 @@ PKG_INSTALL:=1 include $(INCLUDE_DIR)/host-build.mk +ifeq ($(HOST_OS),Darwin) + HOST_CFLAGS += -I/opt/homebrew/include +endif + +HOST_CFLAGS += -Wno-error + HOST_CONFIGURE_ARGS += \ + --without-libintl-prefix \ + --without-libiconv-prefix \ --disable-debuginfod \ --disable-libdebuginfod \ --disable-nls \ --disable-shared \ + --enable-static \ --without-lzma \ --without-zstd -HOST_MAKE_FLAGS += \ - SUBDIRS="lib libelf libcpu backends libebl libdwelf libdwfl libdw" +ifeq ($(HOST_OS),Darwin) + HOST_CONFIGURE_ARGS += --disable-symbol-versioning +endif + +Hooks/HostConfigure/Pre := Host/Gnulib $(Hooks/HostConfigure/Pre) +define Host/Gnulib + cd $(HOST_BUILD_DIR); $(STAGING_DIR_HOST)/bin/gnulib-tool --libtool --source-base=libgnu --import argp obstack fts strchrnul progname tsearch; + ln -sf ../lib/eu-config.h $(HOST_BUILD_DIR)/libgnu/; +endef define Host/Uninstall -$(call Host/Compile/Default,uninstall) diff --git a/tools/elfutils/patches/100-portability.patch b/tools/elfutils/patches/100-portability.patch new file mode 100644 index 0000000000..a0c7d74bb3 --- /dev/null +++ b/tools/elfutils/patches/100-portability.patch @@ -0,0 +1,910 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -20,6 +20,7 @@ dnl You should have received a copy of + dnl along with this program. If not, see . + AC_INIT([elfutils],[0.189],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/]) + ++AC_CONFIG_MACRO_DIRS([m4]) + dnl Workaround for older autoconf < 2.64 + m4_ifndef([AC_PACKAGE_URL], + [AC_DEFINE([PACKAGE_URL], ["http://elfutils.org/"], +@@ -43,16 +44,17 @@ elif test "x$program_prefix" = "x"; then + fi + + AC_CONFIG_AUX_DIR([config]) +-AC_CONFIG_FILES([config/Makefile]) ++AC_CONFIG_FILES([config/Makefile libgnu/Makefile]) + + AC_COPYRIGHT([Copyright (C) 1996-2023 The elfutils developers.]) +-AC_PREREQ(2.63) dnl Minimum Autoconf version required. ++AC_PREREQ(2.64) dnl Minimum Autoconf version required. + + dnl We use GNU make extensions; automake 1.10 defaults to -Wportability. + AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests]) + AM_MAINTAINER_MODE + + AM_SILENT_RULES([yes]) ++AC_USE_SYSTEM_EXTENSIONS() + + AC_CONFIG_SRCDIR([libelf/libelf.h]) + AC_CONFIG_FILES([Makefile]) +@@ -89,12 +91,14 @@ AS_IF([test "$use_locks" = yes], + AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.]) + + m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99]) ++gl_EARLY ++gl_INIT + AC_PROG_CXX +-AC_PROG_RANLIB + AC_PROG_YACC + AC_PROG_LEX([noyywrap]) + # Only available since automake 1.12 + m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) ++LT_INIT() + AC_CHECK_TOOL([READELF], [readelf]) + AC_CHECK_TOOL([NM], [nm]) + +@@ -195,7 +199,6 @@ AC_CACHE_CHECK([whether the compiler gen + AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ac_cv_buildid=yes; $READELF -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no],AC_MSG_FAILURE([unexpected compile failure]))]) + if test "$ac_cv_buildid" = "no"; then + AC_MSG_WARN([compiler doesn't generate build-id by default]) +- LDFLAGS="$LDFLAGS -Wl,--build-id" + fi + + ZRELRO_LDFLAGS="-Wl,-z,relro" +@@ -635,36 +638,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], + CFLAGS="$old_CFLAGS"]) + AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig") + +-saved_LIBS="$LIBS" +-AC_SEARCH_LIBS([argp_parse], [argp]) +-LIBS="$saved_LIBS" +-case "$ac_cv_search_argp_parse" in +- no) AC_MSG_FAILURE([failed to find argp_parse]) ;; +- -l*) argp_LDADD="$ac_cv_search_argp_parse" ;; +- *) argp_LDADD= ;; +-esac +-AC_SUBST([argp_LDADD]) +- +-saved_LIBS="$LIBS" +-AC_SEARCH_LIBS([fts_close], [fts]) +-LIBS="$saved_LIBS" +-case "$ac_cv_search_fts_close" in +- no) AC_MSG_FAILURE([failed to find fts_close]) ;; +- -l*) fts_LIBS="$ac_cv_search_fts_close" ;; +- *) fts_LIBS= ;; +-esac +-AC_SUBST([fts_LIBS]) +- +-saved_LIBS="$LIBS" +-AC_SEARCH_LIBS([_obstack_free], [obstack]) +-LIBS="$saved_LIBS" +-case "$ac_cv_search__obstack_free" in +- no) AC_MSG_FAILURE([failed to find _obstack_free]) ;; +- -l*) obstack_LIBS="$ac_cv_search__obstack_free" ;; +- *) obstack_LIBS= ;; +-esac +-AC_SUBST([obstack_LIBS]) +- + dnl The directories with content. + + dnl Documentation. +--- a/Makefile.am ++++ b/Makefile.am +@@ -26,11 +26,11 @@ AM_MAKEFLAGS = --no-print-directory + + pkginclude_HEADERS = version.h + +-SUBDIRS = config lib libelf libcpu backends libebl libdwelf libdwfl libdw \ +- libasm debuginfod src po doc tests ++SUBDIRS = libgnu config lib libelf libcpu backends libebl libdwelf libdwfl libdw + + EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \ +- COPYING COPYING-GPLV2 COPYING-LGPLV3 ++ COPYING COPYING-GPLV2 COPYING-LGPLV3 \ ++ m4/gnulib-cache.m4 + + # Make sure the test install uses lib64 when $LIB will yield lib64. + # Make sure the test build uses the same compiler, which on e.g. ppc64 +--- a/libelf/elf_update.c ++++ b/libelf/elf_update.c +@@ -37,6 +37,33 @@ + + #include "libelfP.h" + ++#include "elf_fill.c" ++ ++#ifdef __APPLE__ ++static int posix_fallocate(int fd, off_t offset, off_t len) ++{ ++ off_t c_test; ++ int ret; ++ if (!__builtin_saddll_overflow(offset, len, &c_test)) { ++ fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, offset + len, 0}; ++ // Try to get a continuous chunk of disk space ++ ret = fcntl(fd, F_PREALLOCATE, &store); ++ if (ret < 0) { ++ // OK, perhaps we are too fragmented, allocate non-continuous ++ store.fst_flags = F_ALLOCATEALL; ++ ret = fcntl(fd, F_PREALLOCATE, &store); ++ if (ret < 0) { ++ return ret; ++ } ++ } ++ ret = ftruncate(fd, offset + len); ++ } else { ++ // offset+len would overflow. ++ ret = -1; ++ } ++ return ret; ++} ++#endif + + static int64_t + write_file (Elf *elf, int64_t size, int change_bo, size_t shnum) +--- a/lib/eu-config.h ++++ b/lib/eu-config.h +@@ -52,14 +52,18 @@ + # define rwlock_unlock(lock) ((void) (lock)) + #endif /* USE_LOCKS */ + +-#include ++#include + /* gettext helper macros. */ + #define N_(Str) Str + #define _(Str) dgettext ("elfutils", Str) + + /* Compiler-specific definitions. */ ++#ifdef __APPLE__ ++#define strong_alias(name, aliasname) ++#else + #define strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); ++#endif + + #ifdef __i386__ + # define internal_function __attribute__ ((regparm (3), stdcall)) +@@ -70,12 +74,7 @@ + #define internal_strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function; + +-#ifdef HAVE_VISIBILITY +-#define attribute_hidden \ +- __attribute__ ((visibility ("hidden"))) +-#else + #define attribute_hidden /* empty */ +-#endif + + #ifdef HAVE_GCC_STRUCT + #define attribute_packed \ +@@ -159,7 +158,7 @@ asm (".section predict_data, \"aw\"; .pr + #endif + + /* Avoid PLT entries. */ +-#ifdef PIC ++#if defined(PIC) && !defined(__APPLE__) + # define INTUSE(name) _INTUSE(name) + # define _INTUSE(name) __##name##_internal + # define INTDEF(name) _INTDEF(name) +--- a/config/eu.am ++++ b/config/eu.am +@@ -31,7 +31,7 @@ + ## + + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' +-AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. ++AM_CPPFLAGS = -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. + + # Drop the 'u' flag that automake adds by default. It is incompatible + # with deterministic archives. +--- a/libelf/Makefile.am ++++ b/libelf/Makefile.am +@@ -34,9 +34,7 @@ endif + + VERSION = 1 + +-lib_LIBRARIES = libelf.a +-noinst_LIBRARIES = libelf_pic.a +-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so) ++lib_LTLIBRARIES = libelf.la + include_HEADERS = libelf.h gelf.h nlist.h + + noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \ +@@ -51,7 +49,8 @@ endif + + pkginclude_HEADERS = elf-knowledge.h + +-libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ ++libelf_la_LIBADD = ../libgnu/libgnu.la ../lib/libeu.la -lz $(zstd_LIBS) -lpthread ++libelf_la_SOURCES = elf_version.c elf_hash.c elf_error.c \ + elf_begin.c elf_next.c elf_rand.c elf_end.c elf_kind.c \ + gelf_getclass.c elf_getbase.c elf_getident.c \ + elf32_fsize.c elf64_fsize.c gelf_fsize.c \ +@@ -102,37 +101,9 @@ libelf_a_SOURCES = elf_version.c elf_has + elf32_getchdr.c elf64_getchdr.c gelf_getchdr.c \ + elf_compress.c elf_compress_gnu.c + +-libelf_pic_a_SOURCES = +-am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os) +- +-libelf_so_DEPS = ../lib/libeu.a +-libelf_so_LDLIBS = $(libelf_so_DEPS) -lz $(zstd_LIBS) +-if USE_LOCKS +-libelf_so_LDLIBS += -lpthread +-endif +- +-libelf_so_LIBS = libelf_pic.a +-libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS) +- $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ +- -Wl,--soname,$@.$(VERSION) \ +- -Wl,--version-script,$< \ +- $(NO_UNDEFINED) \ +- -Wl,--whole-archive $(libelf_so_LIBS) -Wl,--no-whole-archive \ +- $(libelf_so_LDLIBS) +- @$(textrel_check) +- $(AM_V_at)ln -fs $@ $@.$(VERSION) +- +-install: install-am libelf.so ++install: install-am + $(mkinstalldirs) $(DESTDIR)$(libdir) +- $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so +- ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION) +- ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so + + uninstall: uninstall-am +- rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so +- rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION) +- rm -f $(DESTDIR)$(libdir)/libelf.so + + EXTRA_DIST = libelf.map +- +-CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so libelf.so.$(VERSION) +--- a/backends/i386_auxv.c ++++ b/backends/i386_auxv.c +@@ -48,5 +48,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c + return 1; + } + +-__typeof (i386_auxv_info) x86_64_auxv_info +- __attribute__ ((alias ("i386_auxv_info"))); ++auxv_info_alias(x86_64) +--- a/backends/ppc_regs.c ++++ b/backends/ppc_regs.c +@@ -204,5 +204,11 @@ ppc_register_info (Ebl *ebl __attribute_ + return namelen; + } + +-__typeof (ppc_register_info) +- ppc64_register_info __attribute__ ((alias ("ppc_register_info"))); ++ssize_t ++ppc64_register_info (Ebl *ebl, ++ int regno, char *name, size_t namelen, ++ const char **prefix, const char **setname, ++ int *bits, int *type) ++{ ++ return ppc_register_info(ebl, regno, name, namelen, prefix, setname, bits, type); ++} +--- a/backends/libebl_CPU.h ++++ b/backends/libebl_CPU.h +@@ -97,4 +97,10 @@ dwarf_is_pointer (int tag) + case DW_TAG_reference_type: \ + case DW_TAG_rvalue_reference_type + ++#define auxv_info_alias(arch) \ ++ int EBLHOOK_1(arch, auxv_info) (GElf_Xword a_type, const char **name, const char **format) \ ++ { \ ++ return EBLHOOK(auxv_info)(a_type, name, format); \ ++ } ++ + #endif /* libebl_CPU.h */ +--- a/backends/ppc_auxv.c ++++ b/backends/ppc_auxv.c +@@ -51,5 +51,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c + return 1; + } + +-__typeof (ppc_auxv_info) ppc64_auxv_info +- __attribute__ ((alias ("ppc_auxv_info"))); ++auxv_info_alias(ppc64) +--- a/backends/ppc_cfi.c ++++ b/backends/ppc_cfi.c +@@ -72,6 +72,7 @@ ppc_abi_cfi (Ebl *ebl __attribute__ ((un + return 0; + } + +-__typeof (ppc_abi_cfi) +- ppc64_abi_cfi +- __attribute__ ((alias ("ppc_abi_cfi"))); ++int ppc64_abi_cfi(Ebl *ebl, Dwarf_CIE *abi_info) ++{ ++ return ppc_abi_cfi(ebl, abi_info); ++} +--- a/backends/ppc_initreg.c ++++ b/backends/ppc_initreg.c +@@ -68,9 +68,10 @@ ppc_dwarf_to_regno (Ebl *ebl __attribute + abort (); + } + +-__typeof (ppc_dwarf_to_regno) +- ppc64_dwarf_to_regno +- __attribute__ ((alias ("ppc_dwarf_to_regno"))); ++bool ppc64_dwarf_to_regno (Ebl *ebl, unsigned *regno) ++{ ++ return ppc_dwarf_to_regno(ebl, regno); ++} + + bool + ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), +@@ -127,6 +128,7 @@ ppc_set_initial_registers_tid (pid_t tid + #endif /* __powerpc__ */ + } + +-__typeof (ppc_set_initial_registers_tid) +- ppc64_set_initial_registers_tid +- __attribute__ ((alias ("ppc_set_initial_registers_tid"))); ++bool ppc64_set_initial_registers_tid(pid_t tid, ebl_tid_registers_t *setfunc, void *arg) ++{ ++ return ppc_set_initial_registers_tid(tid, setfunc, arg); ++} +--- a/backends/ppc_attrs.c ++++ b/backends/ppc_attrs.c +@@ -81,6 +81,9 @@ ppc_check_object_attribute (Ebl *ebl __a + return false; + } + +-__typeof (ppc_check_object_attribute) +- ppc64_check_object_attribute +- __attribute__ ((alias ("ppc_check_object_attribute"))); ++bool ppc64_check_object_attribute(Ebl *ebl, ++ const char *vendor, int tag, uint64_t value, ++ const char **tag_name, const char **value_name) ++{ ++ return ppc_check_object_attribute(ebl, vendor, tag, value, tag_name, value_name); ++} +--- a/lib/libeu.h ++++ b/lib/libeu.h +@@ -45,4 +45,11 @@ extern char *xasprintf(const char *fmt, + extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len); + extern int crc32_file (int fd, uint32_t *resp); + ++#ifdef __APPLE__ ++static inline void tdestroy(void *root __attribute__ ((unused)), ++ void (*freekey)(void *) __attribute__ ((unused))) ++{ ++} ++#endif ++ + #endif +--- a/libdwfl/libdwflP.h ++++ b/libdwfl/libdwflP.h +@@ -31,6 +31,8 @@ + + #include + #include ++#include ++#include + #include + #include + #include +--- /dev/null ++++ b/lib/stdio_ext.h +@@ -0,0 +1,6 @@ ++#include ++#ifndef __APPLE__ ++#include_next ++#else ++#define __fsetlocking(...) 0 ++#endif +--- a/libdw/libdwP.h ++++ b/libdw/libdwP.h +@@ -32,8 +32,10 @@ + #include + #include + ++#include + #include + #include ++#include + + + /* Known location expressions already decoded. */ +--- a/libdw/Makefile.am ++++ b/libdw/Makefile.am +@@ -34,14 +34,12 @@ endif + AM_CPPFLAGS += -I$(srcdir)/../libebl -I$(srcdir)/../libelf -I$(srcdir)/../libdwelf -pthread + VERSION = 1 + +-lib_LIBRARIES = libdw.a +-noinst_LIBRARIES = libdw_pic.a +-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so) ++lib_LTLIBRARIES = libdw.la + + include_HEADERS = dwarf.h + pkginclude_HEADERS = libdw.h known-dwarf.h + +-libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ ++libdw_la_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ + dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \ + dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \ + dwarf_attr.c dwarf_formstring.c \ +@@ -103,50 +101,12 @@ $(srcdir)/known-dwarf.h: $(top_srcdir)/c + mv -f $@.new $@ + endif + +-libdw_pic_a_SOURCES = +-am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) +- +-libdw_so_LIBS = ../libebl/libebl_pic.a ../backends/libebl_backends_pic.a \ +- ../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \ +- ../libdwfl/libdwfl_pic.a +-libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so +-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_LIBS) $(zip_LIBS) -pthread +-libdw.so: $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS) +- $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ +- -Wl,--soname,$@.$(VERSION),--enable-new-dtags \ +- -Wl,--version-script,$< \ +- $(NO_UNDEFINED) \ +- -Wl,--whole-archive $(libdw_so_LIBS) -Wl,--no-whole-archive \ +- $(libdw_so_LDLIBS) +- @$(textrel_check) +- $(AM_V_at)ln -fs $@ $@.$(VERSION) +- +-install: install-am libdw.so +- $(mkinstalldirs) $(DESTDIR)$(libdir) +- $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so +- ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION) +- ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so +- +-uninstall: uninstall-am +- rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so +- rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION) +- rm -f $(DESTDIR)$(libdir)/libdw.so +- rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils +- +-libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a) +-libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects)) +- +-libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a) +-libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects)) +- +-libebl_objects = $(shell $(AR) t ../libebl/libebl.a) +-libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects)) +- +-backends_objects = $(shell $(AR) t ../backends/libebl_backends.a) +-libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects)) +- +-libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a) +-libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects)) ++libdw_la_LIBADD = \ ++ ../libdwfl/libdwfl.la \ ++ ../libdwelf/libdwelf.la \ ++ ../libebl/libebl.la \ ++ ../backends/libebl_backends.la \ ++ ../libcpu/libcpu.la + + noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \ + dwarf_sig8_hash.h cfi.h encoded-value.h +--- a/libasm/Makefile.am ++++ b/libasm/Makefile.am +@@ -32,12 +32,10 @@ AM_CPPFLAGS += -I$(top_srcdir)/libelf -I + + VERSION = 1 + +-lib_LIBRARIES = libasm.a +-noinst_LIBRARIES = libasm_pic.a +-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so) ++lib_LTLIBRARIES = libasm.la + pkginclude_HEADERS = libasm.h + +-libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ ++libasm_la_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ + asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \ + asm_newsubscn.c asm_newsym.c asm_newcomsym.c \ + asm_newabssym.c \ +@@ -51,38 +49,6 @@ libasm_a_SOURCES = asm_begin.c asm_abort + disasm_begin.c disasm_cb.c disasm_end.c disasm_str.c \ + symbolhash.c + +-libasm_pic_a_SOURCES = +-am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os) +- +-libasm_so_DEPS = ../lib/libeu.a ../libebl/libebl_pic.a ../libelf/libelf.so ../libdw/libdw.so +-libasm_so_LDLIBS = $(libasm_so_DEPS) +-if USE_LOCKS +-libasm_so_LDLIBS += -lpthread +-endif +- +-libasm_so_LIBS = libasm_pic.a +-libasm.so: $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS) +- $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ +- -Wl,--soname,$@.$(VERSION) \ +- -Wl,--version-script,$< \ +- $(NO_UNDEFINED) \ +- -Wl,--whole-archive $(libasm_so_LIBS) -Wl,--no-whole-archive \ +- $(libasm_so_LDLIBS) +- @$(textrel_check) +- $(AM_V_at)ln -fs $@ $@.$(VERSION) +- +-install: install-am libasm.so +- $(mkinstalldirs) $(DESTDIR)$(libdir) +- $(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so +- ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION) +- ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so +- +-uninstall: uninstall-am +- rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so +- rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION) +- rm -f $(DESTDIR)$(libdir)/libasm.so +- rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils +- + noinst_HEADERS = libasmP.h symbolhash.h + EXTRA_DIST = libasm.map + +--- a/libdwfl/Makefile.am ++++ b/libdwfl/Makefile.am +@@ -34,13 +34,11 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/. + -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf -I$(builddir)/../debuginfod + VERSION = 1 + +-noinst_LIBRARIES = libdwfl.a +-noinst_LIBRARIES += libdwfl_pic.a ++noinst_LTLIBRARIES = libdwfl.la + + pkginclude_HEADERS = libdwfl.h + +- +-libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \ ++libdwfl_la_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \ + dwfl_module.c dwfl_report_elf.c relocate.c \ + dwfl_module_build_id.c dwfl_module_report_build_id.c \ + derelocate.c offline.c segment.c \ +@@ -73,24 +71,14 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en + gzip.c debuginfod-client.c + + if BZLIB +-libdwfl_a_SOURCES += bzip2.c ++libdwfl_la_SOURCES += bzip2.c + endif + if LZMA +-libdwfl_a_SOURCES += lzma.c ++libdwfl_la_SOURCES += lzma.c + endif + if ZSTD +-libdwfl_a_SOURCES += zstd.c ++libdwfl_la_SOURCES += zstd.c + endif + +-libdwfl = $(libdw) +-libdw = ../libdw/libdw.so +-libelf = ../libelf/libelf.so +-libebl = ../libebl/libebl.a +-libeu = ../lib/libeu.a +- +-libdwfl_pic_a_SOURCES = +-am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os) +- + noinst_HEADERS = libdwflP.h + +-CLEANFILES += $(am_libdwfl_pic_a_OBJECTS) +--- a/backends/Makefile.am ++++ b/backends/Makefile.am +@@ -34,7 +34,7 @@ endif + AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw + +-noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a ++noinst_LTLIBRARIES = libebl_backends.la + + modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \ + m68k bpf riscv csky loongarch arc +@@ -100,17 +100,13 @@ loongarch_SRCS = loongarch_init.c loonga + + arc_SRCS = arc_init.c arc_symbol.c + +-libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \ ++libebl_backends_la_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \ + $(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \ + $(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \ + $(ppc64_SRCS) $(s390_SRCS) \ + $(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \ + $(loongarch_SRCS) $(arc_SRCS) + +-libebl_backends_pic_a_SOURCES = +-am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os) + + noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c + EXTRA_DIST = $(modules:=_reloc.def) +- +-MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS) +--- a/libdwelf/Makefile.am ++++ b/libdwelf/Makefile.am +@@ -34,24 +34,12 @@ AM_CPPFLAGS += -I$(srcdir)/../libelf -I$ + -I$(srcdir)/../libdwfl -I$(srcdir)/../libebl + VERSION = 1 + +-noinst_LIBRARIES = libdwelf.a libdwelf_pic.a ++noinst_LTLIBRARIES = libdwelf.la + + pkginclude_HEADERS = libdwelf.h + noinst_HEADERS = libdwelfP.h + +-libdwelf_a_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \ ++libdwelf_la_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \ + dwelf_elf_gnu_build_id.c dwelf_scn_gnu_compressed_size.c \ + dwelf_strtab.c dwelf_elf_begin.c \ + dwelf_elf_e_machine_string.c +- +-libdwelf = $(libdw) +- +-libdw = ../libdw/libdw.so +-libelf = ../libelf/libelf.so +-libebl = ../libebl/libebl.a +-libeu = ../lib/libeu.a +- +-libdwelf_pic_a_SOURCES = +-am_libdwelf_pic_a_OBJECTS = $(libdwelf_a_SOURCES:.c=.os) +- +-CLEANFILES += $(am_libdwelf_pic_a_OBJECTS) +--- a/libebl/Makefile.am ++++ b/libebl/Makefile.am +@@ -34,9 +34,9 @@ endif + AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libdw -I$(srcdir)/../libasm + VERSION = 1 + +-noinst_LIBRARIES = libebl.a libebl_pic.a ++noinst_LTLIBRARIES = libebl.la + +-libebl_a_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \ ++libebl_la_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \ + eblsegmenttypename.c eblsectiontypename.c \ + eblmachineflagname.c eblsymboltypename.c \ + ebldynamictagname.c eblsectionname.c \ +@@ -56,9 +56,4 @@ libebl_a_SOURCES = eblopenbackend.c eblc + eblresolvesym.c eblcheckreloctargettype.c \ + ebl_data_marker_symbol.c + +-libebl_pic_a_SOURCES = +-am_libebl_pic_a_OBJECTS = $(libebl_a_SOURCES:.c=.os) +- + noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h +- +-MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS) +--- a/debuginfod/Makefile.am ++++ b/debuginfod/Makefile.am +@@ -40,23 +40,12 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/. + program_prefix= + program_transform_name = s,x,x, + +-if BUILD_STATIC +-libasm = ../libasm/libasm.a +-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread +-libelf = ../libelf/libelf.a -lz +-if DUMMY_LIBDEBUGINFOD +-libdebuginfod = ./libdebuginfod.a +-else +-libdebuginfod = ./libdebuginfod.a -lpthread $(libcurl_LIBS) +-endif +-else +-libasm = ../libasm/libasm.so +-libdw = ../libdw/libdw.so +-libelf = ../libelf/libelf.so +-libdebuginfod = ./libdebuginfod.so +-endif +-libebl = ../libebl/libebl.a +-libeu = ../lib/libeu.a ++libasm = ../libasm/libasm.la ++libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread ++libelf = ../libelf/libelf.la ++libdebuginfod = ./libdebuginfod.la ++libebl = ../libebl/libebl.la ++libeu = ../lib/libeu.la + + AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:. + +@@ -76,14 +65,10 @@ debuginfod_find_SOURCES = debuginfod-fin + debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS) + + if LIBDEBUGINFOD +-noinst_LIBRARIES = libdebuginfod.a +-noinst_LIBRARIES += libdebuginfod_pic.a ++libdebuginfod_la_SOURCES = debuginfod-client.c ++noinst_LTLIBRARIES = libdebuginfod.la + endif + +-libdebuginfod_a_SOURCES = debuginfod-client.c +-libdebuginfod_pic_a_SOURCES = debuginfod-client.c +-am_libdebuginfod_pic_a_OBJECTS = $(libdebuginfod_a_SOURCES:.c=.os) +- + if DUMMY_LIBDEBUGINFOD + AM_CPPFLAGS += -Wno-unused-parameter + endif +@@ -92,42 +77,7 @@ if LIBDEBUGINFOD + pkginclude_HEADERS = debuginfod.h + endif + +-if LIBDEBUGINFOD +-libdebuginfod_so_LIBS = libdebuginfod_pic.a +-if DUMMY_LIBDEBUGINFOD +-libdebuginfod_so_LDLIBS = +-else +-libdebuginfod_so_LDLIBS = -lpthread $(libcurl_LIBS) $(fts_LIBS) $(libelf) +-endif +-$(LIBDEBUGINFOD_SONAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS) +- $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ +- -Wl,--soname,$(LIBDEBUGINFOD_SONAME) \ +- -Wl,--version-script,$< \ +- $(NO_UNDEFINED) \ +- -Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \ +- $(libdebuginfod_so_LDLIBS) +- @$(textrel_check) +- +-libdebuginfod.so: $(LIBDEBUGINFOD_SONAME) +- ln -fs $< $@ +- +-install: install-am libdebuginfod.so +- $(mkinstalldirs) $(DESTDIR)$(libdir) +- $(INSTALL_PROGRAM) $(LIBDEBUGINFOD_SONAME) \ +- $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so +- ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME) +- ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so +- +-uninstall: uninstall-am +- rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so +- rm -f $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME) +- rm -f $(DESTDIR)$(libdir)/libdebuginfod.so +- rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils +-endif +- + EXTRA_DIST = libdebuginfod.map +-MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME) +-CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so + + # automake std-options override: arrange to pass LD_LIBRARY_PATH + installcheck-binPROGRAMS: $(bin_PROGRAMS) +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -31,9 +31,9 @@ include $(top_srcdir)/config/eu.am + AM_CFLAGS += $(fpic_CFLAGS) + AM_CPPFLAGS += -I$(srcdir)/../libelf + +-noinst_LIBRARIES = libeu.a ++noinst_LTLIBRARIES = libeu.la + +-libeu_a_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \ ++libeu_la_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \ + crc32.c crc32_file.c \ + color.c error.c printversion.c + +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -29,9 +29,9 @@ bin_PROGRAMS = readelf nm size strip elf + elfcmp objdump ranlib strings ar unstrip stack elfcompress \ + elfclassify + +-noinst_LIBRARIES = libar.a ++noinst_LTLIBRARIES = libar.la + +-libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c ++libar_la_SOURCES = arlib.c arlib2.c arlib-argp.c + + EXTRA_DIST = arlib.h debugpred.h + +@@ -39,17 +39,11 @@ bin_SCRIPTS = make-debug-archive + EXTRA_DIST += make-debug-archive.in + CLEANFILES += make-debug-archive + +-if BUILD_STATIC +-libasm = ../libasm/libasm.a +-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) -ldl -lpthread +-libelf = ../libelf/libelf.a -lz +-else +-libasm = ../libasm/libasm.so +-libdw = ../libdw/libdw.so +-libelf = ../libelf/libelf.so +-endif +-libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a +-libeu = ../lib/libeu.a ++libasm = ../libasm/libasm.la ++libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) -ldl -lpthread ++libelf = ../libelf/libelf.la ++libebl = ../libebl/libebl.la ../backends/libebl_backends.la ../libcpu/libcpu.la ++libeu = ../lib/libeu.la + + if DEMANGLE + demanglelib = -lstdc++ +@@ -77,9 +71,9 @@ findtextrel_LDADD = $(libdw) $(libelf) $ + addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib) + elfcmp_LDADD = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD) + objdump_LDADD = $(libasm) $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD) +-ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) ++ranlib_LDADD = libar.la $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) + strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) +-ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) ++ar_LDADD = libar.la $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) + unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) + stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib) + elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -662,17 +662,11 @@ installcheck-local: + TESTS_ENVIRONMENT="$(installed_TESTS_ENVIRONMENT)" \ + LOG_COMPILER="$(installed_LOG_COMPILER)" check-TESTS + +-if BUILD_STATIC +-libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread +-libelf = ../libelf/libelf.a -lz +-libasm = ../libasm/libasm.a +-else +-libdw = ../libdw/libdw.so +-libelf = ../libelf/libelf.so +-libasm = ../libasm/libasm.so +-endif +-libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a +-libeu = ../lib/libeu.a ++libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread ++libelf = ../libelf/libelf.la ++libasm = ../libasm/libasm.la ++libebl = ../libebl/libebl.la ../backends/libebl_backends.la ../libcpu/libcpu.la ++libeu = ../lib/libeu.la + + arextract_LDADD = $(libelf) + arsymtest_LDADD = $(libelf) +--- a/libcpu/Makefile.am ++++ b/libcpu/Makefile.am +@@ -38,19 +38,16 @@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAG + LEX_OUTPUT_ROOT = lex.$( $@T +@@ -87,20 +84,15 @@ endif + + i386_lex_no_Werror = yes + +-libeu = ../lib/libeu.a ++libeu = ../lib/libeu.la + + i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare \ + -Wno-implicit-fallthrough +-i386_parse.o: i386_parse.c i386.mnemonics +-i386_lex.o: i386_parse.h + i386_gendis_LDADD = $(libeu) -lm $(obstack_LIBS) + +-i386_parse.h: i386_parse.c ; +- + bpf_disasm_CFLAGS = -Wno-format-nonliteral + + EXTRA_DIST = defs/i386 + +-MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS) + CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics) + MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h) +--- a/config/libelf.pc.in ++++ b/config/libelf.pc.in +@@ -8,7 +8,7 @@ Description: elfutils libelf library to + Version: @VERSION@ + URL: http://elfutils.org/ + +-Libs: -L${libdir} -lelf ++Libs: -L${libdir} -lelf -lz + Cflags: -I${includedir} + + Requires.private: zlib @LIBZSTD@ diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 7210341167..6bb2c03fb4 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git -PKG_SOURCE_DATE:=2023-06-29 -PKG_SOURCE_VERSION:=9e2de8515be15e2b61ae518ce592e5b446ef2d48 -PKG_MIRROR_HASH:=e43d1796dd482ec364e5196f224bb1563dbb0494f0f28fb4e206ef7ef31260fb +PKG_SOURCE_DATE:=2023-10-29 +PKG_SOURCE_VERSION:=635466123429ba8682b575245bbf52e3b33b7163 +PKG_MIRROR_HASH:=316181644733b9a1592aad04ae379cc5f93ff31f03ac76225a1ad5a720265915 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk diff --git a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch b/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch deleted file mode 100644 index 45900e982c..0000000000 --- a/tools/firmware-utils/patches/001-add-sifiveu-guid-types.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff -ruN firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c firmware-utils-2022-02-28-002cfaf0/src/ptgen.c ---- firmware-utils-2022-02-28-002cfaf0.old/src/ptgen.c 2022-04-23 19:02:07.307896842 +0200 -+++ firmware-utils-2022-02-28-002cfaf0/src/ptgen.c 2022-04-22 18:48:54.477970950 +0200 -@@ -82,6 +82,14 @@ - GUID_INIT( 0x0fc63daf, 0x8483, 0x4772, \ - 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4) - -+#define GUID_PARTITION_SIFIVE_SPL \ -+ GUID_INIT( 0x5b193300, 0xfc78, 0x40cd, \ -+ 0x80, 0x02, 0xe8, 0x6c, 0x45, 0x58, 0x0b, 0x47) -+ -+#define GUID_PARTITION_SIFIVE_UBOOT \ -+ GUID_INIT( 0x2e54b353, 0x1271, 0x4842, \ -+ 0x80, 0x6f, 0xe4, 0x36, 0xd6, 0xaf, 0x69, 0x85) -+ - #define GPT_HEADER_SIZE 92 - #define GPT_ENTRY_SIZE 128 - #define GPT_ENTRY_MAX 128 -@@ -276,6 +284,19 @@ - (1ULL << 56); /* success=1 */ - return true; - } -+ -+ if (!strcmp(type, "sifiveu_spl")) { -+ part->has_guid = true; -+ part->guid = GUID_PARTITION_SIFIVE_SPL; -+ return true; -+ } -+ -+ if (!strcmp(type, "sifiveu_uboot")) { -+ part->has_guid = true; -+ part->guid = GUID_PARTITION_SIFIVE_UBOOT; -+ return true; -+ } -+ - return false; - } - diff --git a/tools/gnulib/Makefile b/tools/gnulib/Makefile index 43d86c213c..2ce763f6ab 100644 --- a/tools/gnulib/Makefile +++ b/tools/gnulib/Makefile @@ -18,10 +18,11 @@ define Host/Install $(INSTALL_DATA) $(HOST_BUILD_DIR)/m4/*.m4 $(1)/share/aclocal/ $(INSTALL_DIR) $(1)/share/gnulib $(CP) $(HOST_BUILD_DIR)/* $(1)/share/gnulib/ + ln -sf ../share/gnulib/gnulib-tool $(STAGING_DIR_HOST)/bin/gnulib-tool endef define Host/Clean - rm -rf $(STAGING_DIR_HOST)/share/gnulib + rm -rf $(STAGING_DIR_HOST)/bin/gnulib-tool $(STAGING_DIR_HOST)/share/gnulib endef $(eval $(call HostBuild)) diff --git a/tools/include/endian.h b/tools/include/endian.h index e2ac755667..f625689f3d 100644 --- a/tools/include/endian.h +++ b/tools/include/endian.h @@ -37,4 +37,52 @@ #define __LITTLE_ENDIAN LITTLE_ENDIAN #endif +#ifndef __linux__ +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define htobe16(x) bswap_16(x) +#define be16toh(x) bswap_16(x) +#define htobe32(x) bswap_32(x) +#define be32toh(x) bswap_32(x) +#define htobe64(x) bswap_64(x) +#define be64toh(x) bswap_64(x) +#define htole16(x) (uint16_t)(x) +#define le16toh(x) (uint16_t)(x) +#define htole32(x) (uint32_t)(x) +#define le32toh(x) (uint32_t)(x) +#define htole64(x) (uint64_t)(x) +#define le64toh(x) (uint64_t)(x) +#else +#define htobe16(x) (uint16_t)(x) +#define be16toh(x) (uint16_t)(x) +#define htobe32(x) (uint32_t)(x) +#define be32toh(x) (uint32_t)(x) +#define htobe64(x) (uint64_t)(x) +#define be64toh(x) (uint64_t)(x) +#define htole16(x) bswap_16(x) +#define le16toh(x) bswap_16(x) +#define htole32(x) bswap_32(x) +#define le32toh(x) bswap_32(x) +#define htole64(x) bswap_64(x) +#define le64toh(x) bswap_64(x) +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define betoh16(x) bswap_16(x) +#define betoh32(x) bswap_32(x) +#define betoh64(x) bswap_64(x) +#define letoh16(x) (uint16_t)(x) +#define letoh32(x) (uint32_t)(x) +#define letoh64(x) (uint64_t)(x) +#else +#define betoh16(x) (uint16_t)(x) +#define betoh32(x) (uint32_t)(x) +#define betoh64(x) (uint64_t)(x) +#define letoh16(x) bswap_16(x) +#define letoh32(x) bswap_32(x) +#define letoh64(x) bswap_64(x) +#endif +#endif +#endif + #endif